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: branch diff | 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 Side-by-Side Diffs Ignore Whitespace Patch

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

     3      3   from pprint import pprint
     4      4   
     5      5   def view():
     6      6       stories = newsblur.feed(request.args[0])["stories"]
     7      7       feeds = newsblur.feeds(flat=True)["feeds"]
     8      8       feed = [feed for feed in feeds.itervalues() if feed["id"]==int(request.args[0])][0]
     9      9       return dict(stories=stories, feed=feed)
           10  +
           11  +def mark_read():
           12  +    newsblur.mark_feed_as_read(request.vars["feed"])
           13  +    redirect(URL("default", "index"))

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

   189    189       url = nb_url + 'reader/mark_story_as_starred'
   190    190       payload = {'story_id':story_id,'feed_id':feed_id}
   191    191       results = requests.post(url, data=payload, cookies=cookies)
   192    192       return simplejson.loads(results.content)
   193    193   
   194    194   def mark_all_as_read(days=0):
   195    195       '''
   196         -    Mark all stories in a feed or list of feeds as read.
          196  +    Mark all stories in *all* feeds read.
   197    197       '''
   198    198       
   199    199       url = nb_url + 'reader/mark_all_as_read'
   200    200       payload = {'days':days}
   201    201       results = requests.post(url, data=payload, cookies=cookies)
   202    202       return simplejson.loads(results.content)
   203    203   

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

   189    189       url = nb_url + 'reader/mark_story_as_starred'
   190    190       payload = {'story_id':story_id,'feed_id':feed_id}
   191    191       results = requests.post(url, data=payload, cookies=cookies)
   192    192       return simplejson.loads(results.content)
   193    193   
   194    194   def mark_all_as_read(days=0):
   195    195       '''
   196         -    Mark all stories in a feed or list of feeds as read.
          196  +    Mark all stories in *all* feeds read.
   197    197       '''
   198    198       
   199    199       url = nb_url + 'reader/mark_all_as_read'
   200    200       payload = {'days':days}
   201    201       results = requests.post(url, data=payload, cookies=cookies)
   202    202       return simplejson.loads(results.content)
   203    203   

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

     1      1   {{left_sidebar_enabled=right_sidebar_enabled=False}}
     2      2   {{extend 'layout.html'}}
     3      3   
     4         -<h1>Title: {{= feed["feed_title"] }}</h1>
            4  +<h1>{{= feed["feed_title"] }}</h1>
            5  +<a href="{{= URL("mark_read", vars=dict(feed=feed["id"])) }}"> Mark feed as read</a>
     5      6   
     6      7   {{ for story in stories: }}
     7      8       <a href="{{= URL(c="stories", f="view", vars=dict(story=story["id"], feed_id=feed["id"])) }}"><h2>{{= story["story_title"] }}</h2></a>
     8      9   {{ pass }}
     9     10   
    10     11   {{block left_sidebar}}New Left Sidebar Content{{end}}
    11     12   {{block right_sidebar}}New Right Sidebar Content{{end}}