summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ecc8232)
raw | patch | inline | side by side (parent: ecc8232)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 8 Sep 2003 20:39:18 +0000 (20:39 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 8 Sep 2003 20:39:18 +0000 (20:39 +0000) |
- Replace all references to curuserid with calls to getuid().
- Changed the docs to point to always point to getuid() and mention the change
in upgrading.txt.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1867 57a73879-2fb5-44c3-a270-3262357dd7e2
- Changed the docs to point to always point to getuid() and mention the change
in upgrading.txt.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1867 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/doc/customizing.txt b/doc/customizing.txt
index 9ac41f505f589a9a5e5db1fe510357bba2a84180..120eaff055afd73b2b4aaa85597bfd8dd01c04f2 100644 (file)
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
Customising Roundup
===================
-:Version: $Revision: 1.96 $
+:Version: $Revision: 1.97 $
.. This document borrows from the ZopeBook section on ZPT. The original is at:
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
python:db.user
Also, the current id of the current user is available as
-``db.curuserid``. This isn't so useful in templates (where you have
+``db.getuid()``. This isn't so useful in templates (where you have
``request/user``), but it can be useful in detectors or interfaces.
The access results in a `hyperdb class wrapper`_.
diff --git a/doc/design.txt b/doc/design.txt
index 4d9bcc00decf5daa27f1192fb7ec6fcfc1149643..6b00926da32edee9b56d627b1b74265a4a0057f1 100644 (file)
--- a/doc/design.txt
+++ b/doc/design.txt
class Database:
"""A database for storing records containing flexible data
types.
-
- The id of the current user is available on the database as
- 'self.curuserid'.
"""
def __init__(self, config, journaltag=None):
diff --git a/doc/upgrading.txt b/doc/upgrading.txt
index 6c6e61366684acb0a4fc43515b13accdee6e1b7a..e77d41d46837c206b2af33dd916e9803ef944c70 100644 (file)
--- a/doc/upgrading.txt
+++ b/doc/upgrading.txt
.. contents::
+Migrating from 0.6 to 0.7
+=========================
+
+0.7.0 Getting the current user id
+---------------------------------
+
+Removed Database.curuserid attribute. Any code referencing this attribute should
+be replaced with a call to Database.getuid().
+
+
Migrating from 0.5 to 0.6
=========================
index 0eaf60593f2816a38fe93eac8675de340d67e4c8..33392a754f40abae53b12666a8cad081da94542b 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.126 2003-09-06 20:01:10 jlgijsbers Exp $
+#$Id: back_anydbm.py,v 1.127 2003-09-08 20:39:18 jlgijsbers Exp $
'''
This module defines a backend that saves the hyperdatabase in a database
chosen by anydbm. It is guaranteed to always be available in python
# reindex the db if necessary
if self.indexer.should_reindex():
self.reindex()
- self.figure_curuserid()
def reindex(self):
for klass in self.classes.values():
# add in the "calculated" properties (dupe so we don't affect
# calling code's node assumptions)
node = node.copy()
- node['creator'] = self.curuserid
+ node['creator'] = self.getuid()
node['creation'] = node['activity'] = date.Date()
self.newnodes.setdefault(classname, {})[nodeid] = 1
cache_creator, cache_creation) = args
if cache_classname == classname and cache_nodeid == nodeid:
if not cache_creator:
- cache_creator = self.curuserid
+ cache_creator = self.getuid()
if not cache_creation:
cache_creation = date.Date()
res.append((cache_nodeid, cache_creation, cache_creator,
if creator:
journaltag = creator
else:
- journaltag = self.curuserid
+ journaltag = self.getuid()
if creation:
journaldate = creation.serialise()
else:
# user's been retired, return admin
return '1'
else:
- return self.db.curuserid
+ return self.db.getuid()
# get the property (raises KeyErorr if invalid)
prop = self.properties[propname]
index bffebf9116d20d6b3ec0b30e3c2626b9cd6d29fa..2b2a5046ee20faa26db1afbefecae7e287fe075d 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb.py,v 1.26 2003-05-09 01:47:50 richard Exp $
+#$Id: back_bsddb.py,v 1.27 2003-09-08 20:39:18 jlgijsbers Exp $
'''
This module defines a backend that saves the hyperdatabase in BSDDB.
'''
cache_creator, cache_creation) = args
if cache_classname == classname and cache_nodeid == nodeid:
if not cache_creator:
- cache_creator = self.curuserid
+ cache_creator = self.getuid()
if not cache_creation:
cache_creation = date.Date()
res.append((cache_nodeid, cache_creation, cache_creator,
index 90f337903254a46cbfe4d4126bfbab3b31abe2e5..2c01d57e881eb31ffebca3e6a970c202be10a961 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb3.py,v 1.19 2003-05-09 01:47:50 richard Exp $
+#$Id: back_bsddb3.py,v 1.20 2003-09-08 20:39:18 jlgijsbers Exp $
'''
This module defines a backend that saves the hyperdatabase in BSDDB3.
'''
cache_creator, cache_creation) = args
if cache_classname == classname and cache_nodeid == nodeid:
if not cache_creator:
- cache_creator = self.curuserid
+ cache_creator = self.getuid()
if not cache_creation:
cache_creation = date.Date()
res.append((cache_nodeid, cache_creation, cache_creator,
index 64ab3d7841b433dba49a80a2460c352acb2bd252..68dc2955290742b85028b52c013acafc05b885ab 100755 (executable)
-# $Id: back_metakit.py,v 1.49 2003-09-04 00:47:01 richard Exp $
+# $Id: back_metakit.py,v 1.50 2003-09-08 20:39:18 jlgijsbers Exp $
'''
Metakit backend for Roundup, originally by Gordon McMillan.
_dbs[config.DATABASE] = db
else:
db.journaltag = journaltag
- try:
- delattr(db, 'curuserid')
- except AttributeError:
- pass
return db
class _Database(hyperdb.Database, roundupdb.Database):
# --- defined in ping's spec
def __getattr__(self, classname):
- if classname == 'curuserid':
- if self.journaltag is None:
- return None
-
- # try to set the curuserid from the journaltag
- try:
- x = int(self.classes['user'].lookup(self.journaltag))
- self.curuserid = x
- except KeyError:
- if self.journaltag == 'admin':
- self.curuserid = x = 1
- else:
- x = 0
- return x
- elif classname == 'transactions':
+ if classname == 'transactions':
return self.dirty
# fall back on the classes
return self.getclass(classname)
if tblid == -1:
tblid = self.tables.append(name=tablenm)
if creator is None:
- creator = self.curuserid
+ creator = self.getuid()
else:
try:
creator = int(creator)
if not row.creation:
row.creation = int(time.time())
if not row.creator:
- row.creator = self.db.curuserid
+ row.creator = self.db.getuid()
self.db.dirty = 1
if self.do_journal:
index 216fce963e14eaefd2734697688a2b44516f5d16..5d67abc4ca6d56089099a2c52cfeb1065a7f980d 100644 (file)
-# $Id: rdbms_common.py,v 1.61 2003-09-06 20:01:10 jlgijsbers Exp $
+# $Id: rdbms_common.py,v 1.62 2003-09-08 20:39:18 jlgijsbers Exp $
''' Relational database (SQL) backend common code.
Basics:
# commit
self.conn.commit()
- self.figure_curuserid()
-
def reindex(self):
for klass in self.classes.values():
for nodeid in klass.list():
# calling code's node assumptions)
node = node.copy()
node['creation'] = node['activity'] = date.Date()
- node['creator'] = self.curuserid
+ node['creator'] = self.getuid()
# default the non-multilink columns
for col, prop in cl.properties.items():
if creator:
journaltag = creator
else:
- journaltag = self.curuserid
+ journaltag = self.getuid()
if creation:
journaldate = creation.serialise()
else:
if d.has_key('creator'):
return d['creator']
else:
- return self.db.curuserid
+ return self.db.getuid()
# get the property (raises KeyErorr if invalid)
prop = self.properties[propname]
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 5bc4928a7af2e94a67591345661b6602e37d9a35..417067bf1b4a2e6d91ecfb64b581d2c3cc0ff7e1 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.89 2003-09-08 09:28:28 jlgijsbers Exp $
+# $Id: roundupdb.py,v 1.90 2003-09-08 20:39:18 jlgijsbers Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
def getuid(self):
"""Return the id of the "user" node associated with the user
that owns this connection to the hyperdatabase."""
- return self.user.lookup(self.journaltag)
+ if self.journaltag is None:
+ return None
+ elif self.journaltag == 'admin':
+ # admin user may not exist, but always has ID 1
+ return '1'
+ else:
+ return self.user.lookup(self.journaltag)
def getUserTimezone(self):
"""Return user timezone defined in 'timezone' property of user class.
timezone = 0
return timezone
- def figure_curuserid(self):
- """Figure out the 'curuserid'."""
- if self.journaltag is None:
- self.curuserid = None
- elif self.journaltag == 'admin':
- # admin user may not exist, but always has ID 1
- self.curuserid = '1'
- else:
- self.curuserid = self.user.lookup(self.journaltag)
-
def confirm_registration(self, otk):
props = self.otks.getall(otk)
for propname, proptype in self.user.getprops().items():
# tag new user creation with 'admin'
self.journaltag = 'admin'
- self.figure_curuserid()
# create the new user
cl = self.user