MobileBlur

Check-in [b74e6c434b]
Login
Overview
Comment:Added a button to mark a feed as read
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:b74e6c434b4439535a4bbf99227e5e97ec85d9fd
User & Date: spiffy on 2011-11-20 03:12:48
Other Links: manifest | tags
Context
2011-11-20
03:41
Removed web2py import calls from the Newsblur module check-in: b33aaf3ac3 user: spiffy tags: develop
03:40
Create new branch named "feature/web2py_auth" check-in: 50a1ba732d user: spiffy tags: feature/web2py_auth
03:12
Added a button to mark a feed as read check-in: b74e6c434b user: spiffy tags: develop
03:03
Moved newsblur library from urllib to Requests. Moved username storage to the DB. Store cookie in the DB. Centralize a login function that checks the DB for a user's cookie on each page load and logs the user in if there's no cookie. check-in: cbc0649388 user: spiffy tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified applications/mobileblur/controllers/feeds.py from [61898c0aad] to [b47f0eada4].

3
4
5
6
7
8
9




from pprint import pprint

def view():
    stories = newsblur.feed(request.args[0])["stories"]
    feeds = newsblur.feeds(flat=True)["feeds"]
    feed = [feed for feed in feeds.itervalues() if feed["id"]==int(request.args[0])][0]
    return dict(stories=stories, feed=feed)











>
>
>
>
3
4
5
6
7
8
9
10
11
12
13
from pprint import pprint

def view():
    stories = newsblur.feed(request.args[0])["stories"]
    feeds = newsblur.feeds(flat=True)["feeds"]
    feed = [feed for feed in feeds.itervalues() if feed["id"]==int(request.args[0])][0]
    return dict(stories=stories, feed=feed)

def mark_read():
    newsblur.mark_feed_as_read(request.vars["feed"])
    redirect(URL("default", "index"))

Modified applications/mobileblur/modules/newsblur.py from [8c37485973] to [d55de7de31].

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    url = nb_url + 'reader/mark_story_as_starred'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_all_as_read(days=0):
    '''
    Mark all stories in a feed or list of feeds as read.
    '''
    
    url = nb_url + 'reader/mark_all_as_read'
    payload = {'days':days}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)








|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    url = nb_url + 'reader/mark_story_as_starred'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_all_as_read(days=0):
    '''
    Mark all stories in *all* feeds read.
    '''
    
    url = nb_url + 'reader/mark_all_as_read'
    payload = {'days':days}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

Modified applications/mobileblur/modules/python-newsblur/newsblur.py from [8c37485973] to [d55de7de31].

189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    url = nb_url + 'reader/mark_story_as_starred'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_all_as_read(days=0):
    '''
    Mark all stories in a feed or list of feeds as read.
    '''
    
    url = nb_url + 'reader/mark_all_as_read'
    payload = {'days':days}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)








|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    url = nb_url + 'reader/mark_story_as_starred'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_all_as_read(days=0):
    '''
    Mark all stories in *all* feeds read.
    '''
    
    url = nb_url + 'reader/mark_all_as_read'
    payload = {'days':days}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

Modified applications/mobileblur/views/feeds/view.html from [de27b8829a] to [3646a45d79].

1
2
3
4

5
6
7
8
9
10
11
{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}

<h1>Title: {{= feed["feed_title"] }}</h1>


{{ for story in stories: }}
    <a href="{{= URL(c="stories", f="view", vars=dict(story=story["id"], feed_id=feed["id"])) }}"><h2>{{= story["story_title"] }}</h2></a>
{{ pass }}

{{block left_sidebar}}New Left Sidebar Content{{end}}
{{block right_sidebar}}New Right Sidebar Content{{end}}



|
>







1
2
3
4
5
6
7
8
9
10
11
12
{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}

<h1>{{= feed["feed_title"] }}</h1>
<a href="{{= URL("mark_read", vars=dict(feed=feed["id"])) }}"> Mark feed as read</a>

{{ for story in stories: }}
    <a href="{{= URL(c="stories", f="view", vars=dict(story=story["id"], feed_id=feed["id"])) }}"><h2>{{= story["story_title"] }}</h2></a>
{{ pass }}

{{block left_sidebar}}New Left Sidebar Content{{end}}
{{block right_sidebar}}New Right Sidebar Content{{end}}