X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=roundup%2Fcgi_client.py;h=86177bb6b257e0978b35d5d4970cb982d5e404f7;hb=1b8dd00d357bfc90e4f1d57ac8c3dd36aa9a0ccd;hp=c8e1fef6699c13615b57b525dfcfe7275284b6f0;hpb=e57757118e00378dd1aa2508b1ee0fdf0e2f0eb4;p=roundup.git diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index c8e1fef..86177bb 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,14 +15,14 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.85 2001-12-20 06:13:24 rochecompaan Exp $ +# $Id: cgi_client.py,v 1.90 2002-01-08 03:56:55 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). """ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes -import binascii, Cookie, time +import binascii, Cookie, time, random import roundupdb, htmltemplate, date, hyperdb, password from roundup.i18n import _ @@ -108,7 +108,8 @@ class Client: user_name = self.user or '' if self.user == 'admin': admin_links = _(' | Class List' \ - ' | User List') + ' | User List' \ + ' | Add User') else: admin_links = '' if self.user not in (None, 'anonymous'): @@ -122,8 +123,7 @@ class Client: if self.user is not None: add_links = _(''' | Add -Issue, -User +Issue ''') else: add_links = '' @@ -350,6 +350,18 @@ class Client: showissue = shownode showmsg = shownode + def _add_assignedto_to_nosy(self, props): + ''' add the assignedto value from the props to the nosy list + ''' + if not props.has_key('assignedto'): + return + assignedto_id = props['assignedto'] + if props.has_key('nosy') and assignedto_id not in props['nosy']: + props['nosy'].append(assignedto_id) + else: + props['nosy'] = cl.get(self.nodeid, 'nosy') + props['nosy'].append(assignedto_id) + def _changenode(self, props): ''' change the node based on the contents of the form ''' @@ -361,16 +373,21 @@ class Client: resolved_id = self.db.status.lookup('resolved') chatting_id = self.db.status.lookup('chatting') current_status = cl.get(self.nodeid, 'status') + if props.has_key('status'): + new_status = props['status'] + else: + # apparently there's a chance that some browsers don't + # send status... + new_status = current_status except KeyError: pass else: - if (props['status'] == unread_id or props['status'] == resolved_id and current_status == resolved_id): + if new_status == unread_id or (new_status == resolved_id + and current_status == resolved_id): props['status'] = chatting_id - # add assignedto to the nosy list - if props.has_key('assignedto'): - assignedto_id = props['assignedto'] - if assignedto_id not in props['nosy']: - props['nosy'].append(assignedto_id) + + self._add_assignedto_to_nosy(props) + # create the message message, files = self._handle_message() if message: @@ -395,13 +412,9 @@ class Client: pass else: props['status'] = unread_id - # add assignedto to the nosy list - if props.has_key('assignedto'): - assignedto_id = props['assignedto'] - if props.has_key('nosy') and assignedto_id not in props['nosy']: - props['nosy'].append(assignedto_id) - else: - props['nosy'] = [assignedto_id] + + self._add_assignedto_to_nosy(props) + # check for messages and files message, files = self._handle_message() if message: @@ -433,7 +446,7 @@ class Client: props = cl.getprops() note = None # in a nutshell, don't do anything if there's no note or there's no - # nosy + # NOSY if self.form.has_key('__note'): note = self.form['__note'].value if not props.has_key('messages'): @@ -456,11 +469,16 @@ class Client: # don't generate a useless message return None, files + # handle the messageid + # TODO: handle inreplyto + messageid = "%s.%s.%s-%s"%(time.time(), random.random(), + self.classname, self.MAIL_DOMAIN) + # now create the message, attaching the files content = '\n'.join(m) message_id = self.db.msg.create(author=self.getuid(), recipients=[], date=date.Date('.'), summary=summary, - content=content, files=files) + content=content, files=files, messageid=messageid) # update the messages property return message_id, files @@ -1046,7 +1064,8 @@ class ExtendedClient(Client): user_name = self.user or '' if self.user == 'admin': admin_links = _(' | Class List' \ - ' | User List') + ' | User List' \ + ' | Add User') else: admin_links = '' if self.user not in (None, 'anonymous'): @@ -1063,7 +1082,6 @@ class ExtendedClient(Client): | Add Issue, Support, -User ''') else: add_links = '' @@ -1163,6 +1181,46 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.89 2002/01/07 20:24:45 richard +# *mutter* stupid cutnpaste +# +# Revision 1.88 2002/01/02 02:31:38 richard +# Sorry for the huge checkin message - I was only intending to implement #496356 +# but I found a number of places where things had been broken by transactions: +# . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename +# for _all_ roundup-generated smtp messages to be sent to. +# . the transaction cache had broken the roundupdb.Class set() reactors +# . newly-created author users in the mailgw weren't being committed to the db +# +# Stuff that made it into CHANGES.txt (ie. the stuff I was actually working +# on when I found that stuff :): +# . #496356 ] Use threading in messages +# . detectors were being registered multiple times +# . added tests for mailgw +# . much better attaching of erroneous messages in the mail gateway +# +# Revision 1.87 2001/12/23 23:18:49 richard +# We already had an admin-specific section of the web heading, no need to add +# another one :) +# +# Revision 1.86 2001/12/20 15:43:01 rochecompaan +# Features added: +# . Multilink properties are now displayed as comma separated values in +# a textbox +# . The add user link is now only visible to the admin user +# . Modified the mail gateway to reject submissions from unknown +# addresses if ANONYMOUS_ACCESS is denied +# +# Revision 1.85 2001/12/20 06:13:24 rochecompaan +# Bugs fixed: +# . Exception handling in hyperdb for strings-that-look-like numbers got +# lost somewhere +# . Internet Explorer submits full path for filename - we now strip away +# the path +# Features added: +# . Link and multilink properties are now displayed sorted in the cgi +# interface +# # Revision 1.84 2001/12/18 15:30:30 rochecompaan # Fixed bugs: # . Fixed file creation and retrieval in same transaction in anydbm