cubicweb/etwist/request.py
changeset 11870 3a84a79c4ed5
parent 11868 d5181d7f1389
child 11913 4516c3956d46
equal deleted inserted replaced
11869:d8b66e3fd335 11870:3a84a79c4ed5
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    36                     name = text_type(name, self.encoding)
    36                     name = text_type(name, self.encoding)
    37                 self.form.setdefault(key, []).append((name, stream))
    37                 self.form.setdefault(key, []).append((name, stream))
    38             # 3.16.4 backward compat
    38             # 3.16.4 backward compat
    39             if len(self.form[key]) == 1:
    39             if len(self.form[key]) == 1:
    40                 self.form[key] = self.form[key][0]
    40                 self.form[key] = self.form[key][0]
    41         self.content = self._twreq.content # stream
    41         self.content = self._twreq.content  # stream
    42 
    42 
    43     def http_method(self):
    43     def http_method(self):
    44         """returns 'POST', 'GET', 'HEAD', etc."""
    44         """returns 'POST', 'GET', 'HEAD', etc."""
    45         return self._twreq.method
    45         return self._twreq.method
    46 
    46 
    50         the returned path may be used to compare to generated urls
    50         the returned path may be used to compare to generated urls
    51 
    51 
    52         :param includeparams:
    52         :param includeparams:
    53            boolean indicating if GET form parameters should be kept in the path
    53            boolean indicating if GET form parameters should be kept in the path
    54         """
    54         """
    55         path = self._twreq.uri[1:] # remove the root '/'
    55         path = self._twreq.uri[1:]  # remove the root '/'
    56         if not includeparams:
    56         if not includeparams:
    57             path = path.split('?', 1)[0]
    57             path = path.split('?', 1)[0]
    58         return path
    58         return path