[Zope3-checkins] CVS: zopeproducts/bugtracker - version.txt:1.1 __init__.py:1.2 bug.py:1.3 configure.zcml:1.8 interfaces.py:1.3 vocabulary.py:1.4

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Aug 12 15:55:43 EDT 2003


Update of /cvs-repository/zopeproducts/bugtracker
In directory cvs.zope.org:/tmp/cvs-serv11962

Modified Files:
	__init__.py bug.py configure.zcml interfaces.py vocabulary.py 
Added Files:
	version.txt 
Log Message:
- Fixed bug that would not allow Web-based users to create and view bugs.

- Internationalized the Bug Tracker Product.

- Localized the Bug Tracker to German.


=== Added File zopeproducts/bugtracker/version.txt ===
Zope 3 Bug Tracker 0.2


=== zopeproducts/bugtracker/__init__.py 1.1 => 1.2 ===
--- zopeproducts/bugtracker/__init__.py:1.1	Thu Jul 24 14:08:03 2003
+++ zopeproducts/bugtracker/__init__.py	Tue Aug 12 14:55:07 2003
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Package initialization
+
+$Id$
+"""
+from zope.i18n import MessageIDFactory
+TrackerMessageID = MessageIDFactory('bugtracker')


=== zopeproducts/bugtracker/bug.py 1.2 => 1.3 ===
--- zopeproducts/bugtracker/bug.py:1.2	Mon Jul 28 13:13:41 2003
+++ zopeproducts/bugtracker/bug.py	Tue Aug 12 14:55:07 2003
@@ -29,6 +29,7 @@
 from zopeproducts.bugtracker.interfaces import IBugDependencies
 from zopeproducts.bugtracker.vocabulary import \
      VocabularyPropertyGetter, VocabularyPropertySetter
+from zopeproducts.bugtracker import TrackerMessageID as _
 
 DependencyKey = 'http://www.zope.org/bugtracker#1.0/Dependencies'
 
@@ -39,24 +40,24 @@
 
     # See zopeproducts.bugtracker.interfaces.IBug
     status = ContextProperty(
-        VocabularyPropertyGetter('_status', 'Stati'),
-        VocabularyPropertySetter('_status', 'Stati'))
+        VocabularyPropertyGetter('_status', _('Stati')),
+        VocabularyPropertySetter('_status', _('Stati')))
 
 
     # See zopeproducts.bugtracker.interfaces.IBug
     priority = ContextProperty(
-        VocabularyPropertyGetter('_priority', 'Priorities'),
-        VocabularyPropertySetter('_priority', 'Priorities'))
+        VocabularyPropertyGetter('_priority', _('Priorities')),
+        VocabularyPropertySetter('_priority', _('Priorities')))
 
     # See zopeproducts.bugtracker.interfaces.IBug
     type = ContextProperty(
-        VocabularyPropertyGetter('_type', 'BugTypes'),
-        VocabularyPropertySetter('_type', 'BugTypes'))
+        VocabularyPropertyGetter('_type', _('BugTypes')),
+        VocabularyPropertySetter('_type', _('BugTypes')))
 
     # See zopeproducts.bugtracker.interfaces.IBug
     release = ContextProperty(
-        VocabularyPropertyGetter('_release', 'Releases'),
-        VocabularyPropertySetter('_release', 'Releases'))
+        VocabularyPropertyGetter('_release', _('Releases')),
+        VocabularyPropertySetter('_release', _('Releases')))
 
     def getOwners(self):
         return getattr(self, '_owners', [])


=== zopeproducts/bugtracker/configure.zcml 1.7 => 1.8 ===
--- zopeproducts/bugtracker/configure.zcml:1.7	Sun Aug  3 14:33:57 2003
+++ zopeproducts/bugtracker/configure.zcml	Tue Aug 12 14:55:07 2003
@@ -3,7 +3,7 @@
    xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"
    xmlns:event="http://namespaces.zope.org/event"
    xmlns:mail="http://namespaces.zope.org/mail"
-   xmlns:translate="http://namespaces.zope.org/gts"
+   xmlns:translation="http://namespaces.zope.org/gts"
    i18n_domain="bugtracker"
    >
 
@@ -149,9 +149,7 @@
   <content class=".vocabulary.UserTerm">
     <allow
         interface="zope.schema.interfaces.ITokenizedTerm"/>
-    <require
-        permission="bugtracker.ViewBug"
-        attributes="principal title"/>
+    <allow attributes="principal title"/>
   </content>
 
   <!-- Bug Tracker related configuration -->
@@ -294,25 +292,37 @@
       name="methods"
       for=".interfaces.IBugTracker"
       permission="bugtracker.ViewBug" 
-      allowed_methods="getBugNames addBug deleteBug"
-      factory=".xmlrpc.BugTrackerMethods" />
+      allowed_attributes="getBugNames addBug deleteBug"
+      class=".xmlrpc.BugTrackerMethods" />
+
+  <xmlrpc:defaultView
+      name="methods"
+      for=".interfaces.IBugTracker" />
 
   <xmlrpc:view
       name="methods"
       for=".interfaces.IBug"
       permission="bugtracker.ViewBug" 
-      allowed_methods="getProperties setProperties 
+      allowed_attributes="getProperties setProperties 
                        getCommentNames addComment deleteComment
                        getAttachmentNames addAttachment deleteAttachment
                        "
-      factory=".xmlrpc.BugMethods" />
+      class=".xmlrpc.BugMethods" />
+
+  <xmlrpc:defaultView
+      name="methods"
+      for=".interfaces.IBug" />
 
   <xmlrpc:view
       name="methods"
       for=".interfaces.IComment"
       permission="bugtracker.ViewBug" 
-      allowed_methods="getBody setBody"
-      factory=".xmlrpc.CommentMethods" />
+      allowed_attributes="getBody setBody"
+      class=".xmlrpc.CommentMethods" />
+
+  <xmlrpc:defaultView
+      name="methods"
+      for=".interfaces.IComment" />
 
 
   <!-- Register Mailer and Mail Service -->
@@ -320,7 +330,7 @@
   <mail:smtpMailer id="bugs-smtp" hostname="localhost" port="25" />
 
   <mail:queuedService permission="zope.SendMail"
-                      queuePath="./src/zopeproducts/bugtracker/mail-queue"
+                      queuePath="./mail-queue"
                       mailer="bugs-smtp" />
 
   <!-- Register event listener for change mails -->
@@ -334,5 +344,8 @@
 
   <!-- Register various browser related components, including all views -->
   <include package=".browser" />
+
+  <!-- Translations -->
+  <translation:registerTranslations directory="locales" />
 
 </configure>


=== zopeproducts/bugtracker/interfaces.py 1.2 => 1.3 ===
--- zopeproducts/bugtracker/interfaces.py:1.2	Mon Jul 28 13:13:41 2003
+++ zopeproducts/bugtracker/interfaces.py	Tue Aug 12 14:55:07 2003
@@ -17,16 +17,12 @@
 
 $Id$
 """
+from zope.app.interfaces.container import IContainer
 from zope.interface import Interface
 from zope.schema import Text, TextLine, List, Dict
-from zope.schema.vocabulary import VocabularyField, VocabularyListField
-
 from zope.schema.interfaces import IVocabulary, IVocabularyTokenized
-from zope.app.interfaces.container import IContainer
-
-
-from zope.i18n import MessageIDFactory
-_ = MessageIDFactory('bugtracker')
+from zope.schema.vocabulary import VocabularyField, VocabularyListField
+from zopeproducts.bugtracker import TrackerMessageID as _
 
 class IBugTracker(IContainer):
     """A Bug Tracker object represents a collection of bugs for a particular


=== zopeproducts/bugtracker/vocabulary.py 1.3 => 1.4 ===
--- zopeproducts/bugtracker/vocabulary.py:1.3	Mon Jul 28 13:13:41 2003
+++ zopeproducts/bugtracker/vocabulary.py	Tue Aug 12 14:55:07 2003
@@ -28,11 +28,13 @@
      ITokenizedTerm, IVocabulary, IVocabularyTokenized
 from zope.schema.vocabulary import getVocabularyRegistry
 from zope.security.proxy import trustedRemoveSecurityProxy 
-from zopeproducts.bugtracker.interfaces import IManagableVocabulary, IBugTracker
+from zopeproducts.bugtracker.interfaces import \
+     IManagableVocabulary, IBugTracker
 from zopeproducts.bugtracker.interfaces import \
      IStatusVocabulary, IReleaseVocabulary, IPriorityVocabulary 
 from zopeproducts.bugtracker.interfaces import \
      IBugTypeVocabulary
+from zopeproducts.bugtracker import TrackerMessageID as _
 
 class SimpleTerm(Persistent):
 
@@ -89,7 +91,9 @@
 
     def delete(self, value):
         if value == self.default.value:
-            raise ValueError, "Cannot delete default value '%s'." %value
+            error_msg = _("Cannot delete default value '${value}'.")
+            error_msg.mapping = {'value': value}
+            raise ValueError, error_msg
         del self.annotations[self.key][value]
 
     def _getRealContext(self, context):
@@ -105,12 +109,15 @@
         return self.getTerm(self.annotations[self.key+'/default'])
 
     def setDefault(self, value):
-        """Set the default value/term. Both, a token and a term are accepted."""
+        """Set the default value/term. Both, a token and a term are
+        accepted."""
         if ITokenizedTerm.isImplementedBy(value):
             value = value.value
         if value not in self:
-            raise ValueError, \
-                  "The value '%s' was not found in the vocabulary" %value
+            error_msg = _("The value '${value}' was not found in the "
+                          "vocabulary")
+            error_msg.mapping = {'value': value}
+            raise ValueError, error_msg
         self.annotations[self.key+'/default'] = value
 
     default = property(getDefault, setDefault)
@@ -123,7 +130,7 @@
     key = 'http://www.zope.org/bugtracker#1.0/status/values'
     interface = IBugTracker
 
-    title = 'Status Definitions'
+    title = _('Status Definitions')
 
 
 class ReleaseVocabulary(ManagableVocabulary):
@@ -133,7 +140,7 @@
     key = 'http://www.zope.org/bugtracker#1.0/release/values'
     interface = IBugTracker
 
-    title = 'Release Definitions'
+    title = _('Release Definitions')
 
 
 class PriorityVocabulary(ManagableVocabulary):
@@ -143,7 +150,7 @@
     key = 'http://www.zope.org/bugtracker#1.0/priority/values'
     interface = IBugTracker
 
-    title = 'Priority Definitions'
+    title = _('Priority Definitions')
 
 
 class BugTypeVocabulary(ManagableVocabulary):
@@ -153,7 +160,7 @@
     key = 'http://www.zope.org/bugtracker#1.0/bugtype/values'
     interface = IBugTracker
 
-    title = 'Bug Type Definitions'
+    title = _('Bug Type Definitions')
 
 
 class UserTerm(Persistent):
@@ -169,7 +176,7 @@
                           'description': naked.getDescription()}
         self.value = naked.getId()
         self.token = naked.getId()
-        self.title = naked.getTitle()        
+        self.title = naked.getTitle()
 
 
 class UserVocabulary(object):
@@ -177,7 +184,7 @@
     implements(IVocabulary, IVocabularyTokenized)
 
     def __init__(self, context):
-        self.auth = getService(context, 'Authentication')
+        self.auth = getService(context, _('Authentication'))
     
     def __contains__(self, value):
         ids = map(lambda p: p.getId(), self.auth.getPrincipals(''))
@@ -241,7 +248,8 @@
             # verification.
             vocab = None
 
-        setattr(instance, self.name, value)
+        # Make sure the value is a message id
+        setattr(instance, self.name, _(value))
 
 
 # Monkey Patching going on...




More information about the Zope3-Checkins mailing list