diff roundup/cgi/templating.py @ 2244:ac4f295499a4

fixed journal marshalling in RDBMS backends [SF#943627] fixed handling of key values starting with numbers [SF#941363] fixed journal "param" column size in RDBMS backends
author Richard Jones <richard@users.sourceforge.net>
date Sun, 02 May 2004 23:16:05 +0000
parents a993c3dcac9b
children a13ec40cf8f5
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Sat May 01 08:19:00 2004 +0000
+++ b/roundup/cgi/templating.py	Sun May 02 23:16:05 2004 +0000
@@ -289,10 +289,11 @@
         for item in l:
             if item == 'user':
                 m.append(HTMLUserClass(self._client, item))
-            m.append(HTMLClass(self._client, item))
+            else:
+                m.append(HTMLClass(self._client, item))
         return m
 
-def lookupIds(db, prop, ids, fail_ok=0, num_re=re.compile('-?\d+')):
+def lookupIds(db, prop, ids, fail_ok=0, num_re=re.compile('^-?\d+$')):
     ''' "fail_ok" should be specified if we wish to pass through bad values
         (most likely form values that we wish to represent back to the user)
     '''
@@ -310,7 +311,7 @@
                     l.append(entry)
     return l
 
-def lookupKeys(linkcl, key, ids, num_re=re.compile('-?\d+')):
+def lookupKeys(linkcl, key, ids, num_re=re.compile('^-?\d+$')):
     ''' Look up the "key" values for "ids" list - though some may already
     be key values, not ids.
     '''
@@ -449,7 +450,7 @@
         ''' Return this class' designator (classname) '''
         return self._classname
 
-    def getItem(self, itemid, num_re=re.compile('-?\d+')):
+    def getItem(self, itemid, num_re=re.compile('^-?\d+$')):
         ''' Get an item of this class by its item id.
         '''
         # make sure we're looking at an itemid
@@ -680,7 +681,7 @@
         # XXX do this
         return []
 
-    def history(self, direction='descending', dre=re.compile('\d+')):
+    def history(self, direction='descending', dre=re.compile('^\d+$')):
         self.view_check()
 
         l = ['<table class="history">'
@@ -1523,6 +1524,8 @@
     def __init__(self, *args, **kwargs):
         HTMLProperty.__init__(self, *args, **kwargs)
         if self._value:
+            self._value = lookupIds(self._db, self._prop, self._value,
+                fail_ok=1)
             sortfun = make_sort_function(self._db, self._prop.classname)
             self._value.sort(sortfun)
     

Roundup Issue Tracker: http://roundup-tracker.org/