streetsign_server.views¶
The views (HTTP end points) of the web interface, and the Screen Displays.
streetsign_server.views¶
brings in all the main views from the other files.
- streetsign_server.views.before_the_action()¶
load some variables in for template etc to use
- streetsign_server.views.index()¶
main front page / dashboard / index.
- streetsign_server.views.not_logged_in(err)¶
Not Logged In handler
- streetsign_server.views.robots_txt()¶
block all well-behaved search engines.
Utilites¶
streetsign_server.views.utils¶
No actual views in here, only bits and pieces to make views more fun.
- exception streetsign_server.views.utils.PleaseRedirect(url='index', msg='Something went wrong')¶
so redirects can be passed back to views from logic functions. >>> def view_blah(…):
- try:
do_stuff()
- except app.PleaseRedirect as e:
flash(str(e.msg)) redirect(e.url)
- streetsign_server.views.utils.admin_only(*methods)¶
decorator for views to restrict access to admin users only.
- streetsign_server.views.utils.getbool(name, default, form=None)¶
get a bool from the request.form. if it’s not valid, return the default.
- streetsign_server.views.utils.getint(name, default, minimum=0, maximum=999999999, form=None)¶
get an integer from the request.form, capped with min and max, and a default. If its not a valid integer, return the default.
- streetsign_server.views.utils.getstr(name, default, validate='(.*)', flags=0, form=None)¶
get a string from request.form. if it’s not there, then return the default.
- streetsign_server.views.utils.not_found(message='Page Not Found', title='Not Found')¶
return the error.html template, with a message, and the HTTP code
- streetsign_server.views.utils.permission_denied(message="You don't have permission! Sorry!", title='Permission Denied')¶
return the error.html template, with a message, and the HTTP code
- streetsign_server.views.utils.registered_users_only(*methods)¶
decorator for views to restrict access to registered users only.
Users and Authentication¶
streetsign_server.views.users_and_auth¶
Views for Working with users and passwords, and user-groups.
- streetsign_server.views.users_and_auth.group(groupid)¶
edit one user group.
- streetsign_server.views.users_and_auth.login()¶
log a user into the system, set session cookies, set up database session row, or not, if wrong password.
- streetsign_server.views.users_and_auth.logout()¶
log out, remove session cookies, etc.
- streetsign_server.views.users_and_auth.user_edit(userid=-1)¶
edit one user. Admins can edit any user, but other users can only edit themselves. if userid is -1, create a new user.
- streetsign_server.views.users_and_auth.users_and_groups()¶
list of all users and groups (HTML page).
The Screen Output Views¶
streetsign_server.views.screens¶
Views for screen output, and editing the screens.
- streetsign_server.views.screens.client_alias(alias_name)¶
client alias repointing address
- streetsign_server.views.screens.form_json(name, default)¶
make sure form input is valid JSON
- streetsign_server.views.screens.post_types_js()¶
Send the javascript of how to render all the post types. (This is stored/generated by the post type modules themselves.)
- streetsign_server.views.screens.save_aliases()¶
save the current aliases.
- streetsign_server.views.screens.screen_json(screenid, old_md5)¶
When you edit a screen, it saves most of the data as JSON. This requests the MD5sum of that data, (and that data). You can then compare against what you’re already displaying, and only update if it’s changed.
- streetsign_server.views.screens.screendisplay(template, screenname)¶
The actual output screen view.
- streetsign_server.views.screens.screenedit(screenid)¶
edit one screen
- streetsign_server.views.screens.screens()¶
HTML listing of all screens
- streetsign_server.views.screens.screens_posts_from_feeds(json_feeds_list)¶
send JSON list of the posts in whichever feeds you request (as a JS array [id,id,id] type list)
Feeds and Posts¶
streetsign_server.views.feeds_and_posts¶
Views for editing feeds and posts.
- class streetsign_server.views.feeds_and_posts.RSSFeed¶
Minimal RSS 2.0 feed generator.
- format_rss2_string()¶
Generate the RSS 2.0 XML string.
- streetsign_server.views.feeds_and_posts.external_data_source_edit(source_id)¶
Editing a external data source
- streetsign_server.views.feeds_and_posts.external_data_sources_update_all()¶
update all external data sources.
- streetsign_server.views.feeds_and_posts.external_source_run(source_id)¶
use the importer specified to see if there is any new data, and if there is, then import it.
- streetsign_server.views.feeds_and_posts.external_source_test()¶
test an external source, and return some comforting HTML (for the editor)
- streetsign_server.views.feeds_and_posts.feedpage(feedid)¶
the back end settings for one feed.
- streetsign_server.views.feeds_and_posts.feeds()¶
the back end list of feeds.
- streetsign_server.views.feeds_and_posts.feedsrss(ids_raw)¶
get a bunch of feeds posts as an RSS stream
- streetsign_server.views.feeds_and_posts.post_new(feed_id)¶
create a new post!
- streetsign_server.views.feeds_and_posts.postedit_type(typeid)¶
returns an editor page, of type typeid
- streetsign_server.views.feeds_and_posts.postpage(postid)¶
Edit a post.
- streetsign_server.views.feeds_and_posts.posts()¶
(HTML) list of ALL posts. (also deletes broken posts, if error)
- streetsign_server.views.feeds_and_posts.posts_bulk_delete()¶
delete multiple posts at once via AJAX
- streetsign_server.views.feeds_and_posts.posts_housekeeping()¶
goes through all posts, move ‘old’ posts to archive status, delete reeeeealy old posts.
User uploaded files¶
streetsign_server.views.user_files¶
Views for working with user-uploaded files.
- streetsign_server.views.user_files.allow_filetype(filename)¶
is this file-type allowed to be uploaded?
- streetsign_server.views.user_files.human_size_str(filename)¶
returns a human-readable size (string) of a file-name
- streetsign_server.views.user_files.make_dirlist(path)¶
returns a list of the files and sub-dirs in a directory, ready to be JSON encoded, and sent to a client, or rendererd server-side.
- streetsign_server.views.user_files.thumbnail(filename)¶
return a thumbnail of an (image) file. if one doesn’t exist, create one (with imagemagick(convert))
- streetsign_server.views.user_files.user_files_list(dir_name='')¶
HTML list of user-uploaded files.
- streetsign_server.views.user_files.user_fonts()¶
return a list of (name, url) tuples for all user-available fonts.
- streetsign_server.views.user_files.user_fonts_css()¶
return a CSS file with @font-face definitions for each font in the user uploaded fonts directory