[blipit] r168 committed - Adding a test for urlopen

0 views
Skip to first unread message

bli...@googlecode.com

unread,
Jan 16, 2011, 9:14:43 AM1/16/11
to bli...@googlegroups.com
Revision: 168
Author: dipt...@gmail.com
Date: Sun Jan 16 06:14:05 2011
Log: Adding a test for urlopen
http://code.google.com/p/blipit/source/detail?r=168

Modified:
/trunk/blipitsms/geocoder/tasks.py

=======================================
--- /trunk/blipitsms/geocoder/tasks.py Sun Jan 16 05:45:54 2011
+++ /trunk/blipitsms/geocoder/tasks.py Sun Jan 16 06:14:05 2011
@@ -6,14 +6,15 @@
from blip import Blip, BlipItPost, GeoPoint

@task
-def scan_channels():
- req = urllib2.urlopen(settings.BLIPIT_SVC_CHANNELS_URL)
- json_data = json.loads(req.read())
+def scan_channels(urlopen =
urllib2.urlopen(settings.BLIPIT_SVC_CHANNELS_URL)):
+ json_data = json.loads(urlopen.read())
for channel in json_data:
channel_id = channel['key']['id']
channel_name = channel['name']
if len(Channel.objects.filter(channel_name = channel_name)) is 0:
Channel(channel_id = channel_id, channel_name =
channel_name).save()
+
+ return Channel.objects


@task

Reply all
Reply to author
Forward
0 new messages