- if (self.uri.endswith('new')
- or self.uri.endswith('update')
- or self.uri.endswith('create')
- or self.uri.endswith('destroy')):
- method = "POST"
-
- if (self.agent and self.uri.endswith('update')):
- kwargs["source"] = self.agent
-
- encoded_kwargs = urlencode(kwargs.items())
+ for action in POST_ACTIONS:
+ if self.uri.endswith(action):
+ method = "POST"
+ if (self.agent):
+ kwargs["source"] = self.agent
+ break
+
+ if (not self.encoded_args):
+ if kwargs.has_key('id'):
+ uri += "/%s" %(kwargs['id'])
+
+ self.encoded_args = urlencode(kwargs.items())
+