[CMF-checkins] CVS: CMF/CMFWiki - CMFWikiPage.py:1.28
Chris McDonough
chrism@zope.com
Thu, 17 Oct 2002 15:38:37 -0400
Update of /cvs-repository/CMF/CMFWiki
In directory cvs.zope.org:/tmp/cvs-serv16445/CMFWiki
Modified Files:
CMFWikiPage.py
Log Message:
- Multimodule checkin to convert calls from user.getUserName() to
user.getId() where appropriate. User names should not be used
as immutable references, while user ids should. The distinction
is not clearly enforcd in the stock user folder or any current user
folder implementations, but newer user folder implementations
will rely upon it.
=== CMF/CMFWiki/CMFWikiPage.py 1.27 => 1.28 ===
--- CMF/CMFWiki/CMFWikiPage.py:1.27 Sat Aug 3 23:51:56 2002
+++ CMF/CMFWiki/CMFWikiPage.py Thu Oct 17 15:38:37 2002
@@ -467,11 +467,11 @@
get_transaction().note(log)
self.last_log = log
user = getSecurityManager().getUser()
- username = user.getUserName()
- if username == 'Anonymous User':
+ if user.getUserName() == 'Anonymous User':
username = ''
- self.last_editor = username
- self.username = username
+ uid = user.getId()
+ self.last_editor = uid
+ self.username = uid
t = text + self._process_comment(comment, text, ack_requested)
self._set_text(t)
self.reindexObject()
@@ -489,11 +489,11 @@
# appended.
self.checkEditTimeStamp(timeStamp)
user = getSecurityManager().getUser()
- username = user.getUserName()
- if username == 'Anonymous User': username = ''
- self.last_editor = username
+ if user.getUserName() == 'Anonymous User': username = ''
+ uid = user.getId()
+ self.last_editor = uid
if type is not None:
- self.username = username
+ self.username = uid
self.page_type = type
if log and string.strip(log):
log = string.strip(log)
@@ -503,7 +503,7 @@
self.last_log = None
self.title=title
if text is not None:
- self.username = username
+ self.username = uid
t = text
self._set_text(t)
self.reindexObject()
@@ -674,7 +674,7 @@
# owner from the parent folder.
ob._deleteOwnershipAfterAdd()
- username = getSecurityManager().getUser().getUserName()
+ userid = getSecurityManager().getUser().getId()
subowner = self.subOwner()
owners = {}
@@ -689,12 +689,12 @@
ob.manage_addLocalRoles(user, ['Owner'])
elif subowner == 'both':
- ob.manage_addLocalRoles(username, ['Owner'])
+ ob.manage_addLocalRoles(userid, ['Owner'])
for user in owners:
ob.manage_addLocalRoles(user, ['Owner'])
else: # creator or unspecified
- ob.manage_addLocalRoles(username, ['Owner'])
+ ob.manage_addLocalRoles(userid, ['Owner'])
ob.setSubOwner(subowner)
@@ -722,9 +722,9 @@
ob._set_text(text)
if log:
get_transaction().note(log)
- if username == 'Anonymous User':
+ if user.getUserName() == 'Anonymous User':
username = ''
- ob.last_editor = username
+ ob.last_editor = userid
ob.indexObject()
# we want a Wiki page's manage_upload method to be
@@ -804,7 +804,7 @@
"""
iseditor = self.isAllowed('edit')
timestamp = DateTime().aCommon()
- userid = getSecurityManager().getUser().getUserName()
+ username = getSecurityManager().getUser().getUserName()
if string.find(text, commentsdelim) == -1:
# No commentsdelim there yet, prepend one to the current comment.
@@ -816,7 +816,7 @@
else:
ack = ''
got.append('\n%s (%s; Comment #%s) %s --'
- % (userid, timestamp, self.comment_number, ack))
+ % (username, timestamp, self.comment_number, ack))
# Process the comment:
# - Strip leading whitespace,
@@ -1078,7 +1078,7 @@
edit is the same as the last editor."""
this_belt = timeStamp
- this_user = getSecurityManager().getUser().getUserName()
+ this_user = getSecurityManager().getUser().getId()
if (# we have a safety belt value:
this_belt
@@ -1908,8 +1908,8 @@
ob = CMFWikiPage(source_string=file, __name__=id)
ob.title = title
ob.parents = []
- username = getSecurityManager().getUser().getUserName()
- ob.manage_addLocalRoles(username, ['Owner'])
+ userid = getSecurityManager().getUser().getId()
+ ob.manage_addLocalRoles(userid, ['Owner'])
ob.setSubOwner('both')
initPageMetadata(ob)
for name, perm in ob._perms.items():