- if (self.uri.endswith('new')
- or self.uri.endswith('update')
- or self.uri.endswith('create')
- or self.uri.endswith('destroy')):
- method = "POST"
-
- 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
+
+ secure_str = ''
+ if self.secure:
+ secure_str = 's'
+ dot = ""
+ if self.format != '':
+ dot = "."
+ uriBase = "http%s://%s/%s%s%s" %(
+ secure_str, self.domain, uri, dot, self.format)
+
+ if (not self.encoded_args):
+ if kwargs.has_key('id'):
+ uri += "/%s" %(kwargs['id'])
+
+ self.encoded_args = self.auth.encode_params(uriBase, method, kwargs)
+