Exemplo n.º 1
0
 def __init__(self, form_name='form', POST=None, GET=None, method='POST'):
     # Build GET and POST data
     self.GET = MultiDict(GET or {})
     self.POST = MultiDict(POST or {})
     # Add the form's name to the appropriate request data dict.
     getattr(self, method.upper())['__formish_form__'] = form_name
     # Set the method
     self.method = method
Exemplo n.º 2
0
class Request(object):
    headers = {'content-type':'text/html'}
    
    def __init__(self, form_name='form', POST=None, GET=None, method='POST'):
        # Build GET and POST data
        self.GET = MultiDict(GET or {})
        self.POST = MultiDict(POST or {})
        # Add the form's name to the appropriate request data dict.
        getattr(self, method.upper())['__formish_form__'] = form_name
        # Set the method
        self.method = method

    def get_post(self):
        def container_factory(parent_key, item_key):
            if item_key.isdigit():
                return []
            return {}
        return unflatten(self.POST.dict_of_lists().iteritems(), container_factory=container_factory)