r6952 - in bigboard/trunk/bigboard: . httplib2
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6952 - in bigboard/trunk/bigboard: . httplib2
- Date: Tue, 4 Dec 2007 13:52:42 -0600 (CST)
Author: hp
Date: 2007-12-04 13:52:37 -0600 (Tue, 04 Dec 2007)
New Revision: 6952
Modified:
bigboard/trunk/bigboard/httplib2/__init__.py
bigboard/trunk/bigboard/people_tracker.py
Log:
add icons to IM buddies in people stock
Modified: bigboard/trunk/bigboard/httplib2/__init__.py
===================================================================
--- bigboard/trunk/bigboard/httplib2/__init__.py 2007-12-04 00:59:53 UTC (rev 6951)
+++ bigboard/trunk/bigboard/httplib2/__init__.py 2007-12-04 19:52:37 UTC (rev 6952)
@@ -739,7 +739,17 @@
self.sock = httplib.FakeSocket(sock, ssl)
+def data_from_data_url(url):
+ ## data:image/png;base64,BASE64DATA
+ i = url.find('base64,')
+ if i < 0:
+ return None
+
+ decoded = base64.b64decode(url[i+len('base64,'):])
+
+ return decoded
+
class Http(object):
"""An HTTP client that handles:
- all methods
@@ -935,6 +945,7 @@
being and instance of the 'Response' class, the second being
a string that contains the response entity body.
"""
+
try:
if headers is None:
headers = {}
@@ -944,6 +955,15 @@
if not headers.has_key('user-agent'):
headers['user-agent'] = "Python-httplib2/%s" % __version__
+ ## special-case data: urls
+ if uri.startswith("data:"):
+ info = { 'status' : '200' }
+ content = data_from_data_url(uri)
+ if not content:
+ raise Exception("Failed to parse data url")
+ response = Response(info)
+ return (response, content)
+
uri = iri2uri(uri)
(scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
@@ -1103,7 +1123,7 @@
def __init__(self, info):
# info is either an email.Message or
- # an httplib.HTTPResponse object.
+ # an httplib.HTTPResponse object or just a dict
if isinstance(info, httplib.HTTPResponse):
for key, value in info.getheaders():
self[key] = value
Modified: bigboard/trunk/bigboard/people_tracker.py
===================================================================
--- bigboard/trunk/bigboard/people_tracker.py 2007-12-04 00:59:53 UTC (rev 6951)
+++ bigboard/trunk/bigboard/people_tracker.py 2007-12-04 19:52:37 UTC (rev 6952)
@@ -363,14 +363,14 @@
# When we disconnect from the server we freeze existing content, then on reconnect
# we clear everything and start over.
- contact_props = '[+;name;user [+;photoUrl;mugshotLocalBuddy];aims;aimBuddies +;mugshotLocalBuddies +;xmpps;xmppBuddies +;emails;status]'
+ contact_props = '[+;name;user [+;photoUrl;mugshotLocalBuddy];aims;aimBuddies [+;icon];mugshotLocalBuddies [+;icon];xmpps;xmppBuddies [+;icon];emails;status]'
query = self.__model.query_resource(self.__model.self_resource, "contacts %s" % contact_props)
query.add_handler(self.__on_got_self)
query.execute()
query = self.__model.query_resource(self.__model.global_resource,
- "aimBuddies [+;contact %s]; xmppBuddies [+;contact %s]; mugshotLocalBuddies [+;contact %s]" % (contact_props, contact_props, contact_props))
+ "aimBuddies [+;icon;contact %s]; xmppBuddies [+;icon;contact %s]; mugshotLocalBuddies [+;icon;contact %s]" % (contact_props, contact_props, contact_props))
query.add_handler(self.__on_got_global)
query.execute()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]