[CMF-checkins] CVS: CMF/CMFCollector - Collector.py:1.23.4.1 CollectorIssue.py:1.38.2.1

Tres Seaver tseaver@zope.com
Thu, 27 Dec 2001 20:01:03 -0500


Update of /cvs-repository/CMF/CMFCollector
In directory cvs.zope.org:/tmp/cvs-serv31472

Modified Files:
      Tag: tseaver-collector_refactoring-branch
	Collector.py CollectorIssue.py 
Log Message:


  - Collector: Add methods for data access;  modified issue
    skins to use these methods, rather than rely directly on attributes.

  - CollectorIssue:
  
    o Refactored to make its responsibilities clearer, and to enable
      programmatic creation of instances without requiring passed-in
      context.  In particular, added methods for direct management of
      supporters and kibitzers lists to the class (instances should
      *not* depend on a specific workflow implementation to satisfy
      their responsibilities).
    
    o Renamed all attributes to start with leading underscore, to enforce
      use of accessors / mutators (newly added) in skins.

    o Exposed and protected several helper methods, to permit their use
      from skins (where I want to move much of the policy currently
      hard-wired into the class).

    o Added unit tests for new accessor / mutator methods.

  - Assorted skin cleanups:

    o Use 'portal_membership.getAuthenticatedMember()' rather than
      'getSecurityManager...'.

    o Use accessor methods rather than attributes throughout.


=== CMF/CMFCollector/Collector.py 1.23 => 1.23.4.1 ===
         return got
 
+    security.declareProtected(CMFCorePermissions.View, 'listTopics')
+    def listTopics(self):
+        """
+            Return the list of values which can be assigned as an issue's
+            'topic'.
+        """
+        return self.topics
+
+    security.declareProtected(CMFCorePermissions.View, 'listClassifications')
+    def listClassifications(self):
+        """
+            Return the list of values which can be assigned as an issue's
+            'classification'.
+        """
+        return self.classifications
+
+    security.declareProtected(CMFCorePermissions.View, 'listImportances')
+    def listImportances(self):
+        """
+            Return the list of values which can be assigned as an issue's
+            'importance'.
+        """
+        return self.importances
+
+    security.declareProtected(CMFCorePermissions.View, 'listSupporters')
+    def listSupporters(self):
+        """
+            Return the list of users who are assigned as supporters to
+            this collector.
+        """
+        return self.supporters
+
     security.declareProtected(CMFCorePermissions.View, 'Subject')
     def Subject(self):
         return self.topics


=== CMF/CMFCollector/CollectorIssue.py 1.38 => 1.38.2.1 === (1099/1199 lines abridged)
 
 class CollectorIssue(SkinnedFolder, DefaultDublinCoreImpl):
-    """An individual support request in the CMF Collector."""
+    """
+        Represent a single issue (bug report, design problem, feature
+        request, etc.) within a given CMFColletor instance.
 
-    meta_type = 'CMF Collector Issue'
-    effective_date = expiration_date = None
-    TRANSCRIPT_FORMAT = 'webtext'
-    
-    security = ClassSecurityInfo()
+        Issues are responsible for:
 
-    action_number = 0
+          - Managing a set of issue propoerties.
 
-    ACTIONS_ORDER = ['Accept', 'Assign',
-                     'Resolve', 'Reject', 'Defer',
-                     'Resign'] 
-
-    # Accumulated instance-data backwards-compatability values:
-    _collector_path = None
-    # XXX This security declaration doesn't seem to have an effect?
-    security.declareProtected(EditCollectorIssue, 'submitter_email')
-    submitter_email = None
-    submitter_name = None
-    invisible = 0
-    version_info = ''
-
-    def __init__(self,
-                 id, container, 
-                 title='', description='',
-                 submitter_id=None, submitter_name=None,
-                 submitter_email=None,
-                 kibitzers=None,
-                 security_related=0,
-                 topic=None, classification=None, importance=None, 
-                 resolution=None,
-                 version_info=None,
-                 creation_date=None, modification_date=None,
-                 effective_date=None, expiration_date=None,
-                 assignees=None,
-                 file=None, fileid=None, filetype=None,
-                 invisible=0):
-        """ """
+          - Holding a transcript, plus other uploaded artifacts.
 
-        self.invisible = invisible
-        SkinnedFolder.__init__(self, id, title)

[-=- -=- -=- 1099 lines omitted -=- -=- -=-]

-                + (self.resolution or '') + ' '
-                + self.version_info + ' '
-                + ((self.security_related and 'security_related') or ''))
-
-    def Subject(self):
-        """The structured attributes."""
-        return (self.topic,
-                self.classification,
-                self.importance,
-                )
-
     def __len__(self):
         """Number of uploaded artifacts (ie, excluding transcript)."""
         return len(self.objectIds()) - 1
@@ -731,14 +1108,14 @@
                       submitter_name=None,
                       submitter_email=None,
                       kibitzers=None,
+                      security_related=0,
                       topic=None,
                       classification=None,
-                      security_related=0,
                       importance=None,
                       version_info=None,
-                      assignees=None,
-                      file=None, fileid=None, filetype=None,
-                      REQUEST=None):
+                      invisible=0,
+                      REQUEST=None
+                     ):
     """Create a new issue in the collector.
 
     We return a string indicating any errors, or None if there weren't any."""
@@ -751,13 +1128,13 @@
                         submitter_name=submitter_name,
                         submitter_email=submitter_email,
                         kibitzers=kibitzers,
+                        security_related=security_related,
                         topic=topic,
                         classification=classification,
-                        security_related=security_related,
                         importance=importance,
                         version_info=version_info,
-                        assignees=assignees,
-                        file=file, fileid=fileid, filetype=filetype)
+                        invisible=invisible
+                       )
     it = self._getOb(it.id)
     got = it.do_action('request', description, assignees,
                        file, fileid, filetype)