From: richard Date: Mon, 30 Jul 2001 06:17:45 +0000 (+0000) Subject: Features: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b2e57f149ca849df38f6ccd2d95a6cb40b74aa8c;p=roundup.git Features: . Added ability for cgi newblah forms to indicate that the new node should be linked somewhere. Fixed: . Fixed the agument handling for the roundup-admin find command. . Fixed handling of summary when no note supplied for newblah. Again. . Fixed detection of no form in htmltemplate Field display. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@168 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index f6178d4..90f3760 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -1,4 +1,4 @@ -# $Id: cgi_client.py,v 1.10 2001-07-30 02:37:34 richard Exp $ +# $Id: cgi_client.py,v 1.11 2001-07-30 06:17:45 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback @@ -321,7 +321,7 @@ class Client: # possibly perform a create keys = self.form.keys() num_re = re.compile('^\d+$') - if keys: + if [i for i in keys if i[0] != ':']: props = {} try: keys = self.form.keys() @@ -367,6 +367,32 @@ class Client: props[key] = value nid = cl.create(**props) + # link if necessary + for key in keys: + print key, + if key == ':multilink': + value = self.form[key].value + if type(value) != type([]): value = [value] + for value in value: + designator, property = value.split(':') + print 'miltilinking to ', designator, property + link, nodeid = roundupdb.splitDesignator(designator) + link = self.db.classes[link] + value = link.get(nodeid, property) + value.append(nid) + link.set(nodeid, **{property: value}) + elif key == ':link': + value = self.form[key].value + if type(value) != type([]): value = [value] + for value in value: + designator, property = value.split(':') + print 'linking to ', designator, property + link, nodeid = roundupdb.splitDesignator(designator) + link = self.db.classes[link] + link.set(nodeid, **{property: nid}) + else: + print 'ignoring' + # if this item has messages, if (cl.getprops().has_key('messages') and cl.getprops()['messages'].isMultilinkType and @@ -406,8 +432,8 @@ class Client: summary = note m.append('\n%s\n'%note) else: - m.append('\nThis %s has been created through ' - 'the web.\n'%cn) + summary = 'This %s has been created through the web.'%cn + m.append('\n%s\s'%summary) # now create the message content = '\n'.join(m) @@ -499,6 +525,9 @@ class Client: # # $Log: not supported by cvs2svn $ +# Revision 1.10 2001/07/30 02:37:34 richard +# Temporary measure until we have decent schema migration... +# # Revision 1.9 2001/07/30 01:25:07 richard # Default implementation is now "classic" rather than "extended" as one would # expect. diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index 1356ed0..1820431 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -1,4 +1,4 @@ -# $Id: htmltemplate.py,v 1.13 2001-07-30 02:37:53 richard Exp $ +# $Id: htmltemplate.py,v 1.14 2001-07-30 06:17:45 richard Exp $ import os, re, StringIO, urllib, cgi, errno @@ -58,7 +58,7 @@ class Field(Base): to be edited ''' def __call__(self, property, size=None, height=None, showid=0): - if not self.nodeid and self.form and self.filterspec is None: + if not self.nodeid and self.form is None and self.filterspec is None: return '[Field: not called from item]' propclass = self.properties[property] if self.nodeid: @@ -711,12 +711,21 @@ def newitem(client, templates, db, classname, form, replace=re.compile( except: s = open(os.path.join(templates, classname+'.item')).read() w('
'%classname) + for key in form.keys(): + if key[0] == ':': + value = form[key].value + if type(value) != type([]): value = [value] + for value in value: + w(''%(key, value)) replace = ItemTemplateReplace(globals, locals(), None, None) w(replace.go(s)) w('
') # # $Log: not supported by cvs2svn $ +# Revision 1.13 2001/07/30 02:37:53 richard +# Temporary measure until we have decent schema migration. +# # Revision 1.12 2001/07/30 01:24:33 richard # Handles new node display now. #