comparison roundup/cgi/templating.py @ 1103:db787cef1385

handled some XXXs
author Richard Jones <richard@users.sourceforge.net>
date Tue, 10 Sep 2002 12:44:42 +0000
parents 7362dc1f0226
children d759c3cb1f06
comparison
equal deleted inserted replaced
1102:d94bd5369456 1103:db787cef1385
220 return '<HTMLClass(0x%x) %s>'%(id(self), self.classname) 220 return '<HTMLClass(0x%x) %s>'%(id(self), self.classname)
221 221
222 def __getitem__(self, item): 222 def __getitem__(self, item):
223 ''' return an HTMLProperty instance 223 ''' return an HTMLProperty instance
224 ''' 224 '''
225 #print 'getitem', (self, item) 225 #print 'HTMLClass.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 230
376 self._nodeid) 376 self._nodeid)
377 377
378 def __getitem__(self, item): 378 def __getitem__(self, item):
379 ''' return an HTMLProperty instance 379 ''' return an HTMLProperty instance
380 ''' 380 '''
381 #print 'getitem', (self, item) 381 #print 'HTMLItem.getitem', (self, item)
382 if item == 'id': 382 if item == 'id':
383 return self._nodeid 383 return self._nodeid
384 384
385 # get the property 385 # get the property
386 prop = self._props[item] 386 prop = self._props[item]
409 ''' Generate a submit button (and action hidden element) 409 ''' Generate a submit button (and action hidden element)
410 ''' 410 '''
411 return ' <input type="hidden" name=":action" value="edit">\n'\ 411 return ' <input type="hidden" name=":action" value="edit">\n'\
412 ' <input type="submit" name="submit" value="%s">'%label 412 ' <input type="submit" name="submit" value="%s">'%label
413 413
414 # XXX this probably should just return the history items, not the HTML 414 def journal(self, direction='descending'):
415 ''' Return a list of HTMLJournalEntry instances.
416 '''
417 # XXX do this
418 return []
419
415 def history(self, direction='descending'): 420 def history(self, direction='descending'):
416 l = ['<table class="history">' 421 l = ['<table class="history">'
417 '<tr><th colspan="4" class="header">', 422 '<tr><th colspan="4" class="header">',
418 _('History'), 423 _('History'),
419 '</th></tr><tr>', 424 '</th></tr><tr>',
751 entry identified by the assignedto property on item, and then the 756 entry identified by the assignedto property on item, and then the
752 name property of that user) 757 name property of that user)
753 ''' 758 '''
754 def __getattr__(self, attr): 759 def __getattr__(self, attr):
755 ''' return a new HTMLItem ''' 760 ''' return a new HTMLItem '''
756 #print 'getattr', (self, attr, self._value) 761 #print 'Link.getattr', (self, attr, self._value)
757 if not self._value: 762 if not self._value:
758 raise AttributeError, "Can't access missing value" 763 raise AttributeError, "Can't access missing value"
759 if self._prop.classname == 'user': 764 if self._prop.classname == 'user':
765 klass = HTMLUser
766 else:
760 klass = HTMLItem 767 klass = HTMLItem
761 else:
762 klass = HTMLUser
763 i = klass(self._client, self._prop.classname, self._value) 768 i = klass(self._client, self._prop.classname, self._value)
764 return getattr(i, attr) 769 return getattr(i, attr)
765 770
766 def plain(self, escape=0): 771 def plain(self, escape=0):
767 if self._value is None: 772 if self._value is None:
863 raise AttributeError, attr 868 raise AttributeError, attr
864 869
865 def __getitem__(self, num): 870 def __getitem__(self, num):
866 ''' iterate and return a new HTMLItem 871 ''' iterate and return a new HTMLItem
867 ''' 872 '''
868 #print 'getitem', (self, num) 873 #print 'Multi.getitem', (self, num)
869 value = self._value[num] 874 value = self._value[num]
870 if self._prop.classname == 'user': 875 if self._prop.classname == 'user':
871 klass = HTMLUser 876 klass = HTMLUser
872 else: 877 else:
873 klass = HTMLItem 878 klass = HTMLItem
874 return klass(self._client, self._prop.classname, value) 879 return klass(self._client, self._prop.classname, value)
880
881 def __contains__(self, value):
882 ''' Support the "in" operator
883 '''
884 return value in self._value
875 885
876 def reverse(self): 886 def reverse(self):
877 ''' return the list in reverse order 887 ''' return the list in reverse order
878 ''' 888 '''
879 l = self._value[:] 889 l = self._value[:]

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