Browse Source

American spelling from now on (don't ask me why)

master
Julio Biason 15 years ago
parent
commit
76c22f851d
  1. 6
      mitterlib/network/__init__.py
  2. 8
      mitterlib/network/networkbase.py
  3. 8
      mitterlib/network/twitter.py

6
mitterlib/network/__init__.py

@ -263,11 +263,11 @@ class Networks(object):
self._save()
return
def favourite(self, message):
"""Change the favourite status of the message."""
def favouite(self, message):
"""Change the favorite status of the message."""
assert(isinstance(message, NetworkData))
self._proxy()
self.networks[message.network].favourite(message)
self.networks[message.network].favorite(message)
self._operations += 1
self._save()
return

8
mitterlib/network/networkbase.py

@ -139,8 +139,8 @@ class NetworkData(object):
"""Message timestamp (as a datetime object). Defaults to None.
*Optional*"""
self.favourite = False
"""Boolean indicating if the message was marked as "favourite" or not.
self.favorite = False
"""Boolean indicating if the message was marked as "favorite" or not.
*Optional*"""
self.parent = None
@ -268,8 +268,8 @@ class NetworkBase(object):
# anyway?
return None
def favourite(self, message):
"""Toggle the favourite status of a message. *message* must be a valid
def favorite(self, message):
"""Toggle the favorite status of a message. *message* must be a valid
:class:`NetworkData` object. Returns True if the request was
successful or False otherwise."""
# TODO: Again, if errors appear as exceptions, why return something?

8
mitterlib/network/twitter.py

@ -144,7 +144,7 @@ class TwitterNetworkData(NetworkData):
self.protected = data['user']['protected']
if 'favorited' in data:
self.favourited = data['favorited']
self.favorited = data['favorited']
if 'in_reply_to_status_id' in data and data['in_reply_to_status_id']:
owner = NetworkUser()
@ -495,11 +495,11 @@ class Connection(NetworkBase):
data = self._request(resource, body=body)
return TwitterNetworkData(data, self.user.username)
def favourite(self, message):
"""Mark a message as favourite."""
def favorite(self, message):
"""Mark a message as favorite."""
assert(isinstance(message, NetworkData))
body = urllib.urlencode({'id': message.id})
if not message.favourite:
if not message.favorite:
resource = '/favorites/create/%d.json' % (message.id)
else:
resource = '/favorites/destroy/%d.json' % (message.id)

Loading…
Cancel
Save