Beispiel #1
0
def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    data = data.to_dict()
    data['current_posts'] = []

    try:
        tweets = get_new(data)
    except Exception as e:  #pylint: disable=broad-except
        return '<h1>Invalid settings</h1><pre>' + str(e) + '</pre>'
    return render_template_string(my('test.html'), tweets=tweets)
Beispiel #2
0
def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    data = data.to_dict()
    data['current_posts'] = []

    try:
        tweets = get_new(data)
    except Exception as e: #pylint: disable=broad-except
        return '<h1>Invalid settings</h1><pre>' + str(e) + '</pre>'
    return render_template_string(my('test.html'), tweets=tweets)
Beispiel #3
0
def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    try:
        feed = feedparser.parse(data['url'])
    except Exception as e:
        return 'invalid url({})'.format(str(e))

    try:
        first_post = feed.entries[0]
        example_post = make_templater(data)(first_post)
    except Exception as e:
        example_post = str(e)

    return render_template_string(my('test.html'), feed=feed,
        example_post=example_post)
Beispiel #4
0
def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    try:
        feed = feedparser.parse(data['url'])
    except Exception as e:
        return 'invalid url({})'.format(str(e))

    try:
        first_post = feed.entries[0]
        example_post = make_templater(data)(first_post)
    except Exception as e:
        example_post = str(e)

    return render_template_string(my('test.html'),
                                  feed=feed,
                                  example_post=example_post)
def form(data):
    ''' the form for editing this type of post '''
    # pylint: disable=star-args
    return render_template_string(my('form.html'),
                                  default_tags=DEFAULT_TAGS,
                                  **data)
Beispiel #6
0
def form(data):
    ''' the form for editing this type of post '''
    # pylint: disable=star-args
    return render_template_string(my('form.html'),
                                  default_tags=DEFAULT_TAGS, **data)
Beispiel #7
0
        "api_secret": request.form.get('api_secret', ''),
        "user_key": request.form.get('user_key', ''),
        "user_secret": request.form.get('user_secret', ''),
        "current_posts": current_posts,
    }  #pylint: disable=bad-continuation


def form(data):
    ''' the form for editing this type of post '''
    # pylint: disable=star-args
    return render_template_string(my('form.html'),
                                  default_tags=DEFAULT_TAGS,
                                  **data)


TWEET_TEMPLATE = Template(my('tweet.html'))


def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    data = data.to_dict()
    data['current_posts'] = []

    try:
        tweets = get_new(data)
    except Exception as e:  #pylint: disable=broad-except
        return '<h1>Invalid settings</h1><pre>' + str(e) + '</pre>'
    return render_template_string(my('test.html'), tweets=tweets)
Beispiel #8
0
            "api_key": request.form.get('api_key', ''),
            "api_secret": request.form.get('api_secret', ''),
            "user_key": request.form.get('user_key', ''),
            "user_secret": request.form.get('user_secret', ''),

            "current_posts": current_posts,
            } #pylint: disable=bad-continuation

def form(data):
    ''' the form for editing this type of post '''
    # pylint: disable=star-args
    return render_template_string(my('form.html'),
                                  default_tags=DEFAULT_TAGS, **data)

TWEET_TEMPLATE = Template(my('tweet.html'))

def test(data):
    ''' we get sent a copy of the data, and should reply with some HTML
        that reassures the user if the url/whatever is correct (preferably
        with some data from the feed) '''

    data = data.to_dict()
    data['current_posts'] = []

    try:
        tweets = get_new(data)
    except Exception as e: #pylint: disable=broad-except
        return '<h1>Invalid settings</h1><pre>' + str(e) + '</pre>'
    return render_template_string(my('test.html'), tweets=tweets)