[Zope3-checkins] CVS: zopeproducts/bugtracker - exportimport.py:1.6 tracker.py:1.7

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 29 19:59:55 EDT 2003


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

Modified Files:
	exportimport.py tracker.py 
Log Message:
Redid forcing of bug name. This is required so that XML imports work 
correctly. I can;t wait for container geddon (the new one) to be done, then
this can be solved much more smoothly.


=== zopeproducts/bugtracker/exportimport.py 1.5 => 1.6 ===
--- zopeproducts/bugtracker/exportimport.py:1.5	Fri Aug 29 17:11:29 2003
+++ zopeproducts/bugtracker/exportimport.py	Fri Aug 29 18:59:52 2003
@@ -264,7 +264,7 @@
         self.bug_name = attrs.get('id')
 
     def endBug(self):
-        self.context.setObject(self.bug_name, self.bug)
+        self.context.setObject('bug'+self.bug_name, self.bug)
         
     def startDescription(self, attrs):
         self.chars = u''


=== zopeproducts/bugtracker/tracker.py 1.6 => 1.7 ===
--- zopeproducts/bugtracker/tracker.py:1.6	Mon Jul 28 13:13:41 2003
+++ zopeproducts/bugtracker/tracker.py	Fri Aug 29 18:59:52 2003
@@ -85,17 +85,17 @@
         name = int(name)
         return self.data.has_key(name)
 
-    def setObject(self, name, object, forceName=False):
+    def setObject(self, name, object):
         """Add the given object to the folder under the given name."""
         # It is sometimes necessary to force in a name, since bugs might refer
         # to each other. This is particualry important when importing XML
         # data.
-        if forceName == False:
-            name = max(list(self.data.keys())+[0])+1
-        else:
-            name = int(name)
+        if isinstance(name, (str, unicode)) and name.startswith('bug'):
+            name = int(name[3:])
             if name in self:
                 raise ValueError, 'Name (%i) already in Bug Tracker.' %name 
+        else:
+            name = max(list(self.data.keys())+[0])+1
         self.data[name] = object
         # Too much code depends on this being a string type
         return unicode(name)




More information about the Zope3-Checkins mailing list