Skip to content

Commit

Permalink
If we detect a brower, we serve the html
Browse files Browse the repository at this point in the history
  • Loading branch information
mapio committed Dec 12, 2011
1 parent fda54f0 commit 87644e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
18 changes: 6 additions & 12 deletions nofussbm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,12 @@ def options():
@app.route( '/<ident>' )
def list( ident ):

try:
list_appearance = request.cookies.get( 'list_appearance' )
except KeyError:
list_appearance = 'text'
try:
bookmarks_per_page = int( request.cookies.get( 'bookmarks_per_page' ) )
except ( KeyError, TypeError ):
bookmarks_per_page = 10
try:
show_tags = request.cookies.get( 'show_tags' ) == 'true'
except KeyError:
show_tags = True
list_appearance = 'html' if request.headers[ 'User-Agent'].split( '/' )[ 0 ] in ( 'Microsoft Internet Explorer', 'Mozilla', 'Opera' ) else 'text'
la_c = request.cookies.get( 'list_appearance' )
if la_c: list_appearance = la_c
bpp_c = request.cookies.get( 'bookmarks_per_page' )
bookmarks_per_page = int( bpp_c ) if bpp_c else 10
show_tags = request.cookies.get( 'show_tags' ) == 'true'
content_only = 'content_only' in request.args

result = []
Expand Down
3 changes: 2 additions & 1 deletion nofussbm/templates/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ <h1>Options</h1>
<span>HTML</span>
<input type="radio" name="list_appearance" id="html" value="html" />
</label></li>
</ul></div>
</ul><span class="help-block">If set to "Text" you'll need to come back manually to this page to have the list in HTML again</span>
</div>
</div><!-- /clearfix -->

<div class="clearfix">
Expand Down

0 comments on commit 87644e3

Please sign in to comment.