示例#1
0
def streamFollowing():
    template = 'user_stream.html'
    if current_user.is_authenticated:
        stream = current_user.get_stream()
        user = current_user
    else:
        flash("Login before accessing this page", "error")
        abort(404)
    return render_template(template, stream=stream, user=user)
示例#2
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        user = models.User.select().where(models.User.username**username).get()
        stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user
    if username:
        template = 'user_profile.html'
    return render_template(template, stream=stream, user=user)
示例#3
0
def stream(username=None):
    template = 'stream.html'
    # checking for the username
    if username and username != current_user.username:
        # making sure that it is not case senditive wiith **
        user = models.User.select().where(models.User.username**username).get()
        stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user
    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#4
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        try:
            user = models.User.select().where(models.User.username**username).get()
            stream = user.posts.limit(100)
        except models.DoesNotExist:
            abort(404)
    else:
        stream= current_user.get_stream().limit(100)
        user=current_user
    if username:
        template= 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#5
0
def stream(username = None):
	template = 'stream.html'
	if username and username != current_user.username:
		try:
			user = models.User.select().where(models.User.username**username).get()
		except models.DoesNotExist:
			abort(404)
		else:
			stream = user.posts.limit(100)
	else:
		stream = current_user.get_stream().limit(100)
		user = current_user
	if username:
		template = 'user_stream.html'
	return render_template(template, stream = stream, user = user)
示例#6
0
def tacos(email=None):
    template = 'index.html'
    if email and email != current_user.email:
        try:
            user = models.User.select().where(models.User.email == email).get()
        except models.DoesNotExist:
            pass
        else:
            tacos = user.tacos.limit(100)
    else:
        tacos = current_user.get_stream().limit(100)
        user = current_user
    if email:
        template = 'user_stream.html'
    return render_template(template, user=user, tacos=tacos)
示例#7
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        try:
            # '**' comparação sem levar em conta letra capitalizadas
            user = models.User.select().where(models.User.username**username).get()
        except models.DoesNotExist:
            abort(404)
        else:
            stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user
    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#8
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        try:
            user = models.User.select(
            ).where(models.User.username**username).get(
            )  # ** let the user write anything regardless it it's on UPPERCASE or lowercase
        except models.DoesNotExist:
            abort(404)
        else:
            stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user
    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#9
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        # ** is like comparison ignoring the  text case
        try:
            user = models.User.select().where(models.User.username**username).get()
        except models.DoesNotExist:
            abort(404)
        else:
            stream = user.posts
    else:
        stream = current_user.get_stream()
        user = current_user

    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#10
0
def stream(username=None):
    template = 'stream.html'
    if username and username != current_user.username:
        # ** is like comparison ignoring the  text case
        try:
            user = models.User.select().where(
                models.User.username**username).get()
        except models.DoesNotExist:
            abort(404)
        else:
            stream = user.posts
    else:
        stream = current_user.get_stream()
        user = current_user

    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)
示例#11
0
def stream(username=None):
    template = "stream.html"
    try:
        if username and username != current_user.username:
            try:    
                user = models.User.select().where(models.User.username**username).get()
            except models.DoesNotExists:
                abort(404)
            else:
                stream = user.posts.limit(100)
        else:
            stream = current_user.get_stream().limit(100)
            user = current_user
        if username:
            template = "user_stream.html"
    except AttributeError:
        about(404)
        return render_template(template, stream=stream, user=user)
示例#12
0
def stream(username=None):
    template = 'stream.html'  # Template por defecto
    if username and username != current_user.username:
        try:
            user = modelos.User.select().where(
                modelos.User.username**
                username).get()  # Nombre parecido, uncase sensitive
        except modelos.DoesNotExist:
            abort(404)
        else:
            stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user

    if username:
        template = 'user_stream.html'

    return render_template(template, stream=stream, user=user)
示例#13
0
文件: app.py 项目: rajrajhans/wetalk
def stream(username=None, myprofile=None):
    template = 'stream.html'
    if myprofile == 1:
        pass
    else:
        if username and username != current_user.username:
            try:
                user = models.User.select().where(
                    models.User.username**username).get()
            except:
                abort(404)
            else:
                stream = user.get_posts()
        else:
            stream = current_user.get_stream()
            user = current_user
    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user, format=format)
示例#14
0
def stream(username=None):
    template = "stream.html"
    if username and username != current_user.username:
        try:
            # where User.username "is like (regardless of case) username"
            user = models.User.select().where(
                models.User.username**username).get()
        except models.DoesNotExist:
            abort(404)  # file (user) does not exist
        else:
            stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user

    if username:
        template = "user_stream.html"

    return render_template(template, stream=stream, user=user)
示例#15
0
def stream(username=None):
    template = 'stream.html'
    if current_user.is_authenticated:
        cur_usr_name = current_user.username
    else:
        cur_usr_name = "***no_actual_user_name_should_ever_match_this***"
    if username and username != cur_usr_name:
        try:
            user = models.User.select().where(
                models.User.username**username).get()
        except models.DoesNotExist:
            abort(404)
        else:
            stream = user.posts.limit(100)
    else:
        stream = current_user.get_stream().limit(100)
        user = current_user
    if username:
        template = 'user_stream.html'
    return render_template(template, stream=stream, user=user)