Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(24)  |  Call(24)  |  Derive(0)  |  Import(0)

src/f/l/flask-social-example-HEAD/app/views.py   flask-social-example(Download)
def login():
    if current_user.is_authenticated():
        return redirect(request.referrer or '/')
 
    return render_template('login.html', form=LoginForm())
def register(provider_id=None):
    if current_user.is_authenticated():
        return redirect(request.referrer or '/')
 
    form = RegisterForm()

src/a/r/argos-HEAD/argos/web/api/user.py   argos(Download)
    def get(self):
        if current_user.is_authenticated():
            return current_user
        else:
            return unauthorized()
 
    @marshal_with(fields.user)
    def patch(self):
        if current_user.is_authenticated():
    def get(self):
        if current_user.is_authenticated():
            return current_user.watching
        else:
            return unauthorized()
    def post(self):
        if current_user.is_authenticated():
    def get(self, id):
        if current_user.is_authenticated():
            if id in [watched.id for watched in current_user.watching]:
                return '', 204
            return abort(404)

src/a/r/argos-HEAD/argos/web/front/user.py   argos(Download)
def feed():
    page = int(request.args.get('page', 1))
 
    if current_user.is_authenticated() and len(current_user.watching) > 0:
        # Get all the events which belong to stories that the user is watching.
def watching():
    if current_user.is_authenticated():
        events = models.Event.query.join(models.Event.stories).filter(models.Event.stories.any(models.Story.id.in_([story.id for story in current_user.watching]))).all()
        return render_template('events/collection.jade', events=events, title='The latest from stories you\'re watching', empty_msg='You aren\'t watching any stories!')
    else:
def watch():
    if current_user.is_authenticated():
        id = request.args.get('story_id', None)
        if id is None:
            return 'You must specify an story_id', 400
def bookmark():
    if current_user.is_authenticated():
        id = request.args.get('event_id', None)
        if id is None:
            return 'You must specify an event_id', 400
def bookmarks():
    if current_user.is_authenticated():
        events = current_user.bookmarked
        return render_template('events/collection.jade', events=events, title='Your bookmarks', empty_msg='You haven\'t bookmarked anything!')
    else:

src/q/u/quokka-0.2.0/quokka/core/admin/models.py   quokka(Download)
    def _handle_view(self, name, *args, **kwargs):
        if not current_user.is_authenticated():
            return redirect(url_for_security('login', next="/admin"))
        if not self.is_accessible():
            return self.render("admin/denied.html")

src/a/r/argos-HEAD/argos/web/api/oauth.py   argos(Download)
        # The user must authenticate herself,
        # if not already authenticated.
        if not current_user.is_authenticated():
            return redirect(url_for('security.login', next=url_for('authorize')))
 
def client():
    if not current_user.is_authenticated():
        return redirect('/')
    client = Client(
        client_id=gen_salt(40),

src/q/u/quokka-0.2.0/quokka/modules/comments/views.py   quokka(Download)
            comment = Comment(path=path)
            form.populate_obj(comment)
            if current_user.is_authenticated():
                # TODO: logic to auto publish comments
                comment.published = True

src/q/u/quokka-0.2.0/quokka/utils/__init__.py   quokka(Download)
def get_current_user():
    from flask.ext.security import current_user
    try:
        if not current_user.is_authenticated():
            return None

src/q/u/quokka-cart-HEAD/views.py   quokka-cart(Download)
    def needs_login(self, **kwargs):
        if not current_user.is_authenticated():
            next = kwargs.get('next', request.values.get('next', '/cart'))
            return redirect(url_for_security('login', next=next))