From: richard Date: Wed, 1 Aug 2001 04:24:21 +0000 (+0000) Subject: mailgw was assuming certain properties existed on the issues being created. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8fb7b5c47470f75ad1969779b20e29bc1309b0a7;p=roundup.git mailgw was assuming certain properties existed on the issues being created. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@178 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index ea37bdd..3028535 100644 --- a/roundup/hyperdb.py +++ b/roundup/hyperdb.py @@ -1,4 +1,4 @@ -# $Id: hyperdb.py,v 1.10 2001-07-30 02:38:31 richard Exp $ +# $iD: HYperdb.py,v 1.10 2001/07/30 02:38:31 richard Exp $ # standard python modules import cPickle, re, string @@ -119,7 +119,12 @@ class Class: else: raise ValueError, 'node with key "%s" exists'%value - prop = self.properties[key] + # try to handle this property + try: + prop = self.properties[key] + except KeyError: + raise KeyError, '"%s" has no property "%s"'%(self.classname, + key) if prop.isLinkType: if type(value) != type(''): @@ -793,6 +798,9 @@ def Choice(name, *options): # # $Log: not supported by cvs2svn $ +# Revision 1.10 2001/07/30 02:38:31 richard +# get() now has a default arg - for migration only. +# # Revision 1.9 2001/07/29 09:28:23 richard # Fixed sorting by clicking on column headings. # diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 9465547..e6d66cf 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -55,7 +55,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.5 2001-07-29 07:01:39 richard Exp $ +$Id: mailgw.py,v 1.6 2001-08-01 04:24:21 richard Exp $ ''' @@ -258,36 +258,37 @@ class MailGW: # handle the files files = [] for (name, type, data) in attachments: - files.append(self.db.file.create(type=type, name=name, content=data)) + files.append(self.db.file.create(type=type, name=name, + content=data)) # now handle the db stuff if nodeid: - # If an item designator (class name and id number) is found there, the - # newly created "msg" node is added to the "messages" property for - # that item, and any new "file" nodes are added to the "files" + # If an item designator (class name and id number) is found there, + # the newly created "msg" node is added to the "messages" property + # for that item, and any new "file" nodes are added to the "files" # property for the item. - message_id = self.db.msg.create(author=author, recipients=recipients, - date=date.Date('.'), summary=summary, content=content, - files=files) + message_id = self.db.msg.create(author=author, + recipients=recipients, date=date.Date('.'), summary=summary, + content=content, files=files) messages = cl.get(nodeid, 'messages') messages.append(message_id) props['messages'] = messages - apply(cl.set, (nodeid, ), props) + cl.set(nodeid, **props) else: # If just an item class name is found there, we attempt to create a # new item of that class with its "messages" property initialized to # contain the new "msg" node and its "files" property initialized to # contain any new "file" nodes. - message_id = self.db.msg.create(author=author, recipients=recipients, - date=date.Date('.'), summary=summary, content=content, - files=files) - if not props.has_key('assignedto'): + message_id = self.db.msg.create(author=author, + recipients=recipients, date=date.Date('.'), summary=summary, + content=content, files=files) + # fill out the properties with defaults where required + if properties.has_key('assignedto') and \ + not props.has_key('assignedto'): props['assignedto'] = '1' # "admin" - if not props.has_key('priority'): - props['priority'] = '1' # "bug-fatal" - if not props.has_key('status'): + if properties.has_key('status') and not props.has_key('status'): props['status'] = '1' # "unread" - if not props.has_key('title'): + if properties.has_key('title') and not props.has_key('title'): props['title'] = title props['messages'] = [message_id] props['nosy'] = recipients[:] @@ -297,6 +298,9 @@ class MailGW: # # $Log: not supported by cvs2svn $ +# Revision 1.5 2001/07/29 07:01:39 richard +# Added vim command to all source so that we don't get no steenkin' tabs :) +# # Revision 1.4 2001/07/28 06:43:02 richard # Multipart message class has the getPart method now. Added some tests for it. #