Permalink
Browse files

Add possibility to change path and method of submit target

  • Loading branch information...
jarus committed Jan 17, 2012
1 parent 3a8663e commit e479fecb82cc5cba3ee5968f8c5bab9030dc2eb3
Showing with 6 additions and 3 deletions.
  1. +6 −3 flask_fillin/wrapper.py
View
@@ -41,13 +41,16 @@ def forms(self):
if self._parsed_html is None:
self._parsed_html = document_fromstring(self.data)
- def _submit(self, client, **kargs):
+ def _submit(self, client, path=None, **kargs):
data = dict(self.form_values())
if kargs.has_key('data'):
data.update(kargs['data'])
del kargs['data']
- return client.open(self.action, method=self.method, data=data,
- **kargs)
+ if path is None:
+ path = self.action
+ if not kargs.has_key('method'):
+ kargs['method'] = self.method
+ return client.open(path, data=data, **kargs)
for form in self._parsed_html.forms:
setattr(form, "submit", types.MethodType(_submit, form))

0 comments on commit e479fec

Please sign in to comment.