[CMF-checkins] CVS: CMF/CMFTopic - DateCriteria.py:1.7 ListCriterion.py:1.12 SimpleIntCriterion.py:1.10 SimpleStringCriterion.py:1.10 SortCriterion.py:1.6 Topic.py:1.31
Florent Guillaume
fg@nuxeo.com
Sat, 3 Aug 2002 22:32:32 -0400
Update of /cvs-repository/CMF/CMFTopic
In directory cvs.zope.org:/tmp/cvs-serv17343/CMFTopic
Modified Files:
DateCriteria.py ListCriterion.py SimpleIntCriterion.py
SimpleStringCriterion.py SortCriterion.py Topic.py
Log Message:
Pure stylistic and code formatting changes:
- Cleanup CMFCorePermissions imports.
- Always put security.declareProtected and friends on a single line
and just in front of the definition they're protecting, so that
automated coherency checking can be done using simple tools like
grep.
=== CMF/CMFTopic/DateCriteria.py 1.6 => 1.7 ===
from Products.CMFTopic.AbstractCriterion import AbstractCriterion
from Products.CMFTopic.interfaces import Criterion
from Products.CMFTopic.Topic import Topic
-from Products.CMFTopic.Topic import TopicPermissions
+from Products.CMFTopic import TopicPermissions
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFCore.CMFCorePermissions import View
from AccessControl import ClassSecurityInfo
from DateTime.DateTime import DateTime
@@ -104,7 +104,7 @@
else:
raise ValueError, 'Date range not in set {old,ahead}'
- security.declareProtected( CMFCorePermissions.View, 'getCriteriaItems' )
+ security.declareProtected(View, 'getCriteriaItems')
def getCriteriaItems( self ):
"""
Return a sequence of items to be used to build the catalog query.
=== CMF/CMFTopic/ListCriterion.py 1.11 => 1.12 ===
from Products.CMFTopic.Topic import Topic
from Products.CMFTopic import TopicPermissions
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFCore.CMFCorePermissions import View
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
@@ -80,7 +80,7 @@
self.operator = operator
- security.declareProtected( CMFCorePermissions.View, 'getCriteriaItems' )
+ security.declareProtected(View, 'getCriteriaItems')
def getCriteriaItems( self ):
"""
Return a tuple of query elements to be passed to the catalog
=== CMF/CMFTopic/SimpleIntCriterion.py 1.9 => 1.10 ===
from Products.CMFTopic.Topic import Topic
from Products.CMFTopic.interfaces import Criterion
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFCore.CMFCorePermissions import View
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
@@ -108,7 +108,7 @@
self.value = int( value )
self.direction = None
- security.declareProtected( CMFCorePermissions.View, 'getCriteriaItems' )
+ security.declareProtected(View, 'getCriteriaItems')
def getCriteriaItems( self ):
"""
Return a tuple of query elements to be passed to the catalog
=== CMF/CMFTopic/SimpleStringCriterion.py 1.9 => 1.10 ===
from Products.CMFTopic.Topic import Topic
from Products.CMFTopic.interfaces import Criterion
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFCore.CMFCorePermissions import View
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
@@ -56,7 +56,7 @@
"""
self.value = str( value )
- security.declareProtected( CMFCorePermissions.View, 'getCriteriaItems' )
+ security.declareProtected(View, 'getCriteriaItems')
def getCriteriaItems( self ):
"""
Return a sequence of criteria items, used by Topic.buildQuery.
=== CMF/CMFTopic/SortCriterion.py 1.5 => 1.6 ===
from Products.CMFTopic.interfaces import Criterion
from Products.CMFTopic import TopicPermissions
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFCore.CMFCorePermissions import View
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
@@ -67,7 +67,7 @@
"""
self.reversed = not not reversed
- security.declareProtected( CMFCorePermissions.View, 'getCriteriaItems' )
+ security.declareProtected(View, 'getCriteriaItems')
def getCriteriaItems( self ):
"""
Return a tuple of query elements to be passed to the catalog
=== CMF/CMFTopic/Topic.py 1.30 => 1.31 ===
$Id$
"""
-from Products.CMFTopic import TopicPermissions
-
-from Products.CMFCore import CMFCorePermissions
+from Products.CMFTopic.TopicPermissions import ChangeTopics
+from Products.CMFTopic.TopicPermissions import AddTopics
+from Products.CMFCore.CMFCorePermissions import View
from Products.CMFCore.utils import _checkPermission, _getViewFor,getToolByName
from Products.CMFCore.PortalFolder import PortalFolder
@@ -43,22 +43,22 @@
( { 'id' : 'view'
, 'name' : 'View'
, 'action' : 'topic_view'
- , 'permissions' : (CMFCorePermissions.View, )
+ , 'permissions' : (View,)
}
, { 'id' : 'edit'
, 'name' : 'Edit'
, 'action' : 'topic_edit_form'
- , 'permissions' : (TopicPermissions.ChangeTopics, )
+ , 'permissions' : (ChangeTopics,)
}
, { 'id' : 'criteria'
, 'name' : 'Criteria'
, 'action' : 'topic_criteria_form'
- , 'permissions' : (TopicPermissions.ChangeTopics, )
+ , 'permissions' : (ChangeTopics,)
}
, { 'id' : 'subtopics'
, 'name' : 'Subtopics'
, 'action' : 'topic_subtopics_form'
- , 'permissions' : (TopicPermissions.ChangeTopics, )
+ , 'permissions' : (ChangeTopics,)
}
)
}
@@ -88,7 +88,7 @@
security = ClassSecurityInfo()
- security.declareObjectProtected( CMFCorePermissions.View )
+ security.declareObjectProtected(View)
acquireCriteria = 1
_criteriaTypes = []
@@ -96,7 +96,7 @@
# Contentish interface methods
# ----------------------------
- security.declareProtected( CMFCorePermissions.View, 'icon' )
+ security.declareProtected(View, 'icon')
def icon( self ):
"""
For the ZMI.
@@ -125,7 +125,7 @@
index_html = None # This special value informs ZPublisher to use __call__
- security.declareProtected( CMFCorePermissions.View, 'view' )
+ security.declareProtected(View, 'view')
def view( self ):
"""
Return the default view even if index_html is overridden.
@@ -139,7 +139,7 @@
result.append( mt.meta_type )
return tuple( result )
- security.declareProtected( TopicPermissions.ChangeTopics, 'listCriteria' )
+ security.declareProtected(ChangeTopics, 'listCriteria')
def listCriteria( self ):
"""
Return a list of our criteria objects.
@@ -147,8 +147,7 @@
return self.objectValues( self._criteria_metatype_ids() )
- security.declareProtected( TopicPermissions.ChangeTopics
- , 'listCriteriaTypes' )
+ security.declareProtected(ChangeTopics, 'listCriteriaTypes')
def listCriteriaTypes( self ):
out = []
for ct in self._criteriaTypes:
@@ -157,8 +156,7 @@
} )
return out
- security.declareProtected( TopicPermissions.ChangeTopics
- , 'listAvailableFields' )
+ security.declareProtected(ChangeTopics, 'listAvailableFields')
def listAvailableFields( self ):
"""
Return a list of available fields for new criteria.
@@ -171,14 +169,14 @@
)
return availfields
- security.declareProtected( TopicPermissions.ChangeTopics, 'listSubtopics' )
+ security.declareProtected(ChangeTopics, 'listSubtopics')
def listSubtopics( self ):
"""
Return a list of our subtopics.
"""
return self.objectValues( self.meta_type )
- security.declareProtected( TopicPermissions.ChangeTopics, 'edit' )
+ security.declareProtected(ChangeTopics, 'edit')
def edit( self, acquireCriteria, title=None, description=None ):
"""
Set the flag which indicates whether to acquire criteria
@@ -189,7 +187,7 @@
self.title = title
self.description = description
- security.declareProtected( CMFCorePermissions.View, 'buildQuery' )
+ security.declareProtected(View, 'buildQuery')
def buildQuery( self ):
"""
Construct a catalog query using our criterion objects.
@@ -211,7 +209,7 @@
return result
- security.declareProtected( CMFCorePermissions.View, 'queryCatalog' )
+ security.declareProtected(View, 'queryCatalog')
def queryCatalog( self, REQUEST=None, **kw ):
"""
Invoke the catalog using our criteria to augment any passed
@@ -223,7 +221,7 @@
### Criteria adding/editing/deleting
- security.declareProtected( TopicPermissions.ChangeTopics, 'addCriterion' )
+ security.declareProtected(ChangeTopics, 'addCriterion')
def addCriterion( self, field, criterion_type ):
"""
Add a new search criterion.
@@ -241,11 +239,10 @@
self._setObject( newid, crit )
# Backwards compatibility (deprecated)
- security.declareProtected( TopicPermissions.ChangeTopics, 'addCriteria' )
+ security.declareProtected(ChangeTopics, 'addCriteria')
addCriteria = addCriterion
- security.declareProtected( TopicPermissions.ChangeTopics
- , 'deleteCriterion' )
+ security.declareProtected(ChangeTopics, 'deleteCriterion')
def deleteCriterion( self, criterion_id ):
"""
Delete selected criterion.
@@ -256,7 +253,7 @@
for cid in criterion_id:
self._delObject( cid )
- security.declareProtected( CMFCorePermissions.View, 'getCriterion' )
+ security.declareProtected(View, 'getCriterion')
def getCriterion( self, criterion_id ):
"""
Get the criterion object.
@@ -266,7 +263,7 @@
except AttributeError:
return self._getOb( criterion_id )
- security.declareProtected( TopicPermissions.AddTopics, 'addSubtopic' )
+ security.declareProtected(AddTopics, 'addSubtopic')
def addSubtopic( self, id ):
"""
Add a new subtopic.