Message1418
Logged In: YES
user_id=1102743
Thanks, Richard.
Indeed I had made a mistake with the scope of the form.
However correcting the form did not solve the problem.
So I had a deeper look into the coding of client.py and
compared it with the implementation in 0.7.6.
I found that the reason for the additional issue was probably
that the variable 'needed' in function Client._editnodes had an
entry ('issue',None) that caused an implicit create action.
The reason for this had to be the form parsing routine that
assumed default class and node id in some cases.
Further investigation showed an additional code block in 0.7.6
in the form parsing routine (now in form_parser.py, but
otherwise similar to Client.parsePropsFromForm):
# skip implicit create if this isn't a create action
if not create and nodeid is None:
continue
As I did not want to fiddle with the function interface I had to
set variable 'create' locally in the beginning of the function:
create=1
if form.has_key("@action"):
create=(form.getvalue("@action")!="edit")
(which is probably not quite correct, but I only needed the
patch for "edit")
However I still got an entry ('issue',None) in the form parsing
result, probably due to:
# we should always return something, even empty, for
the context
all_props[(default_cn, default_nodeid)] = {}
To fix this, I changed the 'skip implicit create' code block
slightly into:
# skip implicit create if this isn't a create action
if not create and nodeid is None:
try:
del all_props[this]
except:
pass
continue
Finally I adapted the redirection code at the end of
client.editItemAction from its equivalent in 0.7.6:
# redirect to the item's edit page
# redirect to finish off
url = self.base + self.classname
# note that this action might have been called by an
index page, so
# we will want to include index-page args in this URL too
if self.nodeid is not None:
url += self.nodeid
url += '?@ok_message=%s&@template=%s'%(urllib.quote
(message),
urllib.quote(self.template))
if self.nodeid is None:
req = templating.HTMLRequest(self)
url += '&' + req.indexargs_href('', {})[1:]
raise Redirect, url
Now it seems to work as I want it, however I am not sure if
this is the right way to patch it or if I might have broken
something for other actions.
I have not tried if it works in 0.7 without modifications.
Kind regards,
Robert Seeger
robert DOT seeger AT usa DOT net
|
|
Date |
User |
Action |
Args |
2009-02-03 14:20:54 | admin | link | issue1007930 messages |
2009-02-03 14:20:54 | admin | create | |
|