comparison roundup/cgi/templating.py @ 1099:7362dc1f0226

Made "creator" property a String like it should be (we can't lookup() retired users reliably)
author Richard Jones <richard@users.sourceforge.net>
date Tue, 10 Sep 2002 08:04:57 +0000
parents 98f3d41f41d9
children db787cef1385
comparison
equal deleted inserted replaced
1098:c5819344714c 1099:7362dc1f0226
225 #print 'getitem', (self, item) 225 #print 'getitem', (self, item)
226 226
227 # we don't exist 227 # we don't exist
228 if item == 'id': 228 if item == 'id':
229 return None 229 return None
230 if item == 'creator':
231 # but we will be created by this user...
232 return HTMLUser(self._client, 'user', self._client.userid)
233 230
234 # get the property 231 # get the property
235 prop = self._props[item] 232 prop = self._props[item]
236 233
237 # look up the correct HTMLProperty class 234 # look up the correct HTMLProperty class
766 i = klass(self._client, self._prop.classname, self._value) 763 i = klass(self._client, self._prop.classname, self._value)
767 return getattr(i, attr) 764 return getattr(i, attr)
768 765
769 def plain(self, escape=0): 766 def plain(self, escape=0):
770 if self._value is None: 767 if self._value is None:
771 return _('[unselected]') 768 return ''
772 linkcl = self._db.classes[self._prop.classname] 769 linkcl = self._db.classes[self._prop.classname]
773 k = linkcl.labelprop(1) 770 k = linkcl.labelprop(1)
774 value = str(linkcl.get(self._value, k)) 771 value = str(linkcl.get(self._value, k))
775 if escape: 772 if escape:
776 value = cgi.escape(value) 773 value = cgi.escape(value)
804 lab = lab[:size-3] + '...' 801 lab = lab[:size-3] + '...'
805 lab = cgi.escape(lab) 802 lab = cgi.escape(lab)
806 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab)) 803 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
807 l.append('</select>') 804 l.append('</select>')
808 return '\n'.join(l) 805 return '\n'.join(l)
809
810 def download(self, showid=0):
811 linkname = self._prop.classname
812 linkcl = self._db.getclass(linkname)
813 k = linkcl.labelprop(1)
814 linkvalue = cgi.escape(str(linkcl.get(self._value, k)))
815 if showid:
816 label = value
817 title = ' title="%s"'%linkvalue
818 # note ... this should be urllib.quote(linkcl.get(value, k))
819 else:
820 label = linkvalue
821 title = ''
822 return '<a href="%s%s/%s"%s>%s</a>'%(linkname, self._value,
823 linkvalue, title, label)
824 806
825 def menu(self, size=None, height=None, showid=0, additional=[], 807 def menu(self, size=None, height=None, showid=0, additional=[],
826 **conditions): 808 **conditions):
827 value = self._value 809 value = self._value
828 810
862 lab = lab + ' (%s)'%', '.join(map(str, m)) 844 lab = lab + ' (%s)'%', '.join(map(str, m))
863 lab = cgi.escape(lab) 845 lab = cgi.escape(lab)
864 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab)) 846 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
865 l.append('</select>') 847 l.append('</select>')
866 return '\n'.join(l) 848 return '\n'.join(l)
867
868 # def checklist(self, ...) 849 # def checklist(self, ...)
869 850
870 class MultilinkHTMLProperty(HTMLProperty): 851 class MultilinkHTMLProperty(HTMLProperty):
871 ''' Multilink HTMLProperty 852 ''' Multilink HTMLProperty
872 853

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