comparison roundup/cgi/templating.py @ 2136:ee3cf6a44f29

queries on a per-user basis, and public queries [SF#891798] :) EditAction was confused about who "self" was Edit collision detection was broken for index-page edits
author Richard Jones <richard@users.sourceforge.net>
date Fri, 26 Mar 2004 04:50:51 +0000
parents 917826e3fb54
children 702f9a6afdcf
comparison
equal deleted inserted replaced
2135:89f42bddeaee 2136:ee3cf6a44f29
122 except os.error, error: 122 except os.error, error:
123 if error.errno != errno.ENOENT: 123 if error.errno != errno.ENOENT:
124 raise 124 raise
125 125
126 if self.templates.has_key(src) and \ 126 if self.templates.has_key(src) and \
127 stime < self.templates[src].mtime: 127 stime <= self.templates[src].mtime:
128 # compiled template is up to date 128 # compiled template is up to date
129 return self.templates[src] 129 return self.templates[src]
130 130
131 # compile the template 131 # compile the template
132 self.templates[src] = pt = RoundupPageTemplate() 132 self.templates[src] = pt = RoundupPageTemplate()
133 # use pt_edit so we can pass the content_type guess too 133 # use pt_edit so we can pass the content_type guess too
134 content_type = mimetypes.guess_type(filename)[0] or 'text/html' 134 content_type = mimetypes.guess_type(filename)[0] or 'text/html'
135 pt.pt_edit(open(src).read(), content_type) 135 pt.pt_edit(open(src).read(), content_type)
136 pt.id = filename 136 pt.id = filename
137 pt.mtime = time.time() 137 pt.mtime = stime
138 return pt 138 return pt
139 139
140 def __getitem__(self, name): 140 def __getitem__(self, name):
141 name, extension = os.path.splitext(name) 141 name, extension = os.path.splitext(name)
142 if extension: 142 if extension:
193 'db': HTMLDatabase(client), 193 'db': HTMLDatabase(client),
194 'config': client.instance.config, 194 'config': client.instance.config,
195 'tracker': client.instance, 195 'tracker': client.instance,
196 'utils': utils(client), 196 'utils': utils(client),
197 'templates': Templates(client.instance.config.TEMPLATES), 197 'templates': Templates(client.instance.config.TEMPLATES),
198 'template': self,
198 } 199 }
199 # add in the item if there is one 200 # add in the item if there is one
200 if client.nodeid: 201 if client.nodeid:
201 if classname == 'user': 202 if classname == 'user':
202 c['context'] = HTMLUser(client, classname, client.nodeid, 203 c['context'] = HTMLUser(client, classname, client.nodeid,
642 raise AttributeError, attr 643 raise AttributeError, attr
643 644
644 def designator(self): 645 def designator(self):
645 """Return this item's designator (classname + id).""" 646 """Return this item's designator (classname + id)."""
646 return '%s%s'%(self._classname, self._nodeid) 647 return '%s%s'%(self._classname, self._nodeid)
648
649 def is_retired(self):
650 """Is this item retired?"""
651 return self._klass.is_retired(self._nodeid)
647 652
648 def submit(self, label="Submit Changes"): 653 def submit(self, label="Submit Changes"):
649 """Generate a submit button. 654 """Generate a submit button.
650 655
651 Also sneak in the lastactivity and action hidden elements. 656 Also sneak in the lastactivity and action hidden elements.
1503 1508
1504 def __contains__(self, value): 1509 def __contains__(self, value):
1505 ''' Support the "in" operator. We have to make sure the passed-in 1510 ''' Support the "in" operator. We have to make sure the passed-in
1506 value is a string first, not a HTMLProperty. 1511 value is a string first, not a HTMLProperty.
1507 ''' 1512 '''
1513 print (self, value, self._value)
1508 return str(value) in self._value 1514 return str(value) in self._value
1509 1515
1510 def reverse(self): 1516 def reverse(self):
1511 ''' return the list in reverse order 1517 ''' return the list in reverse order
1512 ''' 1518 '''

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