Joao P Dubas committed 8102e94

Replicate `site`.`tools` into the service client.

Comments (0)

Files changed (2)

Add a comment to this file


Empty file added.


+Created on Oct 31, 2012
+@author: marcos
+import string
+def cookie_patch():
+    ''' Monkey patch que abre o cookie a aceitar mais caracteres do que a maldita RFC2109 :( '''
+    import Cookie
+    my_allowed_chars = Cookie._LegalChars + ':'  # Lista de caracteres a adicionar
+    def morsel_set(self, key, val, coded_val, LegalChars=my_allowed_chars, idmap=Cookie._idmap, translate=string.translate):
+        # First we verify that the key isn't a reserved word
+        # Second we make sure it only contains legal characters
+        if key.lower() in self._reserved:
+            raise Cookie.CookieError("Attempt to set a reserved key: %s" % key)
+        if "" != translate(key, idmap, LegalChars):
+            raise Cookie.CookieError("Illegal key value: %s" % key)
+        # It's a good key, so save it.
+        self.key = key
+        self.value = val
+        self.coded_value = coded_val
+    Cookie.Morsel.set = morsel_set
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.