Trimmed up the User, Status, and Profile classes, since Python will assign properties on the fly
This commit is contained in:
parent
e57e16bee0
commit
679e03da6a
2
TODO
2
TODO
|
@ -19,3 +19,5 @@ bugs:
|
||||||
considerable tweaks to python-twitter)
|
considerable tweaks to python-twitter)
|
||||||
* "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround.
|
* "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround.
|
||||||
* Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue
|
* Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue
|
||||||
|
* If an @ appears anywhere in a status update, links after it try to resolve to user: links... need to work on my regexes
|
||||||
|
* "/home/user/code/hrafn/apithreads.py", line 241: UnboundLocalError: local variable 'user' referenced before assignment
|
||||||
|
|
|
@ -389,23 +389,16 @@ gobject.signal_new("friendship-changed", SigProxy,
|
||||||
|
|
||||||
# We use these classes to emulate a Status object when we need
|
# We use these classes to emulate a Status object when we need
|
||||||
# one to be built out of something else.
|
# one to be built out of something else.
|
||||||
class User():
|
class User(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.screen_name = None
|
|
||||||
self.name = None
|
|
||||||
self.profile = Profile()
|
self.profile = Profile()
|
||||||
|
|
||||||
class Profile():
|
class Profile(object):
|
||||||
def __init__(self):
|
pass
|
||||||
self.image_url = None
|
|
||||||
|
|
||||||
class Status():
|
class Status(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.user = User()
|
self.user = User()
|
||||||
self.id = None
|
|
||||||
self.created_at = None
|
|
||||||
self.in_reply_to_screen_name = None
|
|
||||||
self.in_reply_to_status_id = None
|
|
||||||
|
|
||||||
|
|
||||||
def results_to_statuses(results, api):
|
def results_to_statuses(results, api):
|
||||||
|
@ -435,7 +428,9 @@ def results_to_statuses(results, api):
|
||||||
created_at = re.sub(',', '', result.created_at)
|
created_at = re.sub(',', '', result.created_at)
|
||||||
created_split = re.split(' ', created_at)
|
created_split = re.split(' ', created_at)
|
||||||
status.created_at = created_split[0] + ' ' + created_split[2] + ' ' + created_split[1] + ' ' + created_split[4] + ' ' + created_split[5] + ' ' + created_split[3]
|
status.created_at = created_split[0] + ' ' + created_split[2] + ' ' + created_split[1] + ' ' + created_split[4] + ' ' + created_split[5] + ' ' + created_split[3]
|
||||||
|
|
||||||
status.text = result.text
|
status.text = result.text
|
||||||
|
status.source = result.source
|
||||||
|
|
||||||
# If this is in reply to something, get the relevant tweet
|
# If this is in reply to something, get the relevant tweet
|
||||||
if result.to_user_id is not None:
|
if result.to_user_id is not None:
|
||||||
|
@ -465,6 +460,7 @@ def dms_to_statuses(direct_messages):
|
||||||
status.user.profile.image_url = dm.sender.profile.image_url
|
status.user.profile.image_url = dm.sender.profile.image_url
|
||||||
status.created_at = dm.created_at
|
status.created_at = dm.created_at
|
||||||
status.text = dm.text
|
status.text = dm.text
|
||||||
|
status.source = None
|
||||||
statuses.append(status)
|
statuses.append(status)
|
||||||
return statuses
|
return statuses
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user