Esempio n. 1
0
def register():
    access_token = request.values.get("access_token", None)
    if not access_token or access_token == "None":
        return render_template("facebook_app/register.html")
    try:
        graph = facebook.GraphAPI(access_token)
        profile = graph.get_object('me')
        settings = {
                'events': True,
                'friends': True,
                'notes': True,
                'albums': True,
                'links': True,
                'statuses': True,
                'photos': True}

        schedule = {
                'interval': 'daily',
                'timeofday': '0700'}
        schedule.update(schedule_to_form_time('0700'))

        save_settings("facebook_app",
                {'settings': settings,
                    'schedule': schedule,
                    'tokens': access_token,
                    'profile': profile})

        reload_schedules()

        return render_template("facebook_app/register.html")
    except Exception, e:
        logger.debug("%r", e)
Esempio n. 2
0
    
    try:
        profile = auth.get_profile()
    except Exception, e:
        logger.debug("authentication error: %r", e)
        flash("There was a problem authenticating you with Google. Please try again.", "error")
        return render_template("google_contacts_app/register.html")

    access_token = {'access_token': token.key,
            'access_token_secret': token.secret}

    schedule = {
            'interval': 'daily',
            'timeofday': '0700'}

    schedule.update(schedule_to_form_time('0700'))
    
    save_settings('google_contacts_app',
            {'schedule': schedule,
                'tokens': access_token,
                'profile': profile})

    reload_schedules()
    return render_template("google_contacts_app/register.html")
    

@module.route("/archives")
def archives():
    page, per_page = get_pagination_params(request)
    profile = get_settings("google_contacts_app")