<s> from flask . ext . babel import lazy_gettext as _ <EOL> import flask <EOL> import wtforms <EOL> import auth <EOL> import config <EOL> import i18n <EOL> import model <EOL> import util <EOL> from main import app <EOL> @ app . route ( '<STR_LIT>' ) <EOL> @ auth . admin_required <EOL> def admin ( ) : <EOL> return flask . render_template ( <EOL> '<STR_LIT>' , <EOL> title = _ ( '<STR_LIT>' ) , <EOL> html_class = '<STR_LIT>' , <EOL> ) <EOL> class ConfigUpdateForm ( i18n . Form ) : <EOL> analytics_id = wtforms . StringField ( model . Config . analytics_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> announcement_html = wtforms . TextAreaField ( model . Config . announcement_html . _verbose_name , filters = [ util . strip_filter ] ) <EOL> announcement_type = wtforms . SelectField ( model . Config . announcement_type . _verbose_name , choices = [ ( t , t . title ( ) ) for t in model . Config . announcement_type . _choices ] ) <EOL> anonymous_recaptcha = wtforms . BooleanField ( model . Config . anonymous_recaptcha . _verbose_name ) <EOL> brand_name = wtforms . StringField ( model . Config . brand_name . _verbose_name , [ wtforms . validators . required ( ) ] , filters = [ util . strip_filter ] ) <EOL> check_unique_email = wtforms . BooleanField ( model . Config . check_unique_email . _verbose_name ) <EOL> email_authentication = wtforms . BooleanField ( model . Config . email_authentication . _verbose_name ) <EOL> feedback_email = wtforms . StringField ( model . Config . feedback_email . _verbose_name , [ wtforms . validators . optional ( ) , wtforms . validators . email ( ) ] , filters = [ util . email_filter ] ) <EOL> flask_secret_key = wtforms . StringField ( model . Config . flask_secret_key . _verbose_name , [ wtforms . validators . optional ( ) ] , filters = [ util . strip_filter ] ) <EOL> locale = wtforms . SelectField ( model . Config . locale . _verbose_name , choices = config . LOCALE_SORTED ) <EOL> notify_on_new_user = wtforms . BooleanField ( model . Config . notify_on_new_user . _verbose_name ) <EOL> recaptcha_private_key = wtforms . StringField ( model . Config . recaptcha_private_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> recaptcha_public_key = wtforms . StringField ( model . Config . recaptcha_public_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> salt = wtforms . StringField ( model . Config . salt . _verbose_name , [ wtforms . validators . optional ( ) ] , filters = [ util . strip_filter ] ) <EOL> verify_email = wtforms . BooleanField ( model . Config . verify_email . _verbose_name ) <EOL> @ app . route ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ auth . admin_required <EOL> def admin_config ( ) : <EOL> config_db = model . Config . get_master_db ( ) <EOL> form = ConfigUpdateForm ( obj = config_db ) <EOL> if form . validate_on_submit ( ) : <EOL> form . populate_obj ( config_db ) <EOL> if not config_db . flask_secret_key : <EOL> config_db . flask_secret_key = util . uuid ( ) <EOL> if not config_db . salt : <EOL> config_db . salt = util . uuid ( ) <EOL> config_db . put ( ) <EOL> reload ( config ) <EOL> app . config . update ( CONFIG_DB = config_db ) <EOL> return flask . redirect ( flask . url_for ( '<STR_LIT>' ) ) <EOL> return flask . render_template ( <EOL> '<STR_LIT>' , <EOL> title = _ ( '<STR_LIT>' ) , <EOL> html_class = '<STR_LIT>' , <EOL> form = form , <EOL> api_url = flask . url_for ( '<STR_LIT>' ) , <EOL> ) <EOL> class AuthUpdateForm ( i18n . Form ) : <EOL> bitbucket_key = wtforms . StringField ( model . Config . bitbucket_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> bitbucket_secret = wtforms . StringField ( model . Config . bitbucket_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> dropbox_app_key = wtforms . StringField ( model . Config . dropbox_app_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> dropbox_app_secret = wtforms . StringField ( model . Config . dropbox_app_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> facebook_app_id = wtforms . StringField ( model . Config . facebook_app_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> facebook_app_secret = wtforms . StringField ( model . Config . facebook_app_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> github_client_id = wtforms . StringField ( model . Config . github_client_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> github_client_secret = wtforms . StringField ( model . Config . github_client_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> google_client_id = wtforms . StringField ( model . Config . google_client_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> google_client_secret = wtforms . StringField ( model . Config . google_client_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> instagram_client_id = wtforms . StringField ( model . Config . instagram_client_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> instagram_client_secret = wtforms . StringField ( model . Config . instagram_client_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> linkedin_api_key = wtforms . StringField ( model . Config . linkedin_api_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> linkedin_secret_key = wtforms . StringField ( model . Config . linkedin_secret_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> microsoft_client_id = wtforms . StringField ( model . Config . microsoft_client_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> microsoft_client_secret = wtforms . StringField ( model . Config . microsoft_client_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> reddit_client_id = wtforms . StringField ( model . Config . reddit_client_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> reddit_client_secret = wtforms . StringField ( model . Config . reddit_client_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> twitter_consumer_key = wtforms . StringField ( model . Config . twitter_consumer_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> twitter_consumer_secret = wtforms . StringField ( model . Config . twitter_consumer_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> vk_app_id = wtforms . StringField ( model . Config . vk_app_id . _verbose_name , filters = [ util . strip_filter ] ) <EOL> vk_app_secret = wtforms . StringField ( model . Config . vk_app_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> yahoo_consumer_key = wtforms . StringField ( model . Config . yahoo_consumer_key . _verbose_name , filters = [ util . strip_filter ] ) <EOL> yahoo_consumer_secret = wtforms . StringField ( model . Config . yahoo_consumer_secret . _verbose_name , filters = [ util . strip_filter ] ) <EOL> @ app . route ( '<STR_LIT>' , methods = [ '<STR_LIT:GET>' , '<STR_LIT:POST>' ] ) <EOL> @ auth . admin_required <EOL> def admin_auth ( ) : <EOL> config_db = model . Config . get_master_db ( ) <EOL> form = AuthUpdateForm ( obj = config_db ) <EOL> if form . validate_on_submit ( ) : <EOL> form . populate_obj ( config_db ) <EOL> config_db . put ( ) <EOL> reload ( config ) <EOL> app . config . update ( CONFIG_DB = config_db ) <EOL> return flask . redirect ( flask . url_for ( '<STR_LIT>' ) ) <EOL> return flask . render_template ( <EOL> '<STR_LIT>' , <EOL> title = _ ( '<STR_LIT>' ) , <EOL> html_class = '<STR_LIT>' , <EOL> form = form , <EOL> api_url = flask . url_for ( '<STR_LIT>' ) , <EOL> ) <EOL> @ app . route ( '<STR_LIT>' ) <EOL> @ auth . admin_required <EOL> def admin_event_list ( ) : <EOL> event_dbs , next_cursor = util . get_dbs ( <EOL> model . Event . query ( ) , <EOL> limit = util . param ( '<STR_LIT>' , int ) , <EOL> cursor = util . param ( '<STR_LIT>' ) , <EOL> order = util . param ( '<STR_LIT>' ) or '<STR_LIT>' , <EOL> ) <EOL> if flask . request . path . startswith ( '<STR_LIT>' ) : <EOL> return util . jsonify_model_dbs ( event_dbs , next_cursor ) <EOL> return flask . render_template ( <EOL> '<STR_LIT>' , <EOL> html_class = '<STR_LIT>' , <EOL> title = '<STR_LIT>' , <EOL> event_dbs = event_dbs , <EOL> next_url = util . generate_next_url ( next_cursor ) , <EOL> ) </s>
