[Checkins] SVN: zf.zscp/trunk/src/zf/zscp/ Implemented package PUBLICATION.cfg edit view

Roger Ineichen roger at projekt01.ch
Mon Apr 10 13:00:01 EDT 2006


Log message for revision 66798:
  Implemented package PUBLICATION.cfg edit view

Changed:
  U   zf.zscp/trunk/src/zf/zscp/configure.zcml
  U   zf.zscp/trunk/src/zf/zscp/interfaces.py
  U   zf.zscp/trunk/src/zf/zscp/publication.py
  U   zf.zscp/trunk/src/zf/zscp/publication.txt
  A   zf.zscp/trunk/src/zf/zscp/publication.zcml
  U   zf.zscp/trunk/src/zf/zscp/website/browser/package.py
  U   zf.zscp/trunk/src/zf/zscp/website/browser/repository.py

-=-
Modified: zf.zscp/trunk/src/zf/zscp/configure.zcml
===================================================================
--- zf.zscp/trunk/src/zf/zscp/configure.zcml	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/configure.zcml	2006-04-10 16:59:59 UTC (rev 66798)
@@ -5,6 +5,7 @@
   <include package=".doc" />  
   <include package=".skin" />  
   <include package=".website" /> 
-  <include file="package.zcml" />  
+  <include file="publication.zcml" />  
+  <include file="package.zcml" /> 
 
 </configure>

Modified: zf.zscp/trunk/src/zf/zscp/interfaces.py
===================================================================
--- zf.zscp/trunk/src/zf/zscp/interfaces.py	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/interfaces.py	2006-04-10 16:59:59 UTC (rev 66798)
@@ -245,19 +245,19 @@
         title=u"Author Names",
         description=u"The names of the authors of the package.",
         value_type=zope.schema.TextLine(title=u'Name'),
-        required=True)
+        required=False)
 
     authorEmail = zope.schema.List(
         title=u"Author Emails",
         description=u"The E-mails of the authors of the package.",
         value_type=zope.schema.TextLine(title=u'E-mail'),
-        required=True)
+        required=False)
 
     license = zope.schema.List(
         title=u"Licenses",
         description=u"The software license(s) of the package.",
         value_type=zope.schema.TextLine(title=u'License'),
-        required=True)
+        required=False)
 
     platform = zope.schema.List(
         title=u"Supported Platforms",
@@ -267,7 +267,7 @@
                     u"on all platforms Python is running on, i.e. the "
                     u"package is pure Python code.",
         value_type=zope.schema.TextLine(title=u'Platform'),
-        required=True,
+        required=False,
         default=[u'All'])
 
     classifier = zope.schema.List(

Modified: zf.zscp/trunk/src/zf/zscp/publication.py
===================================================================
--- zf.zscp/trunk/src/zf/zscp/publication.py	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/publication.py	2006-04-10 16:59:59 UTC (rev 66798)
@@ -18,31 +18,35 @@
 __docformat__ = "reStructuredText"
 import zope.interface
 
-from zf.zscp import interfaces, fileformat
+from zope.schema.fieldproperty import FieldProperty
+from zf.zscp.interfaces import IPublication
+from zf.zscp.fileformat import HeaderProcessor
+from zf.zscp.fileformat import HeaderProducer
 
 
 class Publication(object):
     """Publication"""
-    zope.interface.implements(interfaces.IPublication)
+    zope.interface.implements(IPublication)
 
-    packageName = None
-    name = None
-    summary = None
-    description = None
-    homePage = None
-    author = None
-    authorEmail = None
-    license = None
-    platform = None
-    classifier = None
-    developersMailinglist = None
-    usersMailinglist = None
-    issueTracker = None
-    repositoryLocation = None
-    repositoryWebLocation = None
-    certificationLevel = None
-    certificationDate = None
-    metadataVersion = None
+    def __init__(self):
+        self.packageName = None
+        self.name = None
+        self.summary = None
+        self.description = None
+        self.homePage = None
+        self.author = []
+        self.authorEmail = []
+        self.license = []
+        self.platform = []
+        self.classifier = []
+        self.developersMailinglist = None
+        self.usersMailinglist = None
+        self.issueTracker = None
+        self.repositoryLocation = None
+        self.repositoryWebLocation = None
+        self.certificationLevel = None
+        self.certificationDate = None
+        self.metadataVersion = None
 
     def __repr__(self):
         return "<%s for '%s' (meta-data version %s)>" % (
@@ -50,10 +54,10 @@
 
 def process(file):
     publication = Publication()
-    processor = fileformat.HeaderProcessor(publication, interfaces.IPublication)
+    processor = HeaderProcessor(publication, IPublication)
     processor(file)
     return publication
 
 def produce(publication):
-    producer = fileformat.HeaderProducer(publication, interfaces.IPublication)
+    producer = HeaderProducer(publication, IPublication)
     return producer()

Modified: zf.zscp/trunk/src/zf/zscp/publication.txt
===================================================================
--- zf.zscp/trunk/src/zf/zscp/publication.txt	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/publication.txt	2006-04-10 16:59:59 UTC (rev 66798)
@@ -19,8 +19,8 @@
   >>> publication.process(file)
   Traceback (most recent call last):
   ...
-  ValueError: Required headers missing: Package-name, Name, Summary, Author,
-              Author-email, License, Metadata-version
+  ValueError: Required headers missing: Package-name, Name, Summary, 
+              Metadata-version
 
 So let's now create a file that has at least those required headers:
 

Added: zf.zscp/trunk/src/zf/zscp/publication.zcml
===================================================================
--- zf.zscp/trunk/src/zf/zscp/publication.zcml	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/publication.zcml	2006-04-10 16:59:59 UTC (rev 66798)
@@ -0,0 +1,17 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zf.zscp">
+
+  <class class="zf.zscp.publication.Publication">
+    <require
+        permission="zope.Public"
+        interface="zf.zscp.interfaces.IPublication"
+        />
+    <require
+        permission="zope.ManageContent"
+        set_schema="zf.zscp.interfaces.IPublication"
+        />
+
+  </class>  
+
+</configure>


Property changes on: zf.zscp/trunk/src/zf/zscp/publication.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zf.zscp/trunk/src/zf/zscp/website/browser/package.py
===================================================================
--- zf.zscp/trunk/src/zf/zscp/website/browser/package.py	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/website/browser/package.py	2006-04-10 16:59:59 UTC (rev 66798)
@@ -26,10 +26,15 @@
     """Edit a package and it's sub forms."""
 
     form_fields = form.Fields(IPublication, prefix='publication')
-    form_fields += form.Fields(IRelease, prefix='release')
-    form_fields += form.Fields(ICertification, prefix='certification')
 
+    def setUpWidgets(self, ignore_request=False):
+        self.adapters = {}
+        self.widgets = form.setUpEditWidgets(
+            self.form_fields, self.prefix, self.context.publication, 
+            self.request, adapters=self.adapters, ignore_request=ignore_request
+            )
+
     def update(self):
         result = super(PackageEditForm, self).update()
         if result is None:
-            self.context.__parent__.update()
+            self.context.__parent__.update(self.context)

Modified: zf.zscp/trunk/src/zf/zscp/website/browser/repository.py
===================================================================
--- zf.zscp/trunk/src/zf/zscp/website/browser/repository.py	2006-04-10 16:59:09 UTC (rev 66797)
+++ zf.zscp/trunk/src/zf/zscp/website/browser/repository.py	2006-04-10 16:59:59 UTC (rev 66798)
@@ -48,9 +48,9 @@
         publication.name = data.get('name', u'')
         publication.packageName = data.get('packageName', u'')
         publication.summary = data.get('summary', u'')
-        publication.author = data.get('author', u'')
-        publication.authorEmail = data.get('authorEmail', u'')
-        publication.license = data.get('license', u'')
+        publication.author = data.get('author', [])
+        publication.authorEmail = data.get('authorEmail', [])
+        publication.license = data.get('license', [])
         publication.metadataVersion = data.get('metadataVersion', u'')
         package.publication = publication
         zope.event.notify(objectevent.ObjectCreatedEvent(package))



More information about the Checkins mailing list