Commits

ianb  committed e518271

Make urlvars settable

  • Participants
  • Parent commits 5ec1f48

Comments (0)

Files changed (1)

File webob/__init__.py

         path = path.lstrip('/')
         return path.split('/', 1)[0]
 
-    def urlvars(self):
+    def urlvars__get(self):
         """
         Return any variables matched in the URL (e.g.,
         ``wsgiorg.routing_args``).
         elif 'wsgiorg.routing_args' in self.environ:
             return self.environ['wsgiorg.routing_args'][1]
         else:
-            return {}
-    urlvars = property(urlvars, doc=urlvars.__doc__)
+            result = {}
+            self.environ['wsgiorg.routing_args'] = ((), result)
+            return result
+
+    def urlvars__set(self, value):
+        del self.urlvars
+        self.environ['wsgiorg.routing_args'] = ((), value)
+
+    def urlvars__del(self):
+        if 'paste.urlvars' in self.environ:
+            del self.environ['paste.urlvars']
+        if 'wsgiorg.routing_args' in self.environ:
+            del self.environ['wsgiorg.routing_args']
+            
+    urlvars = property(urlvars__get, urlvars__set, urlvars__del, doc=urlvars__get.__doc__)
 
     def is_xhr(self):
         """Returns a boolean if X-Requested-With is present and ``XMLHttpRequest``"""