Code

. roundupdb catches retrieving none existing files.
[roundup.git] / roundup / htmltemplate.py
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17
18 # $Id: htmltemplate.py,v 1.77 2002-02-20 05:05:29 richard Exp $
20 __doc__ = """
21 Template engine.
22 """
24 import os, re, StringIO, urllib, cgi, errno, types
26 import hyperdb, date, password
27 from i18n import _
29 # This imports the StructureText functionality for the do_stext function
30 # get it from http://dev.zope.org/Members/jim/StructuredTextWiki/NGReleases
31 try:
32     from StructuredText.StructuredText import HTML as StructuredText
33 except ImportError:
34     StructuredText = None
36 class MissingTemplateError(ValueError):
37     pass
39 class TemplateFunctions:
40     def __init__(self):
41         self.form = None
42         self.nodeid = None
43         self.filterspec = None
44         self.globals = {}
45         for key in TemplateFunctions.__dict__.keys():
46             if key[:3] == 'do_':
47                 self.globals[key[3:]] = getattr(self, key)
49     def do_plain(self, property, escape=0):
50         ''' display a String property directly;
52             display a Date property in a specified time zone with an option to
53             omit the time from the date stamp;
55             for a Link or Multilink property, display the key strings of the
56             linked nodes (or the ids if the linked class has no key property)
57         '''
58         if not self.nodeid and self.form is None:
59             return _('[Field: not called from item]')
60         propclass = self.properties[property]
61         if self.nodeid:
62             # make sure the property is a valid one
63             # TODO: this tests, but we should handle the exception
64             prop_test = self.cl.getprops()[property]
66             # get the value for this property
67             try:
68                 value = self.cl.get(self.nodeid, property)
69             except KeyError:
70                 # a KeyError here means that the node doesn't have a value
71                 # for the specified property
72                 if isinstance(propclass, hyperdb.Multilink): value = []
73                 else: value = ''
74         else:
75             # TODO: pull the value from the form
76             if isinstance(propclass, hyperdb.Multilink): value = []
77             else: value = ''
78         if isinstance(propclass, hyperdb.String):
79             if value is None: value = ''
80             else: value = str(value)
81         elif isinstance(propclass, hyperdb.Password):
82             if value is None: value = ''
83             else: value = _('*encrypted*')
84         elif isinstance(propclass, hyperdb.Date):
85             # this gives "2002-01-17.06:54:39", maybe replace the "." by a " ".
86             value = str(value)
87         elif isinstance(propclass, hyperdb.Interval):
88             value = str(value)
89         elif isinstance(propclass, hyperdb.Link):
90             linkcl = self.db.classes[propclass.classname]
91             k = linkcl.labelprop()
92             if value:
93                 value = linkcl.get(value, k)
94             else:
95                 value = _('[unselected]')
96         elif isinstance(propclass, hyperdb.Multilink):
97             linkcl = self.db.classes[propclass.classname]
98             k = linkcl.labelprop()
99             value = ', '.join(value)
100         else:
101             s = _('Plain: bad propclass "%(propclass)s"')%locals()
102         if escape:
103             value = cgi.escape(value)
104         return value
106     def do_stext(self, property, escape=0):
107         '''Render as structured text using the StructuredText module
108            (see above for details)
109         '''
110         s = self.do_plain(property, escape=escape)
111         if not StructuredText:
112             return s
113         return StructuredText(s,level=1,header=0)
115     def determine_value(self, property):
116         '''determine the value of a property using the node, form or
117            filterspec
118         '''
119         propclass = self.properties[property]
120         if self.nodeid:
121             value = self.cl.get(self.nodeid, property, None)
122             if isinstance(propclass, hyperdb.Multilink) and value is None:
123                 return []
124             return value
125         elif self.filterspec is not None:
126             if isinstance(propclass, hyperdb.Multilink):
127                 return self.filterspec.get(property, [])
128             else:
129                 return self.filterspec.get(property, '')
130         # TODO: pull the value from the form
131         if isinstance(propclass, hyperdb.Multilink):
132             return []
133         else:
134             return ''
136     def make_sort_function(self, classname):
137         '''Make a sort function for a given class
138         '''
139         linkcl = self.db.classes[classname]
140         if linkcl.getprops().has_key('order'):
141             sort_on = 'order'
142         else:
143             sort_on = linkcl.labelprop()
144         def sortfunc(a, b, linkcl=linkcl, sort_on=sort_on):
145             return cmp(linkcl.get(a, sort_on), linkcl.get(b, sort_on))
146         return sortfunc
148     def do_field(self, property, size=None, showid=0):
149         ''' display a property like the plain displayer, but in a text field
150             to be edited
152             Note: if you would prefer an option list style display for
153             link or multilink editing, use menu().
154         '''
155         if not self.nodeid and self.form is None and self.filterspec is None:
156             return _('[Field: not called from item]')
158         if size is None:
159             size = 30
161         propclass = self.properties[property]
163         # get the value
164         value = self.determine_value(property)
166         # now display
167         if (isinstance(propclass, hyperdb.String) or
168                 isinstance(propclass, hyperdb.Date) or
169                 isinstance(propclass, hyperdb.Interval)):
170             if value is None:
171                 value = ''
172             else:
173                 value = cgi.escape(str(value))
174                 value = '"'.join(value.split('"'))
175             s = '<input name="%s" value="%s" size="%s">'%(property, value, size)
176         elif isinstance(propclass, hyperdb.Password):
177             s = '<input type="password" name="%s" size="%s">'%(property, size)
178         elif isinstance(propclass, hyperdb.Link):
179             sortfunc = self.make_sort_function(propclass.classname)
180             linkcl = self.db.classes[propclass.classname]
181             options = linkcl.list()
182             options.sort(sortfunc)
183             # TODO: make this a field display, not a menu one!
184             l = ['<select name="%s">'%property]
185             k = linkcl.labelprop()
186             if value is None:
187                 s = 'selected '
188             else:
189                 s = ''
190             l.append(_('<option %svalue="-1">- no selection -</option>')%s)
191             for optionid in options:
192                 option = linkcl.get(optionid, k)
193                 s = ''
194                 if optionid == value:
195                     s = 'selected '
196                 if showid:
197                     lab = '%s%s: %s'%(propclass.classname, optionid, option)
198                 else:
199                     lab = option
200                 if size is not None and len(lab) > size:
201                     lab = lab[:size-3] + '...'
202                 lab = cgi.escape(lab)
203                 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
204             l.append('</select>')
205             s = '\n'.join(l)
206         elif isinstance(propclass, hyperdb.Multilink):
207             sortfunc = self.make_sort_function(propclass.classname)
208             linkcl = self.db.classes[propclass.classname]
209             list = linkcl.list()
210             list.sort(sortfunc)
211             l = []
212             # map the id to the label property
213             if not showid:
214                 k = linkcl.labelprop()
215                 value = [linkcl.get(v, k) for v in value]
216             value = cgi.escape(','.join(value))
217             s = '<input name="%s" size="%s" value="%s">'%(property, size, value)
218         else:
219             s = _('Plain: bad propclass "%(propclass)s"')%locals()
220         return s
222     def do_multiline(self, property, rows=5, cols=40):
223         ''' display a string property in a multiline text edit field
224         '''
225         if not self.nodeid and self.form is None and self.filterspec is None:
226             return _('[Multiline: not called from item]')
228         propclass = self.properties[property]
230         # make sure this is a link property
231         if not isinstance(propclass, hyperdb.String):
232             return _('[Multiline: not a string]')
234         # get the value
235         value = self.determine_value(property)
236         if value is None:
237             value = ''
239         # display
240         return '<textarea name="%s" rows="%s" cols="%s">%s</textarea>'%(
241             property, rows, cols, value)
243     def do_menu(self, property, size=None, height=None, showid=0):
244         ''' for a Link property, display a menu of the available choices
245         '''
246         if not self.nodeid and self.form is None and self.filterspec is None:
247             return _('[Field: not called from item]')
249         propclass = self.properties[property]
251         # make sure this is a link property
252         if not (isinstance(propclass, hyperdb.Link) or
253                 isinstance(propclass, hyperdb.Multilink)):
254             return _('[Menu: not a link]')
256         # sort function
257         sortfunc = self.make_sort_function(propclass.classname)
259         # get the value
260         value = self.determine_value(property)
262         # display
263         if isinstance(propclass, hyperdb.Multilink):
264             linkcl = self.db.classes[propclass.classname]
265             options = linkcl.list()
266             options.sort(sortfunc)
267             height = height or min(len(options), 7)
268             l = ['<select multiple name="%s" size="%s">'%(property, height)]
269             k = linkcl.labelprop()
270             for optionid in options:
271                 option = linkcl.get(optionid, k)
272                 s = ''
273                 if optionid in value:
274                     s = 'selected '
275                 if showid:
276                     lab = '%s%s: %s'%(propclass.classname, optionid, option)
277                 else:
278                     lab = option
279                 if size is not None and len(lab) > size:
280                     lab = lab[:size-3] + '...'
281                 lab = cgi.escape(lab)
282                 l.append('<option %svalue="%s">%s</option>'%(s, optionid,
283                     lab))
284             l.append('</select>')
285             return '\n'.join(l)
286         if isinstance(propclass, hyperdb.Link):
287             # force the value to be a single choice
288             if type(value) is types.ListType:
289                 value = value[0]
290             linkcl = self.db.classes[propclass.classname]
291             l = ['<select name="%s">'%property]
292             k = linkcl.labelprop()
293             s = ''
294             if value is None:
295                 s = 'selected '
296             l.append(_('<option %svalue="-1">- no selection -</option>')%s)
297             options = linkcl.list()
298             options.sort(sortfunc)
299             for optionid in options:
300                 option = linkcl.get(optionid, k)
301                 s = ''
302                 if optionid == value:
303                     s = 'selected '
304                 if showid:
305                     lab = '%s%s: %s'%(propclass.classname, optionid, option)
306                 else:
307                     lab = option
308                 if size is not None and len(lab) > size:
309                     lab = lab[:size-3] + '...'
310                 lab = cgi.escape(lab)
311                 l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
312             l.append('</select>')
313             return '\n'.join(l)
314         return _('[Menu: not a link]')
316     #XXX deviates from spec
317     def do_link(self, property=None, is_download=0):
318         '''For a Link or Multilink property, display the names of the linked
319            nodes, hyperlinked to the item views on those nodes.
320            For other properties, link to this node with the property as the
321            text.
323            If is_download is true, append the property value to the generated
324            URL so that the link may be used as a download link and the
325            downloaded file name is correct.
326         '''
327         if not self.nodeid and self.form is None:
328             return _('[Link: not called from item]')
330         # get the value
331         value = self.determine_value(property)
332         if not value:
333             return _('[no %(propname)s]')%{'propname':property.capitalize()}
335         propclass = self.properties[property]
336         if isinstance(propclass, hyperdb.Link):
337             linkname = propclass.classname
338             linkcl = self.db.classes[linkname]
339             k = linkcl.labelprop()
340             linkvalue = cgi.escape(linkcl.get(value, k))
341             if is_download:
342                 return '<a href="%s%s/%s">%s</a>'%(linkname, value,
343                     linkvalue, linkvalue)
344             else:
345                 return '<a href="%s%s">%s</a>'%(linkname, value, linkvalue)
346         if isinstance(propclass, hyperdb.Multilink):
347             linkname = propclass.classname
348             linkcl = self.db.classes[linkname]
349             k = linkcl.labelprop()
350             l = []
351             for value in value:
352                 linkvalue = cgi.escape(linkcl.get(value, k))
353                 if is_download:
354                     l.append('<a href="%s%s/%s">%s</a>'%(linkname, value,
355                         linkvalue, linkvalue))
356                 else:
357                     l.append('<a href="%s%s">%s</a>'%(linkname, value,
358                         linkvalue))
359             return ', '.join(l)
360         if is_download:
361             return '<a href="%s%s/%s">%s</a>'%(self.classname, self.nodeid,
362                 value, value)
363         else:
364             return '<a href="%s%s">%s</a>'%(self.classname, self.nodeid, value)
366     def do_count(self, property, **args):
367         ''' for a Multilink property, display a count of the number of links in
368             the list
369         '''
370         if not self.nodeid:
371             return _('[Count: not called from item]')
373         propclass = self.properties[property]
374         if not isinstance(propclass, hyperdb.Multilink):
375             return _('[Count: not a Multilink]')
377         # figure the length then...
378         value = self.cl.get(self.nodeid, property)
379         return str(len(value))
381     # XXX pretty is definitely new ;)
382     def do_reldate(self, property, pretty=0):
383         ''' display a Date property in terms of an interval relative to the
384             current date (e.g. "+ 3w", "- 2d").
386             with the 'pretty' flag, make it pretty
387         '''
388         if not self.nodeid and self.form is None:
389             return _('[Reldate: not called from item]')
391         propclass = self.properties[property]
392         if not isinstance(propclass, hyperdb.Date):
393             return _('[Reldate: not a Date]')
395         if self.nodeid:
396             value = self.cl.get(self.nodeid, property)
397         else:
398             return ''
399         if not value:
400             return ''
402         # figure the interval
403         interval = value - date.Date('.')
404         if pretty:
405             if not self.nodeid:
406                 return _('now')
407             pretty = interval.pretty()
408             if pretty is None:
409                 pretty = value.pretty()
410             return pretty
411         return str(interval)
413     def do_download(self, property, **args):
414         ''' show a Link("file") or Multilink("file") property using links that
415             allow you to download files
416         '''
417         if not self.nodeid:
418             return _('[Download: not called from item]')
419         return self.do_link(property, is_download=1)
422     def do_checklist(self, property, **args):
423         ''' for a Link or Multilink property, display checkboxes for the
424             available choices to permit filtering
425         '''
426         propclass = self.properties[property]
427         if (not isinstance(propclass, hyperdb.Link) and not
428                 isinstance(propclass, hyperdb.Multilink)):
429             return _('[Checklist: not a link]')
431         # get our current checkbox state
432         if self.nodeid:
433             # get the info from the node - make sure it's a list
434             if isinstance(propclass, hyperdb.Link):
435                 value = [self.cl.get(self.nodeid, property)]
436             else:
437                 value = self.cl.get(self.nodeid, property)
438         elif self.filterspec is not None:
439             # get the state from the filter specification (always a list)
440             value = self.filterspec.get(property, [])
441         else:
442             # it's a new node, so there's no state
443             value = []
445         # so we can map to the linked node's "lable" property
446         linkcl = self.db.classes[propclass.classname]
447         l = []
448         k = linkcl.labelprop()
449         for optionid in linkcl.list():
450             option = cgi.escape(linkcl.get(optionid, k))
451             if optionid in value or option in value:
452                 checked = 'checked'
453             else:
454                 checked = ''
455             l.append('%s:<input type="checkbox" %s name="%s" value="%s">'%(
456                 option, checked, property, option))
458         # for Links, allow the "unselected" option too
459         if isinstance(propclass, hyperdb.Link):
460             if value is None or '-1' in value:
461                 checked = 'checked'
462             else:
463                 checked = ''
464             l.append(_('[unselected]:<input type="checkbox" %s name="%s" '
465                 'value="-1">')%(checked, property))
466         return '\n'.join(l)
468     def do_note(self, rows=5, cols=80):
469         ''' display a "note" field, which is a text area for entering a note to
470             go along with a change. 
471         '''
472         # TODO: pull the value from the form
473         return '<textarea name="__note" wrap="hard" rows=%s cols=%s>'\
474             '</textarea>'%(rows, cols)
476     # XXX new function
477     def do_list(self, property, reverse=0):
478         ''' list the items specified by property using the standard index for
479             the class
480         '''
481         propcl = self.properties[property]
482         if not isinstance(propcl, hyperdb.Multilink):
483             return _('[List: not a Multilink]')
485         value = self.determine_value(property)
486         if not value:
487             return ''
489         # sort, possibly revers and then re-stringify
490         value = map(int, value)
491         value.sort()
492         if reverse:
493             value.reverse()
494         value = map(str, value)
496         # render the sub-index into a string
497         fp = StringIO.StringIO()
498         try:
499             write_save = self.client.write
500             self.client.write = fp.write
501             index = IndexTemplate(self.client, self.templates, propcl.classname)
502             index.render(nodeids=value, show_display_form=0)
503         finally:
504             self.client.write = write_save
506         return fp.getvalue()
508     # XXX new function
509     def do_history(self, direction='descending'):
510         ''' list the history of the item
512             If "direction" is 'descending' then the most recent event will
513             be displayed first. If it is 'ascending' then the oldest event
514             will be displayed first.
515         '''
516         if self.nodeid is None:
517             return _("[History: node doesn't exist]")
519         l = ['<table width=100% border=0 cellspacing=0 cellpadding=2>',
520             '<tr class="list-header">',
521             _('<th align=left><span class="list-item">Date</span></th>'),
522             _('<th align=left><span class="list-item">User</span></th>'),
523             _('<th align=left><span class="list-item">Action</span></th>'),
524             _('<th align=left><span class="list-item">Args</span></th>'),
525             '</tr>']
527         comments = {}
528         history = self.cl.history(self.nodeid)
529         history.sort()
530         if direction == 'descending':
531             history.reverse()
532         for id, evt_date, user, action, args in history:
533             date_s = str(evt_date).replace("."," ")
534             arg_s = ''
535             if action == 'link' and type(args) == type(()):
536                 if len(args) == 3:
537                     linkcl, linkid, key = args
538                     arg_s += '<a href="%s%s">%s%s %s</a>'%(linkcl, linkid,
539                         linkcl, linkid, key)
540                 else:
541                     arg_s = str(arg)
543             elif action == 'unlink' and type(args) == type(()):
544                 if len(args) == 3:
545                     linkcl, linkid, key = args
546                     arg_s += '<a href="%s%s">%s%s %s</a>'%(linkcl, linkid,
547                         linkcl, linkid, key)
548                 else:
549                     arg_s = str(arg)
551             elif type(args) == type({}):
552                 cell = []
553                 for k in args.keys():
554                     # try to get the relevant property and treat it
555                     # specially
556                     try:
557                         prop = self.properties[k]
558                     except:
559                         prop = None
560                     if prop is not None:
561                         if args[k] and (isinstance(prop, hyperdb.Multilink) or
562                                 isinstance(prop, hyperdb.Link)):
563                             # figure what the link class is
564                             classname = prop.classname
565                             try:
566                                 linkcl = self.db.classes[classname]
567                             except KeyError, message:
568                                 labelprop = None
569                                 comments[classname] = _('''The linked class
570                                     %(classname)s no longer exists''')%locals()
571                             labelprop = linkcl.labelprop()
573                         if isinstance(prop, hyperdb.Multilink) and \
574                                 len(args[k]) > 0:
575                             ml = []
576                             for linkid in args[k]:
577                                 label = classname + linkid
578                                 # if we have a label property, try to use it
579                                 # TODO: test for node existence even when
580                                 # there's no labelprop!
581                                 try:
582                                     if labelprop is not None:
583                                         label = linkcl.get(linkid, labelprop)
584                                 except IndexError:
585                                     comments['no_link'] = _('''<strike>The
586                                         linked node no longer
587                                         exists</strike>''')
588                                     ml.append('<strike>%s</strike>'%label)
589                                 else:
590                                     ml.append('<a href="%s%s">%s</a>'%(
591                                         classname, linkid, label))
592                             cell.append('%s:\n  %s'%(k, ',\n  '.join(ml)))
593                         elif isinstance(prop, hyperdb.Link) and args[k]:
594                             label = classname + args[k]
595                             # if we have a label property, try to use it
596                             # TODO: test for node existence even when
597                             # there's no labelprop!
598                             if labelprop is not None:
599                                 try:
600                                     label = linkcl.get(args[k], labelprop)
601                                 except IndexError:
602                                     comments['no_link'] = _('''<strike>The
603                                         linked node no longer
604                                         exists</strike>''')
605                                     cell.append(' <strike>%s</strike>,\n'%label)
606                                     # "flag" this is done .... euwww
607                                     label = None
608                             if label is not None:
609                                 cell.append('%s: <a href="%s%s">%s</a>\n'%(k,
610                                     classname, args[k], label))
612                         elif isinstance(prop, hyperdb.Date) and args[k]:
613                             d = date.Date(args[k])
614                             cell.append('%s: %s'%(k, str(d)))
616                         elif isinstance(prop, hyperdb.Interval) and args[k]:
617                             d = date.Interval(args[k])
618                             cell.append('%s: %s'%(k, str(d)))
620                         elif not args[k]:
621                             cell.append('%s: (no value)\n'%k)
623                         else:
624                             cell.append('%s: %s\n'%(k, str(args[k])))
625                     else:
626                         # property no longer exists
627                         comments['no_exist'] = _('''<em>The indicated property
628                             no longer exists</em>''')
629                         cell.append('<em>%s: %s</em>\n'%(k, str(args[k])))
630                 arg_s = '<br />'.join(cell)
631             else:
632                 # unkown event!!
633                 comments['unknown'] = _('''<strong><em>This event is not
634                     handled by the history display!</em></strong>''')
635                 arg_s = '<strong><em>' + str(args) + '</em></strong>'
636             date_s = date_s.replace(' ', '&nbsp;')
637             l.append('<tr><td nowrap valign=top>%s</td><td valign=top>%s</td>'
638                 '<td valign=top>%s</td><td valign=top>%s</td></tr>'%(date_s,
639                 user, action, arg_s))
640         if comments:
641             l.append(_('<tr><td colspan=4><strong>Note:</strong></td></tr>'))
642         for entry in comments.values():
643             l.append('<tr><td colspan=4>%s</td></tr>'%entry)
644         l.append('</table>')
645         return '\n'.join(l)
647     # XXX new function
648     def do_submit(self):
649         ''' add a submit button for the item
650         '''
651         if self.nodeid:
652             return _('<input type="submit" name="submit" value="Submit Changes">')
653         elif self.form is not None:
654             return _('<input type="submit" name="submit" value="Submit New Entry">')
655         else:
656             return _('[Submit: not called from item]')
660 #   INDEX TEMPLATES
662 class IndexTemplateReplace:
663     def __init__(self, globals, locals, props):
664         self.globals = globals
665         self.locals = locals
666         self.props = props
668     replace=re.compile(
669         r'((<property\s+name="(?P<name>[^>]+)">(?P<text>.+?)</property>)|'
670         r'(?P<display><display\s+call="(?P<command>[^"]+)">))', re.I|re.S)
671     def go(self, text):
672         return self.replace.sub(self, text)
674     def __call__(self, m, filter=None, columns=None, sort=None, group=None):
675         if m.group('name'):
676             if m.group('name') in self.props:
677                 text = m.group('text')
678                 replace = IndexTemplateReplace(self.globals, {}, self.props)
679                 return replace.go(m.group('text'))
680             else:
681                 return ''
682         if m.group('display'):
683             command = m.group('command')
684             return eval(command, self.globals, self.locals)
685         print '*** unhandled match', m.groupdict()
687 class IndexTemplate(TemplateFunctions):
688     def __init__(self, client, templates, classname):
689         self.client = client
690         self.instance = client.instance
691         self.templates = templates
692         self.classname = classname
694         # derived
695         self.db = self.client.db
696         self.cl = self.db.classes[self.classname]
697         self.properties = self.cl.getprops()
699         TemplateFunctions.__init__(self)
701     col_re=re.compile(r'<property\s+name="([^>]+)">')
702     def render(self, filterspec={}, filter=[], columns=[], sort=[], group=[],
703             show_display_form=1, nodeids=None, show_customization=1):
704         self.filterspec = filterspec
706         w = self.client.write
708         # get the filter template
709         try:
710             filter_template = open(os.path.join(self.templates,
711                 self.classname+'.filter')).read()
712             all_filters = self.col_re.findall(filter_template)
713         except IOError, error:
714             if error.errno not in (errno.ENOENT, errno.ESRCH): raise
715             filter_template = None
716             all_filters = []
718         # XXX deviate from spec here ...
719         # load the index section template and figure the default columns from it
720         try:
721             template = open(os.path.join(self.templates,
722                 self.classname+'.index')).read()
723         except IOError, error:
724             if error.errno not in (errno.ENOENT, errno.ESRCH): raise
725             raise MissingTemplateError, self.classname+'.index'
726         all_columns = self.col_re.findall(template)
727         if not columns:
728             columns = []
729             for name in all_columns:
730                 columns.append(name)
731         else:
732             # re-sort columns to be the same order as all_columns
733             l = []
734             for name in all_columns:
735                 if name in columns:
736                     l.append(name)
737             columns = l
739         # display the filter section
740         if (show_display_form and 
741                 self.instance.FILTER_POSITION in ('top and bottom', 'top')):
742             w('<form onSubmit="return submit_once()" action="%s">\n'%self.classname)
743             self.filter_section(filter_template, filter, columns, group,
744                 all_filters, all_columns, show_customization)
745             # make sure that the sorting doesn't get lost either
746             if sort:
747                 w('<input type="hidden" name=":sort" value="%s">'%
748                     ','.join(sort))
749             w('</form>\n')
752         # now display the index section
753         w('<table width=100% border=0 cellspacing=0 cellpadding=2>\n')
754         w('<tr class="list-header">\n')
755         for name in columns:
756             cname = name.capitalize()
757             if show_display_form:
758                 sb = self.sortby(name, filterspec, columns, filter, group, sort)
759                 anchor = "%s?%s"%(self.classname, sb)
760                 w('<td><span class="list-header"><a href="%s">%s</a></span></td>\n'%(
761                     anchor, cname))
762             else:
763                 w('<td><span class="list-header">%s</span></td>\n'%cname)
764         w('</tr>\n')
766         # this stuff is used for group headings - optimise the group names
767         old_group = None
768         group_names = []
769         if group:
770             for name in group:
771                 if name[0] == '-': group_names.append(name[1:])
772                 else: group_names.append(name)
774         # now actually loop through all the nodes we get from the filter and
775         # apply the template
776         if nodeids is None:
777             nodeids = self.cl.filter(filterspec, sort, group)
778         for nodeid in nodeids:
779             # check for a group heading
780             if group_names:
781                 this_group = [self.cl.get(nodeid, name, _('[no value]'))
782                     for name in group_names]
783                 if this_group != old_group:
784                     l = []
785                     for name in group_names:
786                         prop = self.properties[name]
787                         if isinstance(prop, hyperdb.Link):
788                             group_cl = self.db.classes[prop.classname]
789                             key = group_cl.getkey()
790                             value = self.cl.get(nodeid, name)
791                             if value is None:
792                                 l.append(_('[unselected %(classname)s]')%{
793                                     'classname': prop.classname})
794                             else:
795                                 l.append(group_cl.get(self.cl.get(nodeid,
796                                     name), key))
797                         elif isinstance(prop, hyperdb.Multilink):
798                             group_cl = self.db.classes[prop.classname]
799                             key = group_cl.getkey()
800                             for value in self.cl.get(nodeid, name):
801                                 l.append(group_cl.get(value, key))
802                         else:
803                             value = self.cl.get(nodeid, name, _('[no value]'))
804                             if value is None:
805                                 value = _('[empty %(name)s]')%locals()
806                             else:
807                                 value = str(value)
808                             l.append(value)
809                     w('<tr class="section-bar">'
810                       '<td align=middle colspan=%s><strong>%s</strong></td></tr>'%(
811                         len(columns), ', '.join(l)))
812                     old_group = this_group
814             # display this node's row
815             replace = IndexTemplateReplace(self.globals, locals(), columns)
816             self.nodeid = nodeid
817             w(replace.go(template))
818             self.nodeid = None
820         w('</table>')
822         # display the filter section
823         if (show_display_form and hasattr(self.instance, 'FILTER_POSITION') and
824                 self.instance.FILTER_POSITION in ('top and bottom', 'bottom')):
825             w('<form onSubmit="return submit_once()" action="%s">\n'%self.classname)
826             self.filter_section(filter_template, filter, columns, group,
827                 all_filters, all_columns, show_customization)
828             # make sure that the sorting doesn't get lost either
829             if sort:
830                 w('<input type="hidden" name=":sort" value="%s">'%
831                     ','.join(sort))
832             w('</form>\n')
835     def filter_section(self, template, filter, columns, group, all_filters,
836             all_columns, show_customization):
838         w = self.client.write
840         # wrap the template in a single table to ensure the whole widget
841         # is displayed at once
842         w('<table><tr><td>')
844         if template and filter:
845             # display the filter section
846             w('<table width=100% border=0 cellspacing=0 cellpadding=2>')
847             w('<tr class="location-bar">')
848             w(_(' <th align="left" colspan="2">Filter specification...</th>'))
849             w('</tr>')
850             replace = IndexTemplateReplace(self.globals, locals(), filter)
851             w(replace.go(template))
852             w('<tr class="location-bar"><td width="1%%">&nbsp;</td>')
853             w(_('<td><input type="submit" name="action" value="Redisplay"></td></tr>'))
854             w('</table>')
856         # now add in the filter/columns/group/etc config table form
857         w('<input type="hidden" name="show_customization" value="%s">' %
858             show_customization )
859         w('<table width=100% border=0 cellspacing=0 cellpadding=2>\n')
860         names = []
861         seen = {}
862         for name in all_filters + all_columns:
863             if self.properties.has_key(name) and not seen.has_key(name):
864                 names.append(name)
865             seen[name] = 1
866         if show_customization:
867             action = '-'
868         else:
869             action = '+'
870             # hide the values for filters, columns and grouping in the form
871             # if the customization widget is not visible
872             for name in names:
873                 if all_filters and name in filter:
874                     w('<input type="hidden" name=":filter" value="%s">' % name)
875                 if all_columns and name in columns:
876                     w('<input type="hidden" name=":columns" value="%s">' % name)
877                 if all_columns and name in group:
878                     w('<input type="hidden" name=":group" value="%s">' % name)
880         # TODO: The widget style can go into the stylesheet
881         w(_('<th align="left" colspan=%s>'
882           '<input style="height : 1em; width : 1em; font-size: 12pt" type="submit" name="action" value="%s">&nbsp;View '
883           'customisation...</th></tr>\n')%(len(names)+1, action))
885         if not show_customization:
886             w('</table>\n')
887             return
889         w('<tr class="location-bar"><th>&nbsp;</th>')
890         for name in names:
891             w('<th>%s</th>'%name.capitalize())
892         w('</tr>\n')
894         # Filter
895         if all_filters:
896             w(_('<tr><th width="1%" align=right class="location-bar">Filters</th>\n'))
897             for name in names:
898                 if name not in all_filters:
899                     w('<td>&nbsp;</td>')
900                     continue
901                 if name in filter: checked=' checked'
902                 else: checked=''
903                 w('<td align=middle>\n')
904                 w(' <input type="checkbox" name=":filter" value="%s" '
905                   '%s></td>\n'%(name, checked))
906             w('</tr>\n')
908         # Columns
909         if all_columns:
910             w(_('<tr><th width="1%" align=right class="location-bar">Columns</th>\n'))
911             for name in names:
912                 if name not in all_columns:
913                     w('<td>&nbsp;</td>')
914                     continue
915                 if name in columns: checked=' checked'
916                 else: checked=''
917                 w('<td align=middle>\n')
918                 w(' <input type="checkbox" name=":columns" value="%s"'
919                   '%s></td>\n'%(name, checked))
920             w('</tr>\n')
922             # Grouping
923             w(_('<tr><th width="1%" align=right class="location-bar">Grouping</th>\n'))
924             for name in names:
925                 prop = self.properties[name]
926                 if name not in all_columns:
927                     w('<td>&nbsp;</td>')
928                     continue
929                 if name in group: checked=' checked'
930                 else: checked=''
931                 w('<td align=middle>\n')
932                 w(' <input type="checkbox" name=":group" value="%s"'
933                   '%s></td>\n'%(name, checked))
934             w('</tr>\n')
936         w('<tr class="location-bar"><td width="1%">&nbsp;</td>')
937         w('<td colspan="%s">'%len(names))
938         w(_('<input type="submit" name="action" value="Redisplay"></td>'))
939         w('</tr>\n')
940         w('</table>\n')
942         # and the outer table
943         w('</td></tr></table>')
946     def sortby(self, sort_name, filterspec, columns, filter, group, sort):
947         l = []
948         w = l.append
949         for k, v in filterspec.items():
950             k = urllib.quote(k)
951             if type(v) == type([]):
952                 w('%s=%s'%(k, ','.join(map(urllib.quote, v))))
953             else:
954                 w('%s=%s'%(k, urllib.quote(v)))
955         if columns:
956             w(':columns=%s'%','.join(map(urllib.quote, columns)))
957         if filter:
958             w(':filter=%s'%','.join(map(urllib.quote, filter)))
959         if group:
960             w(':group=%s'%','.join(map(urllib.quote, group)))
961         m = []
962         s_dir = ''
963         for name in sort:
964             dir = name[0]
965             if dir == '-':
966                 name = name[1:]
967             else:
968                 dir = ''
969             if sort_name == name:
970                 if dir == '-':
971                     s_dir = ''
972                 else:
973                     s_dir = '-'
974             else:
975                 m.append(dir+urllib.quote(name))
976         m.insert(0, s_dir+urllib.quote(sort_name))
977         # so things don't get completely out of hand, limit the sort to
978         # two columns
979         w(':sort=%s'%','.join(m[:2]))
980         return '&'.join(l)
983 #   ITEM TEMPLATES
985 class ItemTemplateReplace:
986     def __init__(self, globals, locals, cl, nodeid):
987         self.globals = globals
988         self.locals = locals
989         self.cl = cl
990         self.nodeid = nodeid
992     replace=re.compile(
993         r'((<property\s+name="(?P<name>[^>]+)">(?P<text>.+?)</property>)|'
994         r'(?P<display><display\s+call="(?P<command>[^"]+)">))', re.I|re.S)
995     def go(self, text):
996         return self.replace.sub(self, text)
998     def __call__(self, m, filter=None, columns=None, sort=None, group=None):
999         if m.group('name'):
1000             if self.nodeid and self.cl.get(self.nodeid, m.group('name')):
1001                 replace = ItemTemplateReplace(self.globals, {}, self.cl,
1002                     self.nodeid)
1003                 return replace.go(m.group('text'))
1004             else:
1005                 return ''
1006         if m.group('display'):
1007             command = m.group('command')
1008             return eval(command, self.globals, self.locals)
1009         print '*** unhandled match', m.groupdict()
1012 class ItemTemplate(TemplateFunctions):
1013     def __init__(self, client, templates, classname):
1014         self.client = client
1015         self.instance = client.instance
1016         self.templates = templates
1017         self.classname = classname
1019         # derived
1020         self.db = self.client.db
1021         self.cl = self.db.classes[self.classname]
1022         self.properties = self.cl.getprops()
1024         TemplateFunctions.__init__(self)
1026     def render(self, nodeid):
1027         self.nodeid = nodeid
1029         if (self.properties.has_key('type') and
1030                 self.properties.has_key('content')):
1031             pass
1032             # XXX we really want to return this as a downloadable...
1033             #  currently I handle this at a higher level by detecting 'file'
1034             #  designators...
1036         w = self.client.write
1037         w('<form onSubmit="return submit_once()" action="%s%s" method="POST" enctype="multipart/form-data">'%(
1038             self.classname, nodeid))
1039         s = open(os.path.join(self.templates, self.classname+'.item')).read()
1040         replace = ItemTemplateReplace(self.globals, locals(), self.cl, nodeid)
1041         w(replace.go(s))
1042         w('</form>')
1045 class NewItemTemplate(TemplateFunctions):
1046     def __init__(self, client, templates, classname):
1047         self.client = client
1048         self.instance = client.instance
1049         self.templates = templates
1050         self.classname = classname
1052         # derived
1053         self.db = self.client.db
1054         self.cl = self.db.classes[self.classname]
1055         self.properties = self.cl.getprops()
1057         TemplateFunctions.__init__(self)
1059     def render(self, form):
1060         self.form = form
1061         w = self.client.write
1062         c = self.classname
1063         try:
1064             s = open(os.path.join(self.templates, c+'.newitem')).read()
1065         except IOError:
1066             s = open(os.path.join(self.templates, c+'.item')).read()
1067         w('<form onSubmit="return submit_once()" action="new%s" method="POST" enctype="multipart/form-data">'%c)
1068         for key in form.keys():
1069             if key[0] == ':':
1070                 value = form[key].value
1071                 if type(value) != type([]): value = [value]
1072                 for value in value:
1073                     w('<input type="hidden" name="%s" value="%s">'%(key, value))
1074         replace = ItemTemplateReplace(self.globals, locals(), None, None)
1075         w(replace.go(s))
1076         w('</form>')
1079 # $Log: not supported by cvs2svn $
1080 # Revision 1.76  2002/02/16 09:10:52  richard
1081 # oops
1083 # Revision 1.75  2002/02/16 08:43:23  richard
1084 #  . #517906 ] Attribute order in "View customisation"
1086 # Revision 1.74  2002/02/16 08:39:42  richard
1087 #  . #516854 ] "My Issues" and redisplay
1089 # Revision 1.73  2002/02/15 07:08:44  richard
1090 #  . Alternate email addresses are now available for users. See the MIGRATION
1091 #    file for info on how to activate the feature.
1093 # Revision 1.72  2002/02/14 23:39:18  richard
1094 # . All forms now have "double-submit" protection when Javascript is enabled
1095 #   on the client-side.
1097 # Revision 1.71  2002/01/23 06:15:24  richard
1098 # real (non-string, duh) sorting of lists by node id
1100 # Revision 1.70  2002/01/23 05:47:57  richard
1101 # more HTML template cleanup and unit tests
1103 # Revision 1.69  2002/01/23 05:10:27  richard
1104 # More HTML template cleanup and unit tests.
1105 #  - download() now implemented correctly, replacing link(is_download=1) [fixed in the
1106 #    templates, but link(is_download=1) will still work for existing templates]
1108 # Revision 1.68  2002/01/22 22:55:28  richard
1109 #  . htmltemplate list() wasn't sorting...
1111 # Revision 1.67  2002/01/22 22:46:22  richard
1112 # more htmltemplate cleanups and unit tests
1114 # Revision 1.66  2002/01/22 06:35:40  richard
1115 # more htmltemplate tests and cleanup
1117 # Revision 1.65  2002/01/22 00:12:06  richard
1118 # Wrote more unit tests for htmltemplate, and while I was at it, I polished
1119 # off the implementation of some of the functions so they behave sanely.
1121 # Revision 1.64  2002/01/21 03:25:59  richard
1122 # oops
1124 # Revision 1.63  2002/01/21 02:59:10  richard
1125 # Fixed up the HTML display of history so valid links are actually displayed.
1126 # Oh for some unit tests! :(
1128 # Revision 1.62  2002/01/18 08:36:12  grubert
1129 #  . add nowrap to history table date cell i.e. <td nowrap ...
1131 # Revision 1.61  2002/01/17 23:04:53  richard
1132 #  . much nicer history display (actualy real handling of property types etc)
1134 # Revision 1.60  2002/01/17 08:48:19  grubert
1135 #  . display superseder as html link in history.
1137 # Revision 1.59  2002/01/17 07:58:24  grubert
1138 #  . display links a html link in history.
1140 # Revision 1.58  2002/01/15 00:50:03  richard
1141 # #502949 ] index view for non-issues and redisplay
1143 # Revision 1.57  2002/01/14 23:31:21  richard
1144 # reverted the change that had plain() hyperlinking the link displays -
1145 # that's what link() is for!
1147 # Revision 1.56  2002/01/14 07:04:36  richard
1148 #  . plain rendering of links in the htmltemplate now generate a hyperlink to
1149 #    the linked node's page.
1150 #    ... this allows a display very similar to bugzilla's where you can actually
1151 #    find out information about the linked node.
1153 # Revision 1.55  2002/01/14 06:45:03  richard
1154 #  . #502953 ] nosy-like treatment of other multilinks
1155 #    ... had to revert most of the previous change to the multilink field
1156 #    display... not good.
1158 # Revision 1.54  2002/01/14 05:16:51  richard
1159 # The submit buttons need a name attribute or mozilla won't submit without a
1160 # file upload. Yeah, that's bloody obscure. Grr.
1162 # Revision 1.53  2002/01/14 04:03:32  richard
1163 # How about that ... date fields have never worked ...
1165 # Revision 1.52  2002/01/14 02:20:14  richard
1166 #  . changed all config accesses so they access either the instance or the
1167 #    config attriubute on the db. This means that all config is obtained from
1168 #    instance_config instead of the mish-mash of classes. This will make
1169 #    switching to a ConfigParser setup easier too, I hope.
1171 # At a minimum, this makes migration a _little_ easier (a lot easier in the
1172 # 0.5.0 switch, I hope!)
1174 # Revision 1.51  2002/01/10 10:02:15  grubert
1175 # In do_history: replace "." in date by " " so html wraps more sensible.
1176 # Should this be done in date's string converter ?
1178 # Revision 1.50  2002/01/05 02:35:10  richard
1179 # I18N'ification
1181 # Revision 1.49  2001/12/20 15:43:01  rochecompaan
1182 # Features added:
1183 #  .  Multilink properties are now displayed as comma separated values in
1184 #     a textbox
1185 #  .  The add user link is now only visible to the admin user
1186 #  .  Modified the mail gateway to reject submissions from unknown
1187 #     addresses if ANONYMOUS_ACCESS is denied
1189 # Revision 1.48  2001/12/20 06:13:24  rochecompaan
1190 # Bugs fixed:
1191 #   . Exception handling in hyperdb for strings-that-look-like numbers got
1192 #     lost somewhere
1193 #   . Internet Explorer submits full path for filename - we now strip away
1194 #     the path
1195 # Features added:
1196 #   . Link and multilink properties are now displayed sorted in the cgi
1197 #     interface
1199 # Revision 1.47  2001/11/26 22:55:56  richard
1200 # Feature:
1201 #  . Added INSTANCE_NAME to configuration - used in web and email to identify
1202 #    the instance.
1203 #  . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
1204 #    signature info in e-mails.
1205 #  . Some more flexibility in the mail gateway and more error handling.
1206 #  . Login now takes you to the page you back to the were denied access to.
1208 # Fixed:
1209 #  . Lots of bugs, thanks Roché and others on the devel mailing list!
1211 # Revision 1.46  2001/11/24 00:53:12  jhermann
1212 # "except:" is bad, bad , bad!
1214 # Revision 1.45  2001/11/22 15:46:42  jhermann
1215 # Added module docstrings to all modules.
1217 # Revision 1.44  2001/11/21 23:35:45  jhermann
1218 # Added globbing for win32, and sample marking in a 2nd file to test it
1220 # Revision 1.43  2001/11/21 04:04:43  richard
1221 # *sigh* more missing value handling
1223 # Revision 1.42  2001/11/21 03:40:54  richard
1224 # more new property handling
1226 # Revision 1.41  2001/11/15 10:26:01  richard
1227 #  . missing "return" in filter_section (thanks Roch'e Compaan)
1229 # Revision 1.40  2001/11/03 01:56:51  richard
1230 # More HTML compliance fixes. This will probably fix the Netscape problem
1231 # too.
1233 # Revision 1.39  2001/11/03 01:43:47  richard
1234 # Ahah! Fixed the lynx problem - there was a hidden input field misplaced.
1236 # Revision 1.38  2001/10/31 06:58:51  richard
1237 # Added the wrap="hard" attribute to the textarea of the note field so the
1238 # messages wrap sanely.
1240 # Revision 1.37  2001/10/31 06:24:35  richard
1241 # Added do_stext to htmltemplate, thanks Brad Clements.
1243 # Revision 1.36  2001/10/28 22:51:38  richard
1244 # Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
1246 # Revision 1.35  2001/10/24 00:04:41  richard
1247 # Removed the "infinite authentication loop", thanks Roch'e
1249 # Revision 1.34  2001/10/23 22:56:36  richard
1250 # Bugfix in filter "widget" placement, thanks Roch'e
1252 # Revision 1.33  2001/10/23 01:00:18  richard
1253 # Re-enabled login and registration access after lopping them off via
1254 # disabling access for anonymous users.
1255 # Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
1256 # a couple of bugs while I was there. Probably introduced a couple, but
1257 # things seem to work OK at the moment.
1259 # Revision 1.32  2001/10/22 03:25:01  richard
1260 # Added configuration for:
1261 #  . anonymous user access and registration (deny/allow)
1262 #  . filter "widget" location on index page (top, bottom, both)
1263 # Updated some documentation.
1265 # Revision 1.31  2001/10/21 07:26:35  richard
1266 # feature #473127: Filenames. I modified the file.index and htmltemplate
1267 #  source so that the filename is used in the link and the creation
1268 #  information is displayed.
1270 # Revision 1.30  2001/10/21 04:44:50  richard
1271 # bug #473124: UI inconsistency with Link fields.
1272 #    This also prompted me to fix a fairly long-standing usability issue -
1273 #    that of being able to turn off certain filters.
1275 # Revision 1.29  2001/10/21 00:17:56  richard
1276 # CGI interface view customisation section may now be hidden (patch from
1277 #  Roch'e Compaan.)
1279 # Revision 1.28  2001/10/21 00:00:16  richard
1280 # Fixed Checklist function - wasn't always working on a list.
1282 # Revision 1.27  2001/10/20 12:13:44  richard
1283 # Fixed grouping of non-str properties (thanks Roch'e Compaan)
1285 # Revision 1.26  2001/10/14 10:55:00  richard
1286 # Handle empty strings in HTML template Link function
1288 # Revision 1.25  2001/10/09 07:25:59  richard
1289 # Added the Password property type. See "pydoc roundup.password" for
1290 # implementation details. Have updated some of the documentation too.
1292 # Revision 1.24  2001/09/27 06:45:58  richard
1293 # *gak* ... xmp is Old Skool apparently. Am using pre again by have the option
1294 # on the plain() template function to escape the text for HTML.
1296 # Revision 1.23  2001/09/10 09:47:18  richard
1297 # Fixed bug in the generation of links to Link/Multilink in indexes.
1298 #   (thanks Hubert Hoegl)
1299 # Added AssignedTo to the "classic" schema's item page.
1301 # Revision 1.22  2001/08/30 06:01:17  richard
1302 # Fixed missing import in mailgw :(
1304 # Revision 1.21  2001/08/16 07:34:59  richard
1305 # better CGI text searching - but hidden filter fields are disappearing...
1307 # Revision 1.20  2001/08/15 23:43:18  richard
1308 # Fixed some isFooTypes that I missed.
1309 # Refactored some code in the CGI code.
1311 # Revision 1.19  2001/08/12 06:32:36  richard
1312 # using isinstance(blah, Foo) now instead of isFooType
1314 # Revision 1.18  2001/08/07 00:24:42  richard
1315 # stupid typo
1317 # Revision 1.17  2001/08/07 00:15:51  richard
1318 # Added the copyright/license notice to (nearly) all files at request of
1319 # Bizar Software.
1321 # Revision 1.16  2001/08/01 03:52:23  richard
1322 # Checklist was using wrong name.
1324 # Revision 1.15  2001/07/30 08:12:17  richard
1325 # Added time logging and file uploading to the templates.
1327 # Revision 1.14  2001/07/30 06:17:45  richard
1328 # Features:
1329 #  . Added ability for cgi newblah forms to indicate that the new node
1330 #    should be linked somewhere.
1331 # Fixed:
1332 #  . Fixed the agument handling for the roundup-admin find command.
1333 #  . Fixed handling of summary when no note supplied for newblah. Again.
1334 #  . Fixed detection of no form in htmltemplate Field display.
1336 # Revision 1.13  2001/07/30 02:37:53  richard
1337 # Temporary measure until we have decent schema migration.
1339 # Revision 1.12  2001/07/30 01:24:33  richard
1340 # Handles new node display now.
1342 # Revision 1.11  2001/07/29 09:31:35  richard
1343 # oops
1345 # Revision 1.10  2001/07/29 09:28:23  richard
1346 # Fixed sorting by clicking on column headings.
1348 # Revision 1.9  2001/07/29 08:27:40  richard
1349 # Fixed handling of passed-in values in form elements (ie. during a
1350 # drill-down)
1352 # Revision 1.8  2001/07/29 07:01:39  richard
1353 # Added vim command to all source so that we don't get no steenkin' tabs :)
1355 # Revision 1.7  2001/07/29 05:36:14  richard
1356 # Cleanup of the link label generation.
1358 # Revision 1.6  2001/07/29 04:06:42  richard
1359 # Fixed problem in link display when Link value is None.
1361 # Revision 1.5  2001/07/28 08:17:09  richard
1362 # fixed use of stylesheet
1364 # Revision 1.4  2001/07/28 07:59:53  richard
1365 # Replaced errno integers with their module values.
1366 # De-tabbed templatebuilder.py
1368 # Revision 1.3  2001/07/25 03:39:47  richard
1369 # Hrm - displaying links to classes that don't specify a key property. I've
1370 # got it defaulting to 'name', then 'title' and then a "random" property (first
1371 # one returned by getprops().keys().
1372 # Needs to be moved onto the Class I think...
1374 # Revision 1.2  2001/07/22 12:09:32  richard
1375 # Final commit of Grande Splite
1377 # Revision 1.1  2001/07/22 11:58:35  richard
1378 # More Grande Splite
1381 # vim: set filetype=python ts=4 sw=4 et si