From: Nikolay K. <faf...@us...> - 2004-09-07 14:03:22
|
Update of /cvsroot/collective/CMFBoard In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv903 Modified Files: ForumCatalog.py ForumPermissions.py ForumTopic.py TreeSupport.py Log Message: delete form Index: ForumTopic.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/ForumTopic.py,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- ForumTopic.py 3 Sep 2004 19:13:13 -0000 1.84 +++ ForumTopic.py 7 Sep 2004 14:03:10 -0000 1.85 @@ -22,7 +22,6 @@ from ForumPermissions import * from HitsCounter import HitsCounterTopic from ForumCatalog import ForumCatalogAware -from ListSupport import ListSupport from TreeSupport import TreeSupport from uihelpers import TopicView from CacheHooks import CacheHooks @@ -53,7 +52,7 @@ class ForumTopic(TopicView, BaseBTreeFolder, Subscribeable, HitsCounterTopic, - ForumCatalogAware, ListSupport, TreeSupport, CacheHooks): + ForumCatalogAware, TreeSupport, CacheHooks): """ """ meta_type = 'ForumTopic' archetype_name = 'Forum Topic' @@ -61,7 +60,6 @@ __implements__ = (BaseBTreeFolder.__implements__ + Subscribeable.__implements__ + HitsCounterTopic.__implements__ + - ListSupport.__implements__ + TreeSupport.__implements__) schema = schema @@ -80,7 +78,7 @@ }, { 'id': 'delete', 'name': 'Delete', - 'action': 'string:$object_url/forum_message_delete_form', + 'action': 'string:$object_url/forum_topic_delete', 'permissions': (ModifyTopic,) }, ) @@ -101,7 +99,6 @@ def __init__(self, id, **kwargs): BaseBTreeFolder.__init__(self, id, **kwargs) - ListSupport.__init__(self) TreeSupport.__init__(self) def _change_sticky_flag(self, value): @@ -195,24 +192,10 @@ return msg - security.declareProtected(Permissions.delete_objects, 'manage_delObjects') - def manage_delObjects(self, ids=[], REQUEST=None): - """ """ - return self.manage_deleteReply(ids, REQUEST) - - security.declareProtected(DeleteTopic, 'manage_deleteMessage') - def manage_deleteMessage(self, REQUEST=None): + security.declareProtected(ModifyTopic, 'manage_deleteTopic') + def manage_deleteTopic(self, REQUEST=None): """ """ aq_parent(self).manage_delObjects([self.getId()]) - return aq_parent(self) - - security.declarePrivate('manage_deleteReply') - def manage_deleteReply(self, ids, REQUEST=None): - """ """ - if type(ids) == type(''): - ids = [ids] - - BaseBTreeFolder.manage_delObjects(self, ids) security.declareProtected(View, 'getTopic') def getTopic(self): Index: ForumPermissions.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/ForumPermissions.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ForumPermissions.py 6 Sep 2004 02:53:34 -0000 1.14 +++ ForumPermissions.py 7 Sep 2004 14:03:10 -0000 1.15 @@ -23,7 +23,7 @@ AddTopic = 'CMFBoard: Add forum topic' setDefaultRoles( AddTopic, ( 'Manager', 'Forum manager' )) -AddTopicReply = 'CMFBoard: Add forum topic reply' +AddTopicReply = 'CMFBoard: Add forum reply' setDefaultRoles( AddTopicReply, ( 'Manager', 'Forum manager', forumReviewer)) AddPoll = 'CMFBoard: Add forum poll' Index: ForumCatalog.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/ForumCatalog.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ForumCatalog.py 2 Sep 2004 11:12:02 -0000 1.10 +++ ForumCatalog.py 7 Sep 2004 14:03:10 -0000 1.11 @@ -26,7 +26,8 @@ security.declarePublic(View, 'dump_catalog') def dump_catalog(self): """ """ - print list(self._review_index.items()) + for key, val in list(self._review_index.items()): + print key, list(val.keys()) def __init__(self): ListSupport.__init__(self) Index: TreeSupport.py =================================================================== RCS file: /cvsroot/collective/CMFBoard/TreeSupport.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- TreeSupport.py 6 Sep 2004 17:06:51 -0000 1.3 +++ TreeSupport.py 7 Sep 2004 14:03:11 -0000 1.4 @@ -5,22 +5,24 @@ $Id$ """ -from ExtensionClass import Base -from AccessControl import ClassSecurityInfo +from Globals import InitializeClass from BTrees.IOBTree import IOBTree from BTrees.IIBTree import IIBTree, IITreeSet +from AccessControl import ClassSecurityInfo from interfaces import TreeSupport +from ListSupport import ListSupport -class TreeSupport(Base): +class TreeSupport(ListSupport): - __implements__ = (TreeSupport,) + __implements__ = ListSupport.__implements__ + (TreeSupport,) security = ClassSecurityInfo() def __init__(self): self._tree_index = IOBTree() self._tree_unindex = IIBTree() + ListSupport.__init__(self) def getParent(self, msgId): """ return parent of message """ @@ -92,28 +94,45 @@ for key, val in self._tree_index.items(): print key, list(val.keys()) + root = hash(self.getId()) + return LazyTree(self, root, root) + def dumpTree(self): """ """ print self.getObjectsTree() +InitializeClass(TreeSupport) + class LazyTree: - def __init__(self, base): - #load children - pass + def __init__(self, support, base, root): + self._support = support + self._parent = None + self._base = base + self._root = root + + hash_map = support._hash_map + + self._id = hash_map[base] + self._children_ids = [hash_map.get(key) for key in support[base]] + + print self._id, self._children_ids, self._base, self._root def __len__(self): pass def __getitem__(self, key): pass + + def isRoot(self): + return self._base == self._root def getId(self): - pass + return self._id def getParent(self): pass def getChildrenIds(self): - pass + return self._children_ids |