Code

ehem
[roundup.git] / roundup / cgi_client.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: cgi_client.py,v 1.132 2002-07-08 07:26:14 richard Exp $
20 __doc__ = """
21 WWW request handler (also used in the stand-alone server).
22 """
24 import os, cgi, StringIO, urlparse, re, traceback, mimetypes, urllib
25 import binascii, Cookie, time, random
27 import roundupdb, htmltemplate, date, hyperdb, password
28 from roundup.i18n import _
29 from roundup.indexer import Indexer
31 class Unauthorised(ValueError):
32     pass
34 class NotFound(ValueError):
35     pass
37 class Client:
38     '''
39     A note about login
40     ------------------
42     If the user has no login cookie, then they are anonymous. There
43     are two levels of anonymous use. If there is no 'anonymous' user, there
44     is no login at all and the database is opened in read-only mode. If the
45     'anonymous' user exists, the user is logged in using that user (though
46     there is no cookie). This allows them to modify the database, and all
47     modifications are attributed to the 'anonymous' user.
48     '''
50     def __init__(self, instance, request, env, form=None):
51         hyperdb.traceMark()
52         self.instance = instance
53         self.request = request
54         self.env = env
55         self.path = env['PATH_INFO']
56         self.split_path = self.path.split('/')
57         self.instance_path_name = env['INSTANCE_NAME']
58         url = self.env['SCRIPT_NAME'] + '/'
59         machine = self.env['SERVER_NAME']
60         port = self.env['SERVER_PORT']
61         if port != '80': machine = machine + ':' + port
62         self.base = urlparse.urlunparse(('http', env['HTTP_HOST'], url,
63             None, None, None))
65         if form is None:
66             self.form = cgi.FieldStorage(environ=env)
67         else:
68             self.form = form
69         self.headers_done = 0
70         try:
71             self.debug = int(env.get("ROUNDUP_DEBUG", 0))
72         except ValueError:
73             # someone gave us a non-int debug level, turn it off
74             self.debug = 0
76         # used for searching the indexes
77         self.indexer = Indexer('%s/db'%instance.INSTANCE_HOME)
80     def getuid(self):
81         try:
82             return self.db.user.lookup(self.user)
83         except KeyError:
84             if self.user is None:
85                 # user is not logged in and username 'anonymous' doesn't
86                 # exist in the database
87                 err = _('anonymous users have read-only access only')
88             else:
89                 err = _("sanity check: unknown user name `%s'")%self.user
90             raise Unauthorised, errmsg
92     def header(self, headers=None):
93         '''Put up the appropriate header.
94         '''
95         if headers is None:
96             headers = {'Content-Type':'text/html'}
97         if not headers.has_key('Content-Type'):
98             headers['Content-Type'] = 'text/html'
99         self.request.send_response(200)
100         for entry in headers.items():
101             self.request.send_header(*entry)
102         self.request.end_headers()
103         self.headers_done = 1
104         if self.debug:
105             self.headers_sent = headers
107     global_javascript = '''
108 <script language="javascript">
109 submitted = false;
110 function submit_once() {
111     if (submitted) {
112         alert("Your request is being processed.\\nPlease be patient.");
113         return 0;
114     }
115     submitted = true;
116     return 1;
119 function help_window(helpurl, width, height) {
120     HelpWin = window.open('%(base)s%(instance_path_name)s/' + helpurl, 'HelpWindow', 'scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);
123 </script>
124 '''
125     def make_index_link(self, name):
126         '''Turn a configuration entry into a hyperlink...
127         '''
128         # get the link label and spec
129         spec = getattr(self.instance, name+'_INDEX')
131         d = {}
132         d[':sort'] = ','.join(map(urllib.quote, spec['SORT']))
133         d[':group'] = ','.join(map(urllib.quote, spec['GROUP']))
134         d[':filter'] = ','.join(map(urllib.quote, spec['FILTER']))
135         d[':columns'] = ','.join(map(urllib.quote, spec['COLUMNS']))
137         # snarf the filterspec
138         filterspec = spec['FILTERSPEC'].copy()
140         # now format the filterspec
141         for k, l in filterspec.items():
142             # fix up the CURRENT USER if needed (handle None too since that's
143             # the old flag value)
144             if l in (None, 'CURRENT USER'):
145                 if not self.user:
146                     continue
147                 l = [self.db.user.lookup(self.user)]
149             # add
150             d[urllib.quote(k)] = ','.join(map(urllib.quote, l))
152         # finally, format the URL
153         return '<a href="%s?%s">%s</a>'%(spec['CLASS'],
154             '&'.join([k+'='+v for k,v in d.items()]), spec['LABEL'])
157     def pagehead(self, title, message=None):
158         '''Display the page heading, with information about the tracker and
159             links to more information
160         '''
162         # include any important message
163         if message is not None:
164             message = _('<div class="system-msg">%(message)s</div>')%locals()
165         else:
166             message = ''
168         # style sheet (CSS)
169         style = open(os.path.join(self.instance.TEMPLATES, 'style.css')).read()
171         # figure who the user is
172         user_name = self.user or ''
173         if user_name not in ('', 'anonymous'):
174             userid = self.db.user.lookup(self.user)
175         else:
176             userid = None
178         # figure all the header links
179         if hasattr(self.instance, 'HEADER_INDEX_LINKS'):
180             links = []
181             for name in self.instance.HEADER_INDEX_LINKS:
182                 spec = getattr(self.instance, name + '_INDEX')
183                 # skip if we need to fill in the logged-in user id there's
184                 # no user logged in
185                 if (spec['FILTERSPEC'].has_key('assignedto') and
186                         spec['FILTERSPEC']['assignedto'] in ('CURRENT USER',
187                         None) and userid is None):
188                     continue
189                 links.append(self.make_index_link(name))
190         else:
191             # no config spec - hard-code
192             links = [
193                 _('All <a href="issue?status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>'),
194                 _('Unassigned <a href="issue?assignedto=-1&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>')
195             ]
197         # if they're logged in, include links to their information, and the
198         # ability to add an issue
199         if user_name not in ('', 'anonymous'):
200             user_info = _('''
201 <a href="user%(userid)s">My Details</a> | <a href="logout">Logout</a>
202 ''')%locals()
204             # figure the "add class" links
205             if hasattr(self.instance, 'HEADER_ADD_LINKS'):
206                 classes = self.instance.HEADER_ADD_LINKS
207             else:
208                 classes = ['issue']
209             l = []
210             for class_name in classes:
211                 cap_class = class_name.capitalize()
212                 links.append(_('Add <a href="new%(class_name)s">'
213                     '%(cap_class)s</a>')%locals())
215             # if there's no config header link spec, force a user link here
216             if not hasattr(self.instance, 'HEADER_INDEX_LINKS'):
217                 links.append(_('<a href="issue?assignedto=%(userid)s&status=-1,unread,chatting,open,pending&:filter=status,resolution,assignedto&:sort=-activity&:columns=id,activity,status,resolution,title,creator&:group=type&show_customization=1">My Issues</a>')%locals())
218         else:
219             user_info = _('<a href="login">Login</a>')
220             add_links = ''
222         # if the user is admin, include admin links
223         admin_links = ''
224         if user_name == 'admin':
225             links.append(_('<a href="list_classes">Class List</a>'))
226             links.append(_('<a href="user">User List</a>'))
227             links.append(_('<a href="newuser">Add User</a>'))
229         # add the search links
230         if hasattr(self.instance, 'HEADER_SEARCH_LINKS'):
231             classes = self.instance.HEADER_SEARCH_LINKS
232         else:
233             classes = ['issue']
234         l = []
235         for class_name in classes:
236             cap_class = class_name.capitalize()
237             links.append(_('Search <a href="search%(class_name)s">'
238                 '%(cap_class)s</a>')%locals())
240         # now we have all the links, join 'em
241         links = '\n | '.join(links)
243         # include the javascript bit
244         global_javascript = self.global_javascript%self.__dict__
246         # finally, format the header
247         self.write(_('''<html><head>
248 <title>%(title)s</title>
249 <style type="text/css">%(style)s</style>
250 </head>
251 %(global_javascript)s
252 <body bgcolor=#ffffff>
253 %(message)s
254 <table width=100%% border=0 cellspacing=0 cellpadding=2>
255 <tr class="location-bar"><td><big><strong>%(title)s</strong></big></td>
256 <td align=right valign=bottom>%(user_name)s</td></tr>
257 <tr class="location-bar">
258 <td align=left>%(links)s</td>
259 <td align=right>%(user_info)s</td>
260 </table>
261 ''')%locals())
263     def pagefoot(self):
264         if self.debug:
265             self.write(_('<hr><small><dl><dt><b>Path</b></dt>'))
266             self.write('<dd>%s</dd>'%(', '.join(map(repr, self.split_path))))
267             keys = self.form.keys()
268             keys.sort()
269             if keys:
270                 self.write(_('<dt><b>Form entries</b></dt>'))
271                 for k in self.form.keys():
272                     v = self.form.getvalue(k, "<empty>")
273                     if type(v) is type([]):
274                         # Multiple username fields specified
275                         v = "|".join(v)
276                     self.write('<dd><em>%s</em>=%s</dd>'%(k, cgi.escape(v)))
277             keys = self.headers_sent.keys()
278             keys.sort()
279             self.write(_('<dt><b>Sent these HTTP headers</b></dt>'))
280             for k in keys:
281                 v = self.headers_sent[k]
282                 self.write('<dd><em>%s</em>=%s</dd>'%(k, cgi.escape(v)))
283             keys = self.env.keys()
284             keys.sort()
285             self.write(_('<dt><b>CGI environment</b></dt>'))
286             for k in keys:
287                 v = self.env[k]
288                 self.write('<dd><em>%s</em>=%s</dd>'%(k, cgi.escape(v)))
289             self.write('</dl></small>')
290         self.write('</body></html>')
292     def write(self, content):
293         if not self.headers_done:
294             self.header()
295         self.request.wfile.write(content)
297     def index_arg(self, arg):
298         ''' handle the args to index - they might be a list from the form
299             (ie. submitted from a form) or they might be a command-separated
300             single string (ie. manually constructed GET args)
301         '''
302         if self.form.has_key(arg):
303             arg =  self.form[arg]
304             if type(arg) == type([]):
305                 return [arg.value for arg in arg]
306             return arg.value.split(',')
307         return []
309     def index_filterspec(self, filter):
310         ''' pull the index filter spec from the form
312         Links and multilinks want to be lists - the rest are straight
313         strings.
314         '''
315         props = self.db.classes[self.classname].getprops()
316         # all the form args not starting with ':' are filters
317         filterspec = {}
318         for key in self.form.keys():
319             if key[0] == ':': continue
320             if not props.has_key(key): continue
321             if key not in filter: continue
322             prop = props[key]
323             value = self.form[key]
324             if (isinstance(prop, hyperdb.Link) or
325                     isinstance(prop, hyperdb.Multilink)):
326                 if type(value) == type([]):
327                     value = [arg.value for arg in value]
328                 else:
329                     value = value.value.split(',')
330                 l = filterspec.get(key, [])
331                 l = l + value
332                 filterspec[key] = l
333             else:
334                 filterspec[key] = value.value
335         return filterspec
337     def customization_widget(self):
338         ''' The customization widget is visible by default. The widget
339             visibility is remembered by show_customization.  Visibility
340             is not toggled if the action value is "Redisplay"
341         '''
342         if not self.form.has_key('show_customization'):
343             visible = 1
344         else:
345             visible = int(self.form['show_customization'].value)
346             if self.form.has_key('action'):
347                 if self.form['action'].value != 'Redisplay':
348                     visible = self.form['action'].value == '+'
349             
350         return visible
352     # TODO: make this go away some day...
353     default_index_sort = ['-activity']
354     default_index_group = ['priority']
355     default_index_filter = ['status']
356     default_index_columns = ['id','activity','title','status','assignedto']
357     default_index_filterspec = {'status': ['1', '2', '3', '4', '5', '6', '7']}
359     def _get_customisation_info(self):
360         # see if the web has supplied us with any customisation info
361         defaults = 1
362         for key in ':sort', ':group', ':filter', ':columns':
363             if self.form.has_key(key):
364                 defaults = 0
365                 break
366         if defaults:
367             # try the instance config first
368             if hasattr(self.instance, 'DEFAULT_INDEX'):
369                 d = self.instance.DEFAULT_INDEX
370                 self.classname = d['CLASS']
371                 sort = d['SORT']
372                 group = d['GROUP']
373                 filter = d['FILTER']
374                 columns = d['COLUMNS']
375                 filterspec = d['FILTERSPEC']
377             else:
378                 # nope - fall back on the old way of doing it
379                 self.classname = 'issue'
380                 sort = self.default_index_sort
381                 group = self.default_index_group
382                 filter = self.default_index_filter
383                 columns = self.default_index_columns
384                 filterspec = self.default_index_filterspec
385         else:
386             # make list() extract the info from the CGI environ
387             self.classname = 'issue'
388             sort = group = filter = columns = filterspec = None
389         return columns, filter, group, sort, filterspec
391     def index(self):
392         ''' put up an index - no class specified
393         '''
394         columns, filter, group, sort, filterspec = \
395             self._get_customisation_info()
396         return self.list(columns=columns, filter=filter, group=group,
397             sort=sort, filterspec=filterspec)
399     def searchnode(self):
400         columns, filter, group, sort, filterspec = \
401             self._get_customisation_info()
402         show_nodes = 1
403         if len(self.form.keys()) == 0:
404             # get the default search filters from instance_config
405             if hasattr(self.instance, 'SEARCH_FILTERS'):
406                 for f in self.instance.SEARCH_FILTERS:
407                     spec = getattr(self.instance, f)
408                     if spec['CLASS'] == self.classname:
409                         filter = spec['FILTER']
410                 
411             show_nodes = 0
412             show_customization = 1
413         return self.list(columns=columns, filter=filter, group=group,
414             sort=sort, filterspec=filterspec,
415             show_customization=show_customization, show_nodes=show_nodes)
416         
418     # XXX deviates from spec - loses the '+' (that's a reserved character
419     # in URLS
420     def list(self, sort=None, group=None, filter=None, columns=None,
421             filterspec=None, show_customization=None, show_nodes=1):
422         ''' call the template index with the args
424             :sort    - sort by prop name, optionally preceeded with '-'
425                      to give descending or nothing for ascending sorting.
426             :group   - group by prop name, optionally preceeded with '-' or
427                      to sort in descending or nothing for ascending order.
428             :filter  - selects which props should be displayed in the filter
429                      section. Default is all.
430             :columns - selects the columns that should be displayed.
431                      Default is all.
433         '''
434         cn = self.classname
435         cl = self.db.classes[cn]
436         self.pagehead(_('%(instancename)s: Index of %(classname)s')%{
437             'classname': cn, 'instancename': self.instance.INSTANCE_NAME})
438         if sort is None: sort = self.index_arg(':sort')
439         if group is None: group = self.index_arg(':group')
440         if filter is None: filter = self.index_arg(':filter')
441         if columns is None: columns = self.index_arg(':columns')
442         if filterspec is None: filterspec = self.index_filterspec(filter)
443         if show_customization is None:
444             show_customization = self.customization_widget()
445         if self.form.has_key('search_text'):
446             search_text = self.form['search_text'].value
447         else:
448             search_text = ''
450         index = htmltemplate.IndexTemplate(self, self.instance.TEMPLATES, cn)
451         try:
452             index.render(filterspec, search_text, filter, columns, sort, 
453                 group, show_customization=show_customization, 
454                 show_nodes=show_nodes)
455         except htmltemplate.MissingTemplateError:
456             self.basicClassEditPage()
457         self.pagefoot()
459     def basicClassEditPage(self):
460         '''Display a basic edit page that allows simple editing of the
461            nodes of the current class
462         '''
463         if self.user != 'admin':
464             raise Unauthorised
465         w = self.write
466         cn = self.classname
467         cl = self.db.classes[cn]
468         idlessprops = cl.getprops(protected=0).keys()
469         props = ['id'] + idlessprops
472         # get the CSV module
473         try:
474             import csv
475         except ImportError:
476             w(_('Sorry, you need the csv module to use this function.<br>\n'
477                 'Get it from: <a href="http://www.object-craft.com.au/projects/csv/">http://www.object-craft.com.au/projects/csv/'))
478             return
480         # do the edit
481         if self.form.has_key('rows'):
482             rows = self.form['rows'].value.splitlines()
483             p = csv.parser()
484             found = {}
485             line = 0
486             for row in rows:
487                 line += 1
488                 values = p.parse(row)
489                 # not a complete row, keep going
490                 if not values: continue
492                 # extract the nodeid
493                 nodeid, values = values[0], values[1:]
494                 found[nodeid] = 1
496                 # confirm correct weight
497                 if len(idlessprops) != len(values):
498                     w(_('Not enough values on line %(line)s'%{'line':line}))
499                     return
501                 # extract the new values
502                 d = {}
503                 for name, value in zip(idlessprops, values):
504                     d[name] = value.strip()
506                 # perform the edit
507                 if cl.hasnode(nodeid):
508                     # edit existing
509                     cl.set(nodeid, **d)
510                 else:
511                     # new node
512                     found[cl.create(**d)] = 1
514             # retire the removed entries
515             for nodeid in cl.list():
516                 if not found.has_key(nodeid):
517                     cl.retire(nodeid)
519         w(_('''<p class="form-help">You may edit the contents of the
520         "%(classname)s" class using this form. The lines are full-featured
521         Comma-Separated-Value lines, so you may include commas and even
522         newlines by enclosing the values in double-quotes ("). Double
523         quotes themselves must be quoted by doubling ("").</p>
524         <p class="form-help">Remove entries by deleting their line. Add
525         new entries by appending
526         them to the table - put an X in the id column.</p>''')%{'classname':cn})
528         l = []
529         for name in props:
530             l.append(name)
531         w('<tt>')
532         w(', '.join(l) + '\n')
533         w('</tt>')
535         w('<form onSubmit="return submit_once()" method="POST">')
536         w('<textarea name="rows" cols=80 rows=15>')
537         p = csv.parser()
538         for nodeid in cl.list():
539             l = []
540             for name in props:
541                 l.append(cgi.escape(str(cl.get(nodeid, name))))
542             w(p.join(l) + '\n')
544         w(_('</textarea><br><input type="submit" value="Save Changes"></form>'))
546     def classhelp(self):
547         '''Display a table of class info
548         '''
549         w = self.write
550         cn = self.form['classname'].value
551         cl = self.db.classes[cn]
552         props = self.form['properties'].value.split(',')
554         w('<table border=1 cellspacing=0 cellpaddin=2>')
555         w('<tr>')
556         for name in props:
557             w('<th align=left>%s</th>'%name)
558         w('</tr>')
559         for nodeid in cl.list():
560             w('<tr>')
561             for name in props:
562                 value = cgi.escape(str(cl.get(nodeid, name)))
563                 w('<td align="left" valign="top">%s</td>'%value)
564             w('</tr>')
565         w('</table>')
567     def shownode(self, message=None, num_re=re.compile('^\d+$')):
568         ''' display an item
569         '''
570         cn = self.classname
571         cl = self.db.classes[cn]
572         if self.form.has_key(':multilink'):
573             link = self.form[':multilink'].value
574             designator, linkprop = link.split(':')
575             xtra = ' for <a href="%s">%s</a>' % (designator, designator)
576         else:
577             xtra = ''
579         # possibly perform an edit
580         keys = self.form.keys()
581         # don't try to set properties if the user has just logged in
582         if keys and not self.form.has_key('__login_name'):
583             try:
584                 props = parsePropsFromForm(self.db, cl, self.form, self.nodeid)
585                 # make changes to the node
586                 self._changenode(props)
587                 # handle linked nodes 
588                 self._post_editnode(self.nodeid)
589                 # and some nice feedback for the user
590                 if props:
591                     message = _('%(changes)s edited ok')%{'changes':
592                         ', '.join(props.keys())}
593                 elif self.form.has_key('__note') and self.form['__note'].value:
594                     message = _('note added')
595                 elif (self.form.has_key('__file') and
596                         self.form['__file'].filename):
597                     message = _('file added')
598                 else:
599                     message = _('nothing changed')
600             except:
601                 self.db.rollback()
602                 s = StringIO.StringIO()
603                 traceback.print_exc(None, s)
604                 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
606         # now the display
607         id = self.nodeid
608         if cl.getkey():
609             id = cl.get(id, cl.getkey())
610         self.pagehead('%s: %s %s'%(self.classname.capitalize(), id, xtra), message)
612         nodeid = self.nodeid
614         # use the template to display the item
615         item = htmltemplate.ItemTemplate(self, self.instance.TEMPLATES,
616             self.classname)
617         item.render(nodeid)
619         self.pagefoot()
620     showissue = shownode
621     showmsg = shownode
622     searchissue = searchnode
624     def _changenode(self, props):
625         ''' change the node based on the contents of the form
626         '''
627         cl = self.db.classes[self.classname]
629         # create the message
630         message, files = self._handle_message()
631         if message:
632             props['messages'] = cl.get(self.nodeid, 'messages') + [message]
633         if files:
634             props['files'] = cl.get(self.nodeid, 'files') + files
636         # make the changes
637         cl.set(self.nodeid, **props)
639     def _createnode(self):
640         ''' create a node based on the contents of the form
641         '''
642         cl = self.db.classes[self.classname]
643         props = parsePropsFromForm(self.db, cl, self.form)
645         # check for messages and files
646         message, files = self._handle_message()
647         if message:
648             props['messages'] = [message]
649         if files:
650             props['files'] = files
651         # create the node and return it's id
652         return cl.create(**props)
654     def _handle_message(self):
655         ''' generate an edit message
656         '''
657         # handle file attachments 
658         files = []
659         if self.form.has_key('__file'):
660             file = self.form['__file']
661             if file.filename:
662                 filename = file.filename.split('\\')[-1]
663                 mime_type = mimetypes.guess_type(filename)[0]
664                 if not mime_type:
665                     mime_type = "application/octet-stream"
666                 # create the new file entry
667                 files.append(self.db.file.create(type=mime_type,
668                     name=filename, content=file.file.read()))
670         # we don't want to do a message if none of the following is true...
671         cn = self.classname
672         cl = self.db.classes[self.classname]
673         props = cl.getprops()
674         note = None
675         # in a nutshell, don't do anything if there's no note or there's no
676         # NOSY
677         if self.form.has_key('__note'):
678             note = self.form['__note'].value.strip()
679         if not note:
680             return None, files
681         if not props.has_key('messages'):
682             return None, files
683         if not isinstance(props['messages'], hyperdb.Multilink):
684             return None, files
685         if not props['messages'].classname == 'msg':
686             return None, files
687         if not (self.form.has_key('nosy') or note):
688             return None, files
690         # handle the note
691         if '\n' in note:
692             summary = re.split(r'\n\r?', note)[0]
693         else:
694             summary = note
695         m = ['%s\n'%note]
697         # handle the messageid
698         # TODO: handle inreplyto
699         messageid = "<%s.%s.%s@%s>"%(time.time(), random.random(),
700             self.classname, self.instance.MAIL_DOMAIN)
702         # now create the message, attaching the files
703         content = '\n'.join(m)
704         message_id = self.db.msg.create(author=self.getuid(),
705             recipients=[], date=date.Date('.'), summary=summary,
706             content=content, files=files, messageid=messageid)
708         # update the messages property
709         return message_id, files
711     def _post_editnode(self, nid):
712         '''Do the linking part of the node creation.
714            If a form element has :link or :multilink appended to it, its
715            value specifies a node designator and the property on that node
716            to add _this_ node to as a link or multilink.
718            This is typically used on, eg. the file upload page to indicated
719            which issue to link the file to.
721            TODO: I suspect that this and newfile will go away now that
722            there's the ability to upload a file using the issue __file form
723            element!
724         '''
725         cn = self.classname
726         cl = self.db.classes[cn]
727         # link if necessary
728         keys = self.form.keys()
729         for key in keys:
730             if key == ':multilink':
731                 value = self.form[key].value
732                 if type(value) != type([]): value = [value]
733                 for value in value:
734                     designator, property = value.split(':')
735                     link, nodeid = roundupdb.splitDesignator(designator)
736                     link = self.db.classes[link]
737                     # take a dupe of the list so we're not changing the cache
738                     value = link.get(nodeid, property)[:]
739                     value.append(nid)
740                     link.set(nodeid, **{property: value})
741             elif key == ':link':
742                 value = self.form[key].value
743                 if type(value) != type([]): value = [value]
744                 for value in value:
745                     designator, property = value.split(':')
746                     link, nodeid = roundupdb.splitDesignator(designator)
747                     link = self.db.classes[link]
748                     link.set(nodeid, **{property: nid})
750     def newnode(self, message=None):
751         ''' Add a new node to the database.
752         
753         The form works in two modes: blank form and submission (that is,
754         the submission goes to the same URL). **Eventually this means that
755         the form will have previously entered information in it if
756         submission fails.
758         The new node will be created with the properties specified in the
759         form submission. For multilinks, multiple form entries are handled,
760         as are prop=value,value,value. You can't mix them though.
762         If the new node is to be referenced from somewhere else immediately
763         (ie. the new node is a file that is to be attached to a support
764         issue) then supply one of these arguments in addition to the usual
765         form entries:
766             :link=designator:property
767             :multilink=designator:property
768         ... which means that once the new node is created, the "property"
769         on the node given by "designator" should now reference the new
770         node's id. The node id will be appended to the multilink.
771         '''
772         cn = self.classname
773         cl = self.db.classes[cn]
774         if self.form.has_key(':multilink'):
775             link = self.form[':multilink'].value
776             designator, linkprop = link.split(':')
777             xtra = ' for <a href="%s">%s</a>' % (designator, designator)
778         else:
779             xtra = ''
781         # possibly perform a create
782         keys = self.form.keys()
783         if [i for i in keys if i[0] != ':']:
784             props = {}
785             try:
786                 nid = self._createnode()
787                 # handle linked nodes 
788                 self._post_editnode(nid)
789                 # and some nice feedback for the user
790                 message = _('%(classname)s created ok')%{'classname': cn}
792                 # render the newly created issue
793                 self.db.commit()
794                 self.nodeid = nid
795                 self.pagehead('%s: %s'%(self.classname.capitalize(), nid),
796                     message)
797                 item = htmltemplate.ItemTemplate(self, self.instance.TEMPLATES, 
798                     self.classname)
799                 item.render(nid)
800                 self.pagefoot()
801                 return
802             except:
803                 self.db.rollback()
804                 s = StringIO.StringIO()
805                 traceback.print_exc(None, s)
806                 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
807         self.pagehead(_('New %(classname)s %(xtra)s')%{
808                 'classname': self.classname.capitalize(),
809                 'xtra': xtra }, message)
811         # call the template
812         newitem = htmltemplate.NewItemTemplate(self, self.instance.TEMPLATES,
813             self.classname)
814         newitem.render(self.form)
816         self.pagefoot()
817     newissue = newnode
819     def newuser(self, message=None):
820         ''' Add a new user to the database.
822             Don't do any of the message or file handling, just create the node.
823         '''
824         cn = self.classname
825         cl = self.db.classes[cn]
827         # possibly perform a create
828         keys = self.form.keys()
829         if [i for i in keys if i[0] != ':']:
830             try:
831                 props = parsePropsFromForm(self.db, cl, self.form)
832                 nid = cl.create(**props)
833                 # handle linked nodes 
834                 self._post_editnode(nid)
835                 # and some nice feedback for the user
836                 message = _('%(classname)s created ok')%{'classname': cn}
837             except:
838                 self.db.rollback()
839                 s = StringIO.StringIO()
840                 traceback.print_exc(None, s)
841                 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
842         self.pagehead(_('New %(classname)s')%{'classname':
843              self.classname.capitalize()}, message)
845         # call the template
846         newitem = htmltemplate.NewItemTemplate(self, self.instance.TEMPLATES,
847             self.classname)
848         newitem.render(self.form)
850         self.pagefoot()
852     def newfile(self, message=None):
853         ''' Add a new file to the database.
854         
855         This form works very much the same way as newnode - it just has a
856         file upload.
857         '''
858         cn = self.classname
859         cl = self.db.classes[cn]
860         props = parsePropsFromForm(self.db, cl, self.form)
861         if self.form.has_key(':multilink'):
862             link = self.form[':multilink'].value
863             designator, linkprop = link.split(':')
864             xtra = ' for <a href="%s">%s</a>' % (designator, designator)
865         else:
866             xtra = ''
868         # possibly perform a create
869         keys = self.form.keys()
870         if [i for i in keys if i[0] != ':']:
871             try:
872                 file = self.form['content']
873                 mime_type = mimetypes.guess_type(file.filename)[0]
874                 if not mime_type:
875                     mime_type = "application/octet-stream"
876                 # save the file
877                 props['type'] = mime_type
878                 props['name'] = file.filename
879                 props['content'] = file.file.read()
880                 nid = cl.create(**props)
881                 # handle linked nodes
882                 self._post_editnode(nid)
883                 # and some nice feedback for the user
884                 message = _('%(classname)s created ok')%{'classname': cn}
885             except:
886                 self.db.rollback()
887                 s = StringIO.StringIO()
888                 traceback.print_exc(None, s)
889                 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
891         self.pagehead(_('New %(classname)s %(xtra)s')%{
892                 'classname': self.classname.capitalize(),
893                 'xtra': xtra }, message)
894         newitem = htmltemplate.NewItemTemplate(self, self.instance.TEMPLATES,
895             self.classname)
896         newitem.render(self.form)
897         self.pagefoot()
899     def showuser(self, message=None, num_re=re.compile('^\d+$')):
900         '''Display a user page for editing. Make sure the user is allowed
901             to edit this node, and also check for password changes.
902         '''
903         if self.user == 'anonymous':
904             raise Unauthorised
906         user = self.db.user
908         # get the username of the node being edited
909         node_user = user.get(self.nodeid, 'username')
911         if self.user not in ('admin', node_user):
912             raise Unauthorised
914         #
915         # perform any editing
916         #
917         keys = self.form.keys()
918         if keys:
919             try:
920                 props = parsePropsFromForm(self.db, user, self.form,
921                     self.nodeid)
922                 set_cookie = 0
923                 if props.has_key('password'):
924                     password = self.form['password'].value.strip()
925                     if not password:
926                         # no password was supplied - don't change it
927                         del props['password']
928                     elif self.nodeid == self.getuid():
929                         # this is the logged-in user's password
930                         set_cookie = password
931                 user.set(self.nodeid, **props)
932                 # and some feedback for the user
933                 message = _('%(changes)s edited ok')%{'changes':
934                     ', '.join(props.keys())}
935             except:
936                 self.db.rollback()
937                 s = StringIO.StringIO()
938                 traceback.print_exc(None, s)
939                 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
940         else:
941             set_cookie = 0
943         # fix the cookie if the password has changed
944         if set_cookie:
945             self.set_cookie(self.user, set_cookie)
947         #
948         # now the display
949         #
950         self.pagehead(_('User: %(user)s')%{'user': node_user}, message)
952         # use the template to display the item
953         item = htmltemplate.ItemTemplate(self, self.instance.TEMPLATES, 'user')
954         item.render(self.nodeid)
955         self.pagefoot()
957     def showfile(self):
958         ''' display a file
959         '''
960         nodeid = self.nodeid
961         cl = self.db.classes[self.classname]
962         mime_type = cl.get(nodeid, 'type')
963         if mime_type == 'message/rfc822':
964             mime_type = 'text/plain'
965         self.header(headers={'Content-Type': mime_type})
966         self.write(cl.get(nodeid, 'content'))
968     def classes(self, message=None):
969         ''' display a list of all the classes in the database
970         '''
971         if self.user == 'admin':
972             self.pagehead(_('Table of classes'), message)
973             classnames = self.db.classes.keys()
974             classnames.sort()
975             self.write('<table border=0 cellspacing=0 cellpadding=2>\n')
976             for cn in classnames:
977                 cl = self.db.getclass(cn)
978                 self.write('<tr class="list-header"><th colspan=2 align=left>'
979                     '<a href="%s">%s</a></th></tr>'%(cn, cn.capitalize()))
980                 for key, value in cl.properties.items():
981                     if value is None: value = ''
982                     else: value = str(value)
983                     self.write('<tr><th align=left>%s</th><td>%s</td></tr>'%(
984                         key, cgi.escape(value)))
985             self.write('</table>')
986             self.pagefoot()
987         else:
988             raise Unauthorised
990     def login(self, message=None, newuser_form=None, action='index'):
991         '''Display a login page.
992         '''
993         self.pagehead(_('Login to roundup'), message)
994         self.write(_('''
995 <table>
996 <tr><td colspan=2 class="strong-header">Existing User Login</td></tr>
997 <form onSubmit="return submit_once()" action="login_action" method=POST>
998 <input type="hidden" name="__destination_url" value="%(action)s">
999 <tr><td align=right>Login name: </td>
1000     <td><input name="__login_name"></td></tr>
1001 <tr><td align=right>Password: </td>
1002     <td><input type="password" name="__login_password"></td></tr>
1003 <tr><td></td>
1004     <td><input type="submit" value="Log In"></td></tr>
1005 </form>
1006 ''')%locals())
1007         if self.user is None and self.instance.ANONYMOUS_REGISTER == 'deny':
1008             self.write('</table>')
1009             self.pagefoot()
1010             return
1011         values = {'realname': '', 'organisation': '', 'address': '',
1012             'phone': '', 'username': '', 'password': '', 'confirm': '',
1013             'action': action, 'alternate_addresses': ''}
1014         if newuser_form is not None:
1015             for key in newuser_form.keys():
1016                 values[key] = newuser_form[key].value
1017         self.write(_('''
1018 <p>
1019 <tr><td colspan=2 class="strong-header">New User Registration</td></tr>
1020 <tr><td colspan=2><em>marked items</em> are optional...</td></tr>
1021 <form onSubmit="return submit_once()" action="newuser_action" method=POST>
1022 <input type="hidden" name="__destination_url" value="%(action)s">
1023 <tr><td align=right><em>Name: </em></td>
1024     <td><input name="realname" value="%(realname)s" size=40></td></tr>
1025 <tr><td align=right><em>Organisation: </em></td>
1026     <td><input name="organisation" value="%(organisation)s" size=40></td></tr>
1027 <tr><td align=right>E-Mail Address: </td>
1028     <td><input name="address" value="%(address)s" size=40></td></tr>
1029 <tr><td align=right><em>Alternate E-mail Addresses: </em></td>
1030     <td><textarea name="alternate_addresses" rows=5 cols=40>%(alternate_addresses)s</textarea></td></tr>
1031 <tr><td align=right><em>Phone: </em></td>
1032     <td><input name="phone" value="%(phone)s"></td></tr>
1033 <tr><td align=right>Preferred Login name: </td>
1034     <td><input name="username" value="%(username)s"></td></tr>
1035 <tr><td align=right>Password: </td>
1036     <td><input type="password" name="password" value="%(password)s"></td></tr>
1037 <tr><td align=right>Password Again: </td>
1038     <td><input type="password" name="confirm" value="%(confirm)s"></td></tr>
1039 <tr><td></td>
1040     <td><input type="submit" value="Register"></td></tr>
1041 </form>
1042 </table>
1043 ''')%values)
1044         self.pagefoot()
1046     def login_action(self, message=None):
1047         '''Attempt to log a user in and set the cookie
1049         returns 0 if a page is generated as a result of this call, and
1050         1 if not (ie. the login is successful
1051         '''
1052         if not self.form.has_key('__login_name'):
1053             self.login(message=_('Username required'))
1054             return 0
1055         self.user = self.form['__login_name'].value
1056         if self.form.has_key('__login_password'):
1057             password = self.form['__login_password'].value
1058         else:
1059             password = ''
1060         # make sure the user exists
1061         try:
1062             uid = self.db.user.lookup(self.user)
1063         except KeyError:
1064             name = self.user
1065             self.make_user_anonymous()
1066             action = self.form['__destination_url'].value
1067             self.login(message=_('No such user "%(name)s"')%locals(),
1068                 action=action)
1069             return 0
1071         # and that the password is correct
1072         pw = self.db.user.get(uid, 'password')
1073         if password != pw:
1074             self.make_user_anonymous()
1075             action = self.form['__destination_url'].value
1076             self.login(message=_('Incorrect password'), action=action)
1077             return 0
1079         self.set_cookie(self.user, password)
1080         return 1
1082     def newuser_action(self, message=None):
1083         '''Attempt to create a new user based on the contents of the form
1084         and then set the cookie.
1086         return 1 on successful login
1087         '''
1088         # re-open the database as "admin"
1089         self.db = self.instance.open('admin')
1091         # TODO: pre-check the required fields and username key property
1092         cl = self.db.user
1093         try:
1094             props = parsePropsFromForm(self.db, cl, self.form)
1095             uid = cl.create(**props)
1096         except ValueError, message:
1097             action = self.form['__destination_url'].value
1098             self.login(message, action=action)
1099             return 0
1100         self.user = cl.get(uid, 'username')
1101         password = cl.get(uid, 'password')
1102         self.set_cookie(self.user, self.form['password'].value)
1103         return 1
1105     def set_cookie(self, user, password):
1106         # construct the cookie
1107         user = binascii.b2a_base64('%s:%s'%(user, password)).strip()
1108         if user[-1] == '=':
1109           if user[-2] == '=':
1110             user = user[:-2]
1111           else:
1112             user = user[:-1]
1113         expire = Cookie._getdate(86400*365)
1114         path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME']))
1115         self.header({'Set-Cookie': 'roundup_user=%s; expires=%s; Path=%s;' % (
1116             user, expire, path)})
1118     def make_user_anonymous(self):
1119         # make us anonymous if we can
1120         try:
1121             self.db.user.lookup('anonymous')
1122             self.user = 'anonymous'
1123         except KeyError:
1124             self.user = None
1126     def logout(self, message=None):
1127         self.make_user_anonymous()
1128         # construct the logout cookie
1129         now = Cookie._getdate()
1130         path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME']))
1131         self.header({'Set-Cookie':
1132             'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now,
1133             path)})
1134         self.login()
1136     def main(self):
1137         '''Wrap the database accesses so we can close the database cleanly
1138         '''
1139         # determine the uid to use
1140         self.db = self.instance.open('admin')
1141         cookie = Cookie.Cookie(self.env.get('HTTP_COOKIE', ''))
1142         user = 'anonymous'
1143         if (cookie.has_key('roundup_user') and
1144                 cookie['roundup_user'].value != 'deleted'):
1145             cookie = cookie['roundup_user'].value
1146             if len(cookie)%4:
1147               cookie = cookie + '='*(4-len(cookie)%4)
1148             try:
1149                 user, password = binascii.a2b_base64(cookie).split(':')
1150             except (TypeError, binascii.Error, binascii.Incomplete):
1151                 # damaged cookie!
1152                 user, password = 'anonymous', ''
1154             # make sure the user exists
1155             try:
1156                 uid = self.db.user.lookup(user)
1157                 # now validate the password
1158                 if password != self.db.user.get(uid, 'password'):
1159                     user = 'anonymous'
1160             except KeyError:
1161                 user = 'anonymous'
1163         # make sure the anonymous user is valid if we're using it
1164         if user == 'anonymous':
1165             self.make_user_anonymous()
1166         else:
1167             self.user = user
1169         # re-open the database for real, using the user
1170         self.db = self.instance.open(self.user)
1172         # now figure which function to call
1173         path = self.split_path
1175         # default action to index if the path has no information in it
1176         if not path or path[0] in ('', 'index'):
1177             action = 'index'
1178         else:
1179             action = path[0]
1181         # Everthing ignores path[1:]
1182         #  - The file download link generator actually relies on this - it
1183         #    appends the name of the file to the URL so the download file name
1184         #    is correct, but doesn't actually use it.
1186         # everyone is allowed to try to log in
1187         if action == 'login_action':
1188             # try to login
1189             if not self.login_action():
1190                 return
1191             # figure the resulting page
1192             action = self.form['__destination_url'].value
1193             if not action:
1194                 action = 'index'
1195             self.do_action(action)
1196             return
1198         # allow anonymous people to register
1199         if action == 'newuser_action':
1200             # if we don't have a login and anonymous people aren't allowed to
1201             # register, then spit up the login form
1202             if self.instance.ANONYMOUS_REGISTER == 'deny' and self.user is None:
1203                 if action == 'login':
1204                     self.login()         # go to the index after login
1205                 else:
1206                     self.login(action=action)
1207                 return
1208             # try to add the user
1209             if not self.newuser_action():
1210                 return
1211             # figure the resulting page
1212             action = self.form['__destination_url'].value
1213             if not action:
1214                 action = 'index'
1216         # no login or registration, make sure totally anonymous access is OK
1217         elif self.instance.ANONYMOUS_ACCESS == 'deny' and self.user is None:
1218             if action == 'login':
1219                 self.login()             # go to the index after login
1220             else:
1221                 self.login(action=action)
1222             return
1224         # just a regular action
1225         self.do_action(action)
1227         # commit all changes to the database
1228         self.db.commit()
1230     def do_action(self, action, dre=re.compile(r'([^\d]+)(\d+)'),
1231             nre=re.compile(r'new(\w+)'), sre=re.compile(r'search(\w+)')):
1232         '''Figure the user's action and do it.
1233         '''
1234         # here be the "normal" functionality
1235         if action == 'index':
1236             self.index()
1237             return
1238         if action == 'list_classes':
1239             self.classes()
1240             return
1241         if action == 'classhelp':
1242             self.classhelp()
1243             return
1244         if action == 'login':
1245             self.login()
1246             return
1247         if action == 'logout':
1248             self.logout()
1249             return
1251         # see if we're to display an existing node
1252         m = dre.match(action)
1253         if m:
1254             self.classname = m.group(1)
1255             self.nodeid = m.group(2)
1256             try:
1257                 cl = self.db.classes[self.classname]
1258             except KeyError:
1259                 raise NotFound, self.classname
1260             try:
1261                 cl.get(self.nodeid, 'id')
1262             except IndexError:
1263                 raise NotFound, self.nodeid
1264             try:
1265                 func = getattr(self, 'show%s'%self.classname)
1266             except AttributeError:
1267                 raise NotFound, 'show%s'%self.classname
1268             func()
1269             return
1271         # see if we're to put up the new node page
1272         m = nre.match(action)
1273         if m:
1274             self.classname = m.group(1)
1275             try:
1276                 func = getattr(self, 'new%s'%self.classname)
1277             except AttributeError:
1278                 raise NotFound, 'new%s'%self.classname
1279             func()
1280             return
1282         # see if we're to put up the new node page
1283         m = sre.match(action)
1284         if m:
1285             self.classname = m.group(1)
1286             try:
1287                 func = getattr(self, 'search%s'%self.classname)
1288             except AttributeError:
1289                 raise NotFound
1290             func()
1291             return
1293         # otherwise, display the named class
1294         self.classname = action
1295         try:
1296             self.db.getclass(self.classname)
1297         except KeyError:
1298             raise NotFound, self.classname
1299         self.list()
1302 class ExtendedClient(Client): 
1303     '''Includes pages and page heading information that relate to the
1304        extended schema.
1305     ''' 
1306     showsupport = Client.shownode
1307     showtimelog = Client.shownode
1308     newsupport = Client.newnode
1309     newtimelog = Client.newnode
1310     searchsupport = Client.searchnode
1312     default_index_sort = ['-activity']
1313     default_index_group = ['priority']
1314     default_index_filter = ['status']
1315     default_index_columns = ['activity','status','title','assignedto']
1316     default_index_filterspec = {'status': ['1', '2', '3', '4', '5', '6', '7']}
1318 def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')):
1319     '''Pull properties for the given class out of the form.
1320     '''
1321     props = {}
1322     keys = form.keys()
1323     for key in keys:
1324         if not cl.properties.has_key(key):
1325             continue
1326         proptype = cl.properties[key]
1327         if isinstance(proptype, hyperdb.String):
1328             value = form[key].value.strip()
1329         elif isinstance(proptype, hyperdb.Password):
1330             value = password.Password(form[key].value.strip())
1331         elif isinstance(proptype, hyperdb.Date):
1332             value = form[key].value.strip()
1333             if value:
1334                 value = date.Date(form[key].value.strip())
1335             else:
1336                 value = None
1337         elif isinstance(proptype, hyperdb.Interval):
1338             value = form[key].value.strip()
1339             if value:
1340                 value = date.Interval(form[key].value.strip())
1341             else:
1342                 value = None
1343         elif isinstance(proptype, hyperdb.Link):
1344             value = form[key].value.strip()
1345             # see if it's the "no selection" choice
1346             if value == '-1':
1347                 # don't set this property
1348                 continue
1349             else:
1350                 # handle key values
1351                 link = cl.properties[key].classname
1352                 if not num_re.match(value):
1353                     try:
1354                         value = db.classes[link].lookup(value)
1355                     except KeyError:
1356                         raise ValueError, _('property "%(propname)s": '
1357                             '%(value)s not a %(classname)s')%{'propname':key, 
1358                             'value': value, 'classname': link}
1359         elif isinstance(proptype, hyperdb.Multilink):
1360             value = form[key]
1361             if type(value) != type([]):
1362                 value = [i.strip() for i in value.value.split(',')]
1363             else:
1364                 value = [i.value.strip() for i in value]
1365             link = cl.properties[key].classname
1366             l = []
1367             for entry in map(str, value):
1368                 if entry == '': continue
1369                 if not num_re.match(entry):
1370                     try:
1371                         entry = db.classes[link].lookup(entry)
1372                     except KeyError:
1373                         raise ValueError, _('property "%(propname)s": '
1374                             '"%(value)s" not an entry of %(classname)s')%{
1375                             'propname':key, 'value': entry, 'classname': link}
1376                 l.append(entry)
1377             l.sort()
1378             value = l
1380         # get the old value
1381         if nodeid:
1382             try:
1383                 existing = cl.get(nodeid, key)
1384             except KeyError:
1385                 # this might be a new property for which there is no existing
1386                 # value
1387                 if not cl.properties.has_key(key): raise
1389             # if changed, set it
1390             if value != existing:
1391                 props[key] = value
1392         else:
1393             props[key] = value
1394     return props
1397 # $Log: not supported by cvs2svn $
1398 # Revision 1.131  2002/07/08 06:53:57  richard
1399 # Not sure why the cgi_client had an indexer argument.
1401 # Revision 1.130  2002/06/27 12:01:53  gmcm
1402 # If the form has a :multilink, put a back href in the pageheader (back to the linked-to node).
1403 # Some minor optimizations (only compile regexes once).
1405 # Revision 1.129  2002/06/20 23:52:11  richard
1406 # Better handling of unauth attempt to edit stuff
1408 # Revision 1.128  2002/06/12 21:28:25  gmcm
1409 # Allow form to set user-properties on a Fileclass.
1410 # Don't assume that a Fileclass is named "files".
1412 # Revision 1.127  2002/06/11 06:38:24  richard
1413 #  . #565996 ] The "Attach a File to this Issue" fails
1415 # Revision 1.126  2002/05/29 01:16:17  richard
1416 # Sorry about this huge checkin! It's fixing a lot of related stuff in one go
1417 # though.
1419 # . #541941 ] changing multilink properties by mail
1420 # . #526730 ] search for messages capability
1421 # . #505180 ] split MailGW.handle_Message
1422 #   - also changed cgi client since it was duplicating the functionality
1423 # . build htmlbase if tests are run using CVS checkout (removed note from
1424 #   installation.txt)
1425 # . don't create an empty message on email issue creation if the email is empty
1427 # Revision 1.125  2002/05/25 07:16:24  rochecompaan
1428 # Merged search_indexing-branch with HEAD
1430 # Revision 1.124  2002/05/24 02:09:24  richard
1431 # Nothing like a live demo to show up the bugs ;)
1433 # Revision 1.123  2002/05/22 05:04:13  richard
1434 # Oops
1436 # Revision 1.122  2002/05/22 04:12:05  richard
1437 #  . applied patch #558876 ] cgi client customization
1438 #    ... with significant additions and modifications ;)
1439 #    - extended handling of ML assignedto to all places it's handled
1440 #    - added more NotFound info
1442 # Revision 1.121  2002/05/21 06:08:10  richard
1443 # Handle migration
1445 # Revision 1.120  2002/05/21 06:05:53  richard
1446 #  . #551483 ] assignedto in Client.make_index_link
1448 # Revision 1.119  2002/05/15 06:21:21  richard
1449 #  . node caching now works, and gives a small boost in performance
1451 # As a part of this, I cleaned up the DEBUG output and implemented TRACE
1452 # output (HYPERDBTRACE='file to trace to') with checkpoints at the start of
1453 # CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff
1454 # (using if __debug__ which is compiled out with -O)
1456 # Revision 1.118  2002/05/12 23:46:33  richard
1457 # ehem, part 2
1459 # Revision 1.117  2002/05/12 23:42:29  richard
1460 # ehem
1462 # Revision 1.116  2002/05/02 08:07:49  richard
1463 # Added the ADD_AUTHOR_TO_NOSY handling to the CGI interface.
1465 # Revision 1.115  2002/04/02 01:56:10  richard
1466 #  . stop sending blank (whitespace-only) notes
1468 # Revision 1.114.2.4  2002/05/02 11:49:18  rochecompaan
1469 # Allow customization of the search filters that should be displayed
1470 # on the search page.
1472 # Revision 1.114.2.3  2002/04/20 13:23:31  rochecompaan
1473 # We now have a separate search page for nodes.  Search links for
1474 # different classes can be customized in instance_config similar to
1475 # index links.
1477 # Revision 1.114.2.2  2002/04/19 19:54:42  rochecompaan
1478 # cgi_client.py
1479 #     removed search link for the time being
1480 #     moved rendering of matches to htmltemplate
1481 # hyperdb.py
1482 #     filtering of nodes on full text search incorporated in filter method
1483 # roundupdb.py
1484 #     added paramater to call of filter method
1485 # roundup_indexer.py
1486 #     added search method to RoundupIndexer class
1488 # Revision 1.114.2.1  2002/04/03 11:55:57  rochecompaan
1489 #  . Added feature #526730 - search for messages capability
1491 # Revision 1.114  2002/03/17 23:06:05  richard
1492 # oops
1494 # Revision 1.113  2002/03/14 23:59:24  richard
1495 #  . #517734 ] web header customisation is obscure
1497 # Revision 1.112  2002/03/12 22:52:26  richard
1498 # more pychecker warnings removed
1500 # Revision 1.111  2002/02/25 04:32:21  richard
1501 # ahem
1503 # Revision 1.110  2002/02/21 07:19:08  richard
1504 # ... and label, width and height control for extra flavour!
1506 # Revision 1.109  2002/02/21 07:08:19  richard
1507 # oops
1509 # Revision 1.108  2002/02/21 07:02:54  richard
1510 # The correct var is "HTTP_HOST"
1512 # Revision 1.107  2002/02/21 06:57:38  richard
1513 #  . Added popup help for classes using the classhelp html template function.
1514 #    - add <display call="classhelp('priority', 'id,name,description')">
1515 #      to an item page, and it generates a link to a popup window which displays
1516 #      the id, name and description for the priority class. The description
1517 #      field won't exist in most installations, but it will be added to the
1518 #      default templates.
1520 # Revision 1.106  2002/02/21 06:23:00  richard
1521 # *** empty log message ***
1523 # Revision 1.105  2002/02/20 05:52:10  richard
1524 # better error handling
1526 # Revision 1.104  2002/02/20 05:45:17  richard
1527 # Use the csv module for generating the form entry so it's correct.
1528 # [also noted the sf.net feature request id in the change log]
1530 # Revision 1.103  2002/02/20 05:05:28  richard
1531 #  . Added simple editing for classes that don't define a templated interface.
1532 #    - access using the admin "class list" interface
1533 #    - limited to admin-only
1534 #    - requires the csv module from object-craft (url given if it's missing)
1536 # Revision 1.102  2002/02/15 07:08:44  richard
1537 #  . Alternate email addresses are now available for users. See the MIGRATION
1538 #    file for info on how to activate the feature.
1540 # Revision 1.101  2002/02/14 23:39:18  richard
1541 # . All forms now have "double-submit" protection when Javascript is enabled
1542 #   on the client-side.
1544 # Revision 1.100  2002/01/16 07:02:57  richard
1545 #  . lots of date/interval related changes:
1546 #    - more relaxed date format for input
1548 # Revision 1.99  2002/01/16 03:02:42  richard
1549 # #503793 ] changing assignedto resets nosy list
1551 # Revision 1.98  2002/01/14 02:20:14  richard
1552 #  . changed all config accesses so they access either the instance or the
1553 #    config attriubute on the db. This means that all config is obtained from
1554 #    instance_config instead of the mish-mash of classes. This will make
1555 #    switching to a ConfigParser setup easier too, I hope.
1557 # At a minimum, this makes migration a _little_ easier (a lot easier in the
1558 # 0.5.0 switch, I hope!)
1560 # Revision 1.97  2002/01/11 23:22:29  richard
1561 #  . #502437 ] rogue reactor and unittest
1562 #    in short, the nosy reactor was modifying the nosy list. That code had
1563 #    been there for a long time, and I suspsect it was there because we
1564 #    weren't generating the nosy list correctly in other places of the code.
1565 #    We're now doing that, so the nosy-modifying code can go away from the
1566 #    nosy reactor.
1568 # Revision 1.96  2002/01/10 05:26:10  richard
1569 # missed a parsePropsFromForm in last update
1571 # Revision 1.95  2002/01/10 03:39:45  richard
1572 #  . fixed some problems with web editing and change detection
1574 # Revision 1.94  2002/01/09 13:54:21  grubert
1575 # _add_assignedto_to_nosy did set nosy to assignedto only, no adding.
1577 # Revision 1.93  2002/01/08 11:57:12  richard
1578 # crying out for real configuration handling... :(
1580 # Revision 1.92  2002/01/08 04:12:05  richard
1581 # Changed message-id format to "<%s.%s.%s%s@%s>" so it complies with RFC822
1583 # Revision 1.91  2002/01/08 04:03:47  richard
1584 # I mucked the intent of the code up.
1586 # Revision 1.90  2002/01/08 03:56:55  richard
1587 # Oops, missed this before the beta:
1588 #  . #495392 ] empty nosy -patch
1590 # Revision 1.89  2002/01/07 20:24:45  richard
1591 # *mutter* stupid cutnpaste
1593 # Revision 1.88  2002/01/02 02:31:38  richard
1594 # Sorry for the huge checkin message - I was only intending to implement #496356
1595 # but I found a number of places where things had been broken by transactions:
1596 #  . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
1597 #    for _all_ roundup-generated smtp messages to be sent to.
1598 #  . the transaction cache had broken the roundupdb.Class set() reactors
1599 #  . newly-created author users in the mailgw weren't being committed to the db
1601 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
1602 # on when I found that stuff :):
1603 #  . #496356 ] Use threading in messages
1604 #  . detectors were being registered multiple times
1605 #  . added tests for mailgw
1606 #  . much better attaching of erroneous messages in the mail gateway
1608 # Revision 1.87  2001/12/23 23:18:49  richard
1609 # We already had an admin-specific section of the web heading, no need to add
1610 # another one :)
1612 # Revision 1.86  2001/12/20 15:43:01  rochecompaan
1613 # Features added:
1614 #  .  Multilink properties are now displayed as comma separated values in
1615 #     a textbox
1616 #  .  The add user link is now only visible to the admin user
1617 #  .  Modified the mail gateway to reject submissions from unknown
1618 #     addresses if ANONYMOUS_ACCESS is denied
1620 # Revision 1.85  2001/12/20 06:13:24  rochecompaan
1621 # Bugs fixed:
1622 #   . Exception handling in hyperdb for strings-that-look-like numbers got
1623 #     lost somewhere
1624 #   . Internet Explorer submits full path for filename - we now strip away
1625 #     the path
1626 # Features added:
1627 #   . Link and multilink properties are now displayed sorted in the cgi
1628 #     interface
1630 # Revision 1.84  2001/12/18 15:30:30  rochecompaan
1631 # Fixed bugs:
1632 #  .  Fixed file creation and retrieval in same transaction in anydbm
1633 #     backend
1634 #  .  Cgi interface now renders new issue after issue creation
1635 #  .  Could not set issue status to resolved through cgi interface
1636 #  .  Mail gateway was changing status back to 'chatting' if status was
1637 #     omitted as an argument
1639 # Revision 1.83  2001/12/15 23:51:01  richard
1640 # Tested the changes and fixed a few problems:
1641 #  . files are now attached to the issue as well as the message
1642 #  . newuser is a real method now since we don't want to do the message/file
1643 #    stuff for it
1644 #  . added some documentation
1645 # The really big changes in the diff are a result of me moving some code
1646 # around to keep like methods together a bit better.
1648 # Revision 1.82  2001/12/15 19:24:39  rochecompaan
1649 #  . Modified cgi interface to change properties only once all changes are
1650 #    collected, files created and messages generated.
1651 #  . Moved generation of change note to nosyreactors.
1652 #  . We now check for changes to "assignedto" to ensure it's added to the
1653 #    nosy list.
1655 # Revision 1.81  2001/12/12 23:55:00  richard
1656 # Fixed some problems with user editing
1658 # Revision 1.80  2001/12/12 23:27:14  richard
1659 # Added a Zope frontend for roundup.
1661 # Revision 1.79  2001/12/10 22:20:01  richard
1662 # Enabled transaction support in the bsddb backend. It uses the anydbm code
1663 # where possible, only replacing methods where the db is opened (it uses the
1664 # btree opener specifically.)
1665 # Also cleaned up some change note generation.
1666 # Made the backends package work with pydoc too.
1668 # Revision 1.78  2001/12/07 05:59:27  rochecompaan
1669 # Fixed small bug that prevented adding issues through the web.
1671 # Revision 1.77  2001/12/06 22:48:29  richard
1672 # files multilink was being nuked in post_edit_node
1674 # Revision 1.76  2001/12/05 14:26:44  rochecompaan
1675 # Removed generation of change note from "sendmessage" in roundupdb.py.
1676 # The change note is now generated when the message is created.
1678 # Revision 1.75  2001/12/04 01:25:08  richard
1679 # Added some rollbacks where we were catching exceptions that would otherwise
1680 # have stopped committing.
1682 # Revision 1.74  2001/12/02 05:06:16  richard
1683 # . We now use weakrefs in the Classes to keep the database reference, so
1684 #   the close() method on the database is no longer needed.
1685 #   I bumped the minimum python requirement up to 2.1 accordingly.
1686 # . #487480 ] roundup-server
1687 # . #487476 ] INSTALL.txt
1689 # I also cleaned up the change message / post-edit stuff in the cgi client.
1690 # There's now a clearly marked "TODO: append the change note" where I believe
1691 # the change note should be added there. The "changes" list will obviously
1692 # have to be modified to be a dict of the changes, or somesuch.
1694 # More testing needed.
1696 # Revision 1.73  2001/12/01 07:17:50  richard
1697 # . We now have basic transaction support! Information is only written to
1698 #   the database when the commit() method is called. Only the anydbm
1699 #   backend is modified in this way - neither of the bsddb backends have been.
1700 #   The mail, admin and cgi interfaces all use commit (except the admin tool
1701 #   doesn't have a commit command, so interactive users can't commit...)
1702 # . Fixed login/registration forwarding the user to the right page (or not,
1703 #   on a failure)
1705 # Revision 1.72  2001/11/30 20:47:58  rochecompaan
1706 # Links in page header are now consistent with default sort order.
1708 # Fixed bugs:
1709 #     - When login failed the list of issues were still rendered.
1710 #     - User was redirected to index page and not to his destination url
1711 #       if his first login attempt failed.
1713 # Revision 1.71  2001/11/30 20:28:10  rochecompaan
1714 # Property changes are now completely traceable, whether changes are
1715 # made through the web or by email
1717 # Revision 1.70  2001/11/30 00:06:29  richard
1718 # Converted roundup/cgi_client.py to use _()
1719 # Added the status file, I18N_PROGRESS.txt
1721 # Revision 1.69  2001/11/29 23:19:51  richard
1722 # Removed the "This issue has been edited through the web" when a valid
1723 # change note is supplied.
1725 # Revision 1.68  2001/11/29 04:57:23  richard
1726 # a little comment
1728 # Revision 1.67  2001/11/28 21:55:35  richard
1729 #  . login_action and newuser_action return values were being ignored
1730 #  . Woohoo! Found that bloody re-login bug that was killing the mail
1731 #    gateway.
1732 #  (also a minor cleanup in hyperdb)
1734 # Revision 1.66  2001/11/27 03:00:50  richard
1735 # couple of bugfixes from latest patch integration
1737 # Revision 1.65  2001/11/26 23:00:53  richard
1738 # This config stuff is getting to be a real mess...
1740 # Revision 1.64  2001/11/26 22:56:35  richard
1741 # typo
1743 # Revision 1.63  2001/11/26 22:55:56  richard
1744 # Feature:
1745 #  . Added INSTANCE_NAME to configuration - used in web and email to identify
1746 #    the instance.
1747 #  . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
1748 #    signature info in e-mails.
1749 #  . Some more flexibility in the mail gateway and more error handling.
1750 #  . Login now takes you to the page you back to the were denied access to.
1752 # Fixed:
1753 #  . Lots of bugs, thanks Roché and others on the devel mailing list!
1755 # Revision 1.62  2001/11/24 00:45:42  jhermann
1756 # typeof() instead of type(): avoid clash with database field(?) "type"
1758 # Fixes this traceback:
1760 # Traceback (most recent call last):
1761 #   File "roundup\cgi_client.py", line 535, in newnode
1762 #     self._post_editnode(nid)
1763 #   File "roundup\cgi_client.py", line 415, in _post_editnode
1764 #     if type(value) != type([]): value = [value]
1765 # UnboundLocalError: local variable 'type' referenced before assignment
1767 # Revision 1.61  2001/11/22 15:46:42  jhermann
1768 # Added module docstrings to all modules.
1770 # Revision 1.60  2001/11/21 22:57:28  jhermann
1771 # Added dummy hooks for I18N and some preliminary (test) markup of
1772 # translatable messages
1774 # Revision 1.59  2001/11/21 03:21:13  richard
1775 # oops
1777 # Revision 1.58  2001/11/21 03:11:28  richard
1778 # Better handling of new properties.
1780 # Revision 1.57  2001/11/15 10:24:27  richard
1781 # handle the case where there is no file attached
1783 # Revision 1.56  2001/11/14 21:35:21  richard
1784 #  . users may attach files to issues (and support in ext) through the web now
1786 # Revision 1.55  2001/11/07 02:34:06  jhermann
1787 # Handling of damaged login cookies
1789 # Revision 1.54  2001/11/07 01:16:12  richard
1790 # Remove the '=' padding from cookie value so quoting isn't an issue.
1792 # Revision 1.53  2001/11/06 23:22:05  jhermann
1793 # More IE fixes: it does not like quotes around cookie values; in the
1794 # hope this does not break anything for other browser; if it does, we
1795 # need to check HTTP_USER_AGENT
1797 # Revision 1.52  2001/11/06 23:11:22  jhermann
1798 # Fixed debug output in page footer; added expiry date to the login cookie
1799 # (expires 1 year in the future) to prevent probs with certain versions
1800 # of IE
1802 # Revision 1.51  2001/11/06 22:00:34  jhermann
1803 # Get debug level from ROUNDUP_DEBUG env var
1805 # Revision 1.50  2001/11/05 23:45:40  richard
1806 # Fixed newuser_action so it sets the cookie with the unencrypted password.
1807 # Also made it present nicer error messages (not tracebacks).
1809 # Revision 1.49  2001/11/04 03:07:12  richard
1810 # Fixed various cookie-related bugs:
1811 #  . bug #477685 ] base64.decodestring breaks
1812 #  . bug #477837 ] lynx does not like the cookie
1813 #  . bug #477892 ] Password edit doesn't fix login cookie
1814 # Also closed a security hole - a logged-in user could edit another user's
1815 # details.
1817 # Revision 1.48  2001/11/03 01:30:18  richard
1818 # Oops. uses pagefoot now.
1820 # Revision 1.47  2001/11/03 01:29:28  richard
1821 # Login page didn't have all close tags.
1823 # Revision 1.46  2001/11/03 01:26:55  richard
1824 # possibly fix truncated base64'ed user:pass
1826 # Revision 1.45  2001/11/01 22:04:37  richard
1827 # Started work on supporting a pop3-fetching server
1828 # Fixed bugs:
1829 #  . bug #477104 ] HTML tag error in roundup-server
1830 #  . bug #477107 ] HTTP header problem
1832 # Revision 1.44  2001/10/28 23:03:08  richard
1833 # Added more useful header to the classic schema.
1835 # Revision 1.43  2001/10/24 00:01:42  richard
1836 # More fixes to lockout logic.
1838 # Revision 1.42  2001/10/23 23:56:03  richard
1839 # HTML typo
1841 # Revision 1.41  2001/10/23 23:52:35  richard
1842 # Fixed lock-out logic, thanks Roch'e for pointing out the problems.
1844 # Revision 1.40  2001/10/23 23:06:39  richard
1845 # Some cleanup.
1847 # Revision 1.39  2001/10/23 01:00:18  richard
1848 # Re-enabled login and registration access after lopping them off via
1849 # disabling access for anonymous users.
1850 # Major re-org of the htmltemplate code, cleaning it up significantly. Fixed
1851 # a couple of bugs while I was there. Probably introduced a couple, but
1852 # things seem to work OK at the moment.
1854 # Revision 1.38  2001/10/22 03:25:01  richard
1855 # Added configuration for:
1856 #  . anonymous user access and registration (deny/allow)
1857 #  . filter "widget" location on index page (top, bottom, both)
1858 # Updated some documentation.
1860 # Revision 1.37  2001/10/21 07:26:35  richard
1861 # feature #473127: Filenames. I modified the file.index and htmltemplate
1862 #  source so that the filename is used in the link and the creation
1863 #  information is displayed.
1865 # Revision 1.36  2001/10/21 04:44:50  richard
1866 # bug #473124: UI inconsistency with Link fields.
1867 #    This also prompted me to fix a fairly long-standing usability issue -
1868 #    that of being able to turn off certain filters.
1870 # Revision 1.35  2001/10/21 00:17:54  richard
1871 # CGI interface view customisation section may now be hidden (patch from
1872 #  Roch'e Compaan.)
1874 # Revision 1.34  2001/10/20 11:58:48  richard
1875 # Catch errors in login - no username or password supplied.
1876 # Fixed editing of password (Password property type) thanks Roch'e Compaan.
1878 # Revision 1.33  2001/10/17 00:18:41  richard
1879 # Manually constructing cookie headers now.
1881 # Revision 1.32  2001/10/16 03:36:21  richard
1882 # CGI interface wasn't handling checkboxes at all.
1884 # Revision 1.31  2001/10/14 10:55:00  richard
1885 # Handle empty strings in HTML template Link function
1887 # Revision 1.30  2001/10/09 07:38:58  richard
1888 # Pushed the base code for the extended schema CGI interface back into the
1889 # code cgi_client module so that future updates will be less painful.
1890 # Also removed a debugging print statement from cgi_client.
1892 # Revision 1.29  2001/10/09 07:25:59  richard
1893 # Added the Password property type. See "pydoc roundup.password" for
1894 # implementation details. Have updated some of the documentation too.
1896 # Revision 1.28  2001/10/08 00:34:31  richard
1897 # Change message was stuffing up for multilinks with no key property.
1899 # Revision 1.27  2001/10/05 02:23:24  richard
1900 #  . roundup-admin create now prompts for property info if none is supplied
1901 #    on the command-line.
1902 #  . hyperdb Class getprops() method may now return only the mutable
1903 #    properties.
1904 #  . Login now uses cookies, which makes it a whole lot more flexible. We can
1905 #    now support anonymous user access (read-only, unless there's an
1906 #    "anonymous" user, in which case write access is permitted). Login
1907 #    handling has been moved into cgi_client.Client.main()
1908 #  . The "extended" schema is now the default in roundup init.
1909 #  . The schemas have had their page headings modified to cope with the new
1910 #    login handling. Existing installations should copy the interfaces.py
1911 #    file from the roundup lib directory to their instance home.
1912 #  . Incorrectly had a Bizar Software copyright on the cgitb.py module from
1913 #    Ping - has been removed.
1914 #  . Fixed a whole bunch of places in the CGI interface where we should have
1915 #    been returning Not Found instead of throwing an exception.
1916 #  . Fixed a deviation from the spec: trying to modify the 'id' property of
1917 #    an item now throws an exception.
1919 # Revision 1.26  2001/09/12 08:31:42  richard
1920 # handle cases where mime type is not guessable
1922 # Revision 1.25  2001/08/29 05:30:49  richard
1923 # change messages weren't being saved when there was no-one on the nosy list.
1925 # Revision 1.24  2001/08/29 04:49:39  richard
1926 # didn't clean up fully after debugging :(
1928 # Revision 1.23  2001/08/29 04:47:18  richard
1929 # Fixed CGI client change messages so they actually include the properties
1930 # changed (again).
1932 # Revision 1.22  2001/08/17 00:08:10  richard
1933 # reverted back to sending messages always regardless of who is doing the web
1934 # edit. change notes weren't being saved. bleah. hackish.
1936 # Revision 1.21  2001/08/15 23:43:18  richard
1937 # Fixed some isFooTypes that I missed.
1938 # Refactored some code in the CGI code.
1940 # Revision 1.20  2001/08/12 06:32:36  richard
1941 # using isinstance(blah, Foo) now instead of isFooType
1943 # Revision 1.19  2001/08/07 00:24:42  richard
1944 # stupid typo
1946 # Revision 1.18  2001/08/07 00:15:51  richard
1947 # Added the copyright/license notice to (nearly) all files at request of
1948 # Bizar Software.
1950 # Revision 1.17  2001/08/02 06:38:17  richard
1951 # Roundupdb now appends "mailing list" information to its messages which
1952 # include the e-mail address and web interface address. Templates may
1953 # override this in their db classes to include specific information (support
1954 # instructions, etc).
1956 # Revision 1.16  2001/08/02 05:55:25  richard
1957 # Web edit messages aren't sent to the person who did the edit any more. No
1958 # message is generated if they are the only person on the nosy list.
1960 # Revision 1.15  2001/08/02 00:34:10  richard
1961 # bleah syntax error
1963 # Revision 1.14  2001/08/02 00:26:16  richard
1964 # Changed the order of the information in the message generated by web edits.
1966 # Revision 1.13  2001/07/30 08:12:17  richard
1967 # Added time logging and file uploading to the templates.
1969 # Revision 1.12  2001/07/30 06:26:31  richard
1970 # Added some documentation on how the newblah works.
1972 # Revision 1.11  2001/07/30 06:17:45  richard
1973 # Features:
1974 #  . Added ability for cgi newblah forms to indicate that the new node
1975 #    should be linked somewhere.
1976 # Fixed:
1977 #  . Fixed the agument handling for the roundup-admin find command.
1978 #  . Fixed handling of summary when no note supplied for newblah. Again.
1979 #  . Fixed detection of no form in htmltemplate Field display.
1981 # Revision 1.10  2001/07/30 02:37:34  richard
1982 # Temporary measure until we have decent schema migration...
1984 # Revision 1.9  2001/07/30 01:25:07  richard
1985 # Default implementation is now "classic" rather than "extended" as one would
1986 # expect.
1988 # Revision 1.8  2001/07/29 08:27:40  richard
1989 # Fixed handling of passed-in values in form elements (ie. during a
1990 # drill-down)
1992 # Revision 1.7  2001/07/29 07:01:39  richard
1993 # Added vim command to all source so that we don't get no steenkin' tabs :)
1995 # Revision 1.6  2001/07/29 04:04:00  richard
1996 # Moved some code around allowing for subclassing to change behaviour.
1998 # Revision 1.5  2001/07/28 08:16:52  richard
1999 # New issue form handles lack of note better now.
2001 # Revision 1.4  2001/07/28 00:34:34  richard
2002 # Fixed some non-string node ids.
2004 # Revision 1.3  2001/07/23 03:56:30  richard
2005 # oops, missed a config removal
2007 # Revision 1.2  2001/07/22 12:09:32  richard
2008 # Final commit of Grande Splite
2010 # Revision 1.1  2001/07/22 11:58:35  richard
2011 # More Grande Splite
2014 # vim: set filetype=python ts=4 sw=4 et si