Esempio n. 1
0
def edit_post():
    username = None
    user = None
    if 'username' in session:
        username = session['username']
        user = model.get_user(username)

    safe = model.check_location(username)
    if request.method == 'GET':
        post_id = request.args.get('id')
        try:
            post = model.get_post(post_id)
            if not post.author == user.username:
                logging.debug("edit_post1: Found exception(User is not the author of the post)")
                return error("User is not the author of the post")
            if post.type == "Secret" and not safe:
                return error("User is not in safe location")
        except Exception as e:
            logging.debug("edit_post1: Found exception(%s)" % e)
            return error("Error: Could not load the post")
        return render_template('edit_post.html', current_user=user, post=post, safe=safe)

    new_content = request.form['content']
    new_type = request.form['type']
    post_id = request.form['id']

    logging.debug("edit_post: Trying (%s, %s)" % (new_content, new_type))

    if not new_content:
        flash("You need to introduce some content.", 'error')
        if (post.type == "Secret" or new_type == "Secret") and not safe:
            return error("User is not in safe location")
        return render_template('edit_post.html', current_user=user, post=post, safe=safe)

    try:
        post = model.get_post(post_id)
        if not post.author == user.username:
            logging.debug("edit_post1: Found exception(User is not the author of the post)")
            return error("User is not the author of the post")
        if post.type == "Secret" and not safe:
            return error("User is not in safe location")
        new_post = model.edit_post(post_id, new_content, new_type)
    except Exception as e:
        logging.debug("edit_post2: Found exception(%s)" % e)
        return error("Error: Could not edit the post")

    if new_post:
        flash("Succesfully edited post",)
        logging.debug("edit_post: Succesful (%s)" % (username))
    else:
        flash("Could not edit post",)

    return redirect(url_for('home'))
Esempio n. 2
0
 def POST(self, post_id):
     if not session.admin:
         authorization_error()
     post_id = int(post_id)
     post = model.get_post(post_id)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     if not form.validates():
         post = model.get_post(post_id)
         return render.newitem(post, form)
     for idx in range(int(form.d.count)):
         model.new_help_item(post_id, utils.standardize_date(form.d.date), form.d.description)
     raise web.seeother('/view/%d' % post_id)
Esempio n. 3
0
 def POST(self, post_id):
     if not session.admin:
         authorization_error()
     post_id = int(post_id)
     post = model.get_post(post_id)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     if not form.validates():
         post = model.get_post(post_id)
         return render.newitem(post, form)
     for idx in range(int(form.d.count)):
         model.new_help_item(post_id, utils.standardize_date(form.d.date),
                             form.d.description)
     raise web.seeother('/view/%d' % post_id)
Esempio n. 4
0
 def GET(self, id):
     """
     show single post
     """
     post = model.get_post(int(id))
     pprint.pprint(post)
     return render.view(post=post)
Esempio n. 5
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     return render.delete(post)
Esempio n. 6
0
 def POST(self, id):
     form = New.form()
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.title, form.d.content)
     raise web.seeother('/')
Esempio n. 7
0
 def POST(self,id):
     post=model.get_post(int(id))
     model.update_post(int(id),web.input().post_author,web.input().post_title,web.input().post_text)
     if web.cookies().get('username')=='admin':
         raise web.seeother('/backstage')
     else:
         raise web.seeother('/')
Esempio n. 8
0
 def POST(self, id):
     form = New.form()
     post = model.get_post(int(id))  # 获取这个是为了假提交时,进入编辑界面
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.title, form.d.content)  # 这个d的方法会被淘汰吗
     raise web.seeother("/")
Esempio n. 9
0
 def GET(self, id):
     print("i get")
     post = model.get_post(int(id))
     print("post is " % post)
     form = New.form()
     form.fill(post)
     return render.edit(post, form)  # 既然填好了form ,为什么还要交post
Esempio n. 10
0
 def POST(self, id):
     form = New.form()
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.title, form.d.content)
     raise web.seeother("/")
Esempio n. 11
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     return render.delete(post)
Esempio n. 12
0
 def GET(self, id):
     print id
     post = model.get_post(int(id))
     print post
     # return render.view(post)
     comments = model.get_comments_by_blog(id)
     return render.view(post, comments)
Esempio n. 13
0
 def GET(self, id):
     """
     show single post
     """
     post = model.get_post(int(id))
     pprint.pprint(post)
     return render.view(post=post)
Esempio n. 14
0
 def GET(self, item_id):
     if not session.admin:
         authorization_error()
     item = model.get_item(int(item_id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     return render.deleteitem(post, item)
Esempio n. 15
0
 def GET(self, item_id):
     if not session.admin:
         authorization_error()
     item = model.get_item(int(item_id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     return render.deleteitem(post, item)
Esempio n. 16
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 17
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     model.del_post(int(id))
     raise web.seeother('/')
Esempio n. 18
0
 def POST(self, blogid):
     form = self.form()
     if not form.validates():
         post = model.get_post(int(blogid))
         comments = model.get_comments(int(blogid))
         return render.view(post, comments, form)
     else:
         model.new_comment(blogid, form.d.author, form.d.comment)
         web.seeother("/view/" + blogid)
Esempio n. 19
0
def timeline():
	if request.method=='POST':
		file=request.files['file']
		full_filename = os.path.join(app.config['UPLOAD_FOLDER'],file.filename)
		file.save(full_filename)
		create_post(full_filename)
	db_image_data=get_post()	
	image_data=rev_uniq(db_image_data)
	return render_template('index.html',user_image=image_data)
Esempio n. 20
0
 def GET(self, post_id):
     if not session.admin:
         authorization_error()
     post_id = int(post_id)
     post = model.get_post(post_id)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     return render.newitem(post, form)
Esempio n. 21
0
    def POST(self, id):
        form = New.form()
        post = model.get_post(int(id))

        if not form.validates():
            return render.edit(post, form)
        if post.user_id == auth.getUser().user_id:
            model.update_post(int(id), form.d.title, form.d.content)
        raise web.seeother("/")
Esempio n. 22
0
def get_post():
    model.conn_db()
    post_id = request.args.get("post_id")
    print "post is: " , post_id
    #need to fix this so I decide whether to search for title or id
    list_posts = model.get_post(title=post_id)
    print "list_posts is: " , list_posts
    html = render_template("post.html",list_posts=list_posts)
    return html
Esempio n. 23
0
 def GET(self, id):
     """
     edit posts
     """
     post = model.get_post(int(id))
     form = New.form()
     form.fill(post)
     pprint.pprint(form)
     return render.edit(post=post, form=form)
Esempio n. 24
0
 def POST(self, item_id):
     if not session.admin:
         authorization_error()
     item_data = model.get_item(int(item_id))
     post = model.get_post(item_data.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     post_id = model.del_help_item(int(item_id))
     raise web.seeother('/view/%d' % item_data.helpRequestId)
Esempio n. 25
0
 def GET(self, id):
     """ View single post """
     post = model.get_post(int(id))
     time = post.posted_on
     time_str = str(time)
     time_split = time_str.split(' ')
     date = time_split[0]
     time = time_split[1]
     return render.view(post,date)
Esempio n. 26
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = New.form()
     form.fill(post)
     return render.edit(post, form)
Esempio n. 27
0
 def GET(self, id):
     """
     edit posts
     """
     post = model.get_post(int(id))
     form = New.form()
     form.fill(post)
     pprint.pprint(form)
     return render.edit(post=post, form=form)
Esempio n. 28
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = New.form()
     form.fill(post)
     return render.edit(post, form)
Esempio n. 29
0
 def GET(self, post_id):
     if not session.admin:
         authorization_error()
     post_id = int(post_id)
     post = model.get_post(post_id)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     return render.newitem(post, form)
Esempio n. 30
0
 def POST(self, item_id):
     if not session.admin:
         authorization_error()
     item_data = model.get_item(int(item_id))
     post = model.get_post(item_data.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     post_id = model.del_help_item(int(item_id))
     raise web.seeother('/view/%d' % item_data.helpRequestId)
Esempio n. 31
0
 def POST(self, id):
     id_producto = int(id)
     form = New.form()
     post = model.get_post(id_producto)
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.producto, form.d.descripcion,
                       form.d.existencias, form.d.precio_compra,
                       form.d.precio_venta)
     raise web.seeother('/')
Esempio n. 32
0
 def POST(self, id):
     form = New.form()
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post, form)
     if str(form.d.password) == '123':
         model.update_post(int(id), form.d.title, form.d.content, form.d.link, form.d.link_name)
         raise web.seeother('/')
     else:
         return render.edit(post, form)
Esempio n. 33
0
 def GET(self, id):
     item = model.get_item(int(id))
     #TODO: should error checking like this be done elsewhere?
     if not item:   # Requested item doesn't exist
         raise web.seeother('/')
     if item.helpName:  # Someone has already signed up for this item
         raise web.seeother('/error/item_help_provided?req_id=%d' % int(item.helpRequestId))
     post = model.get_post(item.helpRequestId)
     form = self.form()
     return render.helpsignup(post, item, form)
Esempio n. 34
0
 def POST(self, id):
     form = New.form()
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post=post, form=form)
     if cjutils.auth_user():
         model.update_post(int(id), form.d.title, form.d.content)
         raise web.seeother('/')
     else:
         web.setcookie('logined', 'False', 0)
Esempio n. 35
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     item = model.get_item(int(id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     form.fill(item)
     return render.edititem(post, item, form)
Esempio n. 36
0
 def GET(self, id):
     if not session.admin:
         authorization_error()
     item = model.get_item(int(id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     form = self.form()
     form.fill(item)
     return render.edititem(post, item, form)
Esempio n. 37
0
 def GET(self, id):
     item = model.get_item(int(id))
     #TODO: should error checking like this be done elsewhere?
     if not item:  # Requested item doesn't exist
         raise web.seeother('/')
     if item.helpName:  # Someone has already signed up for this item
         raise web.seeother('/error/item_help_provided?req_id=%d' %
                            int(item.helpRequestId))
     post = model.get_post(item.helpRequestId)
     form = self.form()
     return render.helpsignup(post, item, form)
Esempio n. 38
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     #TODO: take care of display issue with details (textarea data)
     form = New.form()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.title, form.d.details)
     raise web.seeother('/view/%d' % int(id))
Esempio n. 39
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     #TODO: take care of display issue with details (textarea data)
     form = New.form()
     post = model.get_post(int(id))
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.title, form.d.details)
     raise web.seeother('/view/%d' % int(id))
Esempio n. 40
0
def sendConfirmationEmail(item_id):
    # don't even attempt if email config info has not been provided
    if not web.config.smtp_username:
        print "WARNING: email user/password not configured.  Ignoring attempt to send confirmation email."
        return

    item = model.get_item(int(item_id))
    # Get contact info for the help item
    post_data = model.get_post(int(item.helpRequestId))
    contact_data = model.get_contact_data(post_data.contactId)
    item.contactName = contact_data.name
    item.contactEmail = contact_data.email
    item.contactPhone = contact_data.phone
    item.url = "%s/view/%s" % (config.SITE_BASE, item.helpRequestId)
    item.date = utils.convert_date(item.date)

    if item.helpEmail:
        f = web.config.smtp_username
        to = item.helpEmail
        cc = item.contactEmail
        subject = 'Confirmation: you signed up to help on %(date)s' % item
        msg = """Thanks for you willingness to help.
        
This email is to confirm that you signed up to help on %(date)s for the item "%(description)s".  More details can be found here:
        
%(url)s
        
If you have any questions don't reply to this email.  Instead contact %(contactName)s
    email: %(contactEmail)s
    phone: %(contactPhone)s

Thanks!""" % item
        #print f, to, subject, msg
        web.sendmail(f,to,subject,msg,cc=cc)
    else:
        # The person did not provide an email.  Instead an email will be sent
        # to the contact person informing them of the situation.
        f = web.config.smtp_username
        to = item.contactEmail
        subject = 'Confirmation: Helper with no email'
        msg = """%(helpName)s signed up to help on %(date)s for item 
"%(description)s" but did not provide an email address.
        
Since no email is present, the website will be unable to provide them an automatic reminder.

Details can be found here:
        
%(url)s
""" % item
        #print f, to, subject, msg
        web.sendmail(f,to,subject,msg)
Esempio n. 41
0
def sendConfirmationEmail(item_id):
    # don't even attempt if email config info has not been provided
    if not web.config.smtp_username:
        print("WARNING: email user/password not configured.  Ignoring attempt to send confirmation email.")
        return

    item = model.get_item(int(item_id))
    # Get contact info for the help item
    post_data = model.get_post(int(item.helpRequestId))
    contact_data = model.get_contact_data(post_data.contactId)
    item.contactName = contact_data.name
    item.contactEmail = contact_data.email
    item.contactPhone = contact_data.phone
    item.url = "%s/view/%s" % (config.SITE_BASE, item.helpRequestId)
    item.date = utils.convert_date(item.date)

    if item.helpEmail:
        f = web.config.smtp_username
        to = item.helpEmail
        cc = item.contactEmail
        subject = 'Confirmation: you signed up to help on %(date)s' % item
        msg = """Thanks for you willingness to help.
        
This email is to confirm that you signed up to help on %(date)s for the item "%(description)s".  More details can be found here:
        
%(url)s
        
If you have any questions don't reply to this email.  Instead contact %(contactName)s
    email: %(contactEmail)s
    phone: %(contactPhone)s

Thanks!""" % item
        #print f, to, subject, msg
        web.sendmail(f,to,subject,msg,cc=cc)
    else:
        # The person did not provide an email.  Instead an email will be sent
        # to the contact person informing them of the situation.
        f = web.config.smtp_username
        to = item.contactEmail
        subject = 'Confirmation: Helper with no email'
        msg = """%(helpName)s signed up to help on %(date)s for item 
"%(description)s" but did not provide an email address.
        
Since no email is present, the website will be unable to provide them an automatic reminder.

Details can be found here:
        
%(url)s
""" % item
        #print f, to, subject, msg
        web.sendmail(f,to,subject,msg)
Esempio n. 42
0
 def POST(self, id):
     form = self.form()
     item = model.get_item(int(id))
     if not item:   # Requested item doesn't exist
         raise web.seeother('/')
     if item.helpName:  # Someone has already signed up for this item
         raise web.seeother('/error/item_help_provided?req_id=%d' % int(item.helpRequestId))
     if not form.validates():
         post = model.get_post(item.helpRequestId)
         return render.helpsignup(post, item, form)
     model.update_help_item(int(id), item.date, item.description, 
                  form.d.helpName, form.d.helpEmail, form.d.helpPhone)
     emailconfirm.sendConfirmationEmail(int(id))
     raise web.seeother('/helpconfirm/%d' % item.id)
Esempio n. 43
0
 def POST(self, id):
     # 1. 删除静态资源照片
     post = model.get_post(int(id))
     photo_name = post.imageAddr.split('/')[-1]
     logger.debug('need delete photo path: ' + "/root/images/" + photo_name)
     try:
         os.remove("/root/images/" + photo_name)
     except Exception as e:
         logger.error(e)
     # 2. 删除表中记录
     model.del_post(int(id))
     #raise web.seeother("/")
     posts = model.get_posts()
     return render.index(posts)
Esempio n. 44
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     #TODO: take care of display issue with details (textarea data)
     form = self.form()
     item = model.get_item(int(id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     if not form.validates():
         return render.edititem(post, item, form)
     model.update_help_item(int(id), utils.standardize_date(form.d.date), form.d.description, 
                  form.d.helpName, form.d.helpEmail, form.d.helpPhone)
     raise web.seeother('/view/%d' % item.helpRequestId)
Esempio n. 45
0
 def POST(self, id):
     if not session.admin:
         authorization_error()
     #TODO: take care of display issue with details (textarea data)
     form = self.form()
     item = model.get_item(int(id))
     post = model.get_post(item.helpRequestId)
     if not model.authorized_user(session.userId, post.contactId):
         authorization_error()
     if not form.validates():
         return render.edititem(post, item, form)
     model.update_help_item(int(id), utils.standardize_date(form.d.date),
                            form.d.description, form.d.helpName,
                            form.d.helpEmail, form.d.helpPhone)
     raise web.seeother('/view/%d' % item.helpRequestId)
Esempio n. 46
0
 def POST(self, id):
     form = New.form()
     imagen = web.input(imagen_producto={})
     filedir = 'static/images'
     filepath = imagen.imagen.filename.replace('\\','/')
     filename = filepath.split('/')[-1]
     fout= open(filedir+'/'+filename,'w')
     fout.write(imagen.imagen.file.read())
     fout.close()
     imagen = filename
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.nombre, form.d.descripcion, form.d.existencias, form.d.precio_compra, form.d.precio_venta, imagen)
     raise web.seeother('/')
Esempio n. 47
0
 def GET(self, id):
     """ View single post """
     id = int(id)
     post_data = model.get_post(id)
     if not post_data:
         argument_error()
     if session.admin and not model.authorized_user(session.userId, post_data.contactId):
         authorization_error()
     # Modify details of post_data for display.  Need to be able to handle
     # newlines in textarea data in a websafe way.
     post_data.details = web.net.websafe(post_data.details)
     post_data.details = utils.nl2br(post_data.details)
     item_data = model.get_items(id)
     contact_data = model.get_contact_data(post_data.contactId)
     return render.view(post_data, item_data, contact_data)
Esempio n. 48
0
 def GET(self, id):
     """ View single post """
     id = int(id)
     post_data = model.get_post(id)
     if not post_data:
         argument_error()
     if session.admin and not model.authorized_user(session.userId,
                                                    post_data.contactId):
         authorization_error()
     # Modify details of post_data for display.  Need to be able to handle
     # newlines in textarea data in a websafe way.
     post_data.details = web.net.websafe(post_data.details)
     post_data.details = utils.nl2br(post_data.details)
     item_data = model.get_items(id)
     contact_data = model.get_contact_data(post_data.contactId)
     return render.view(post_data, item_data, contact_data)
Esempio n. 49
0
 def POST(self, id):
     form = self.form()
     item = model.get_item(int(id))
     if not item:  # Requested item doesn't exist
         raise web.seeother('/')
     if item.helpName:  # Someone has already signed up for this item
         raise web.seeother('/error/item_help_provided?req_id=%d' %
                            int(item.helpRequestId))
     if not form.validates():
         post = model.get_post(item.helpRequestId)
         return render.helpsignup(post, item, form)
     model.update_help_item(int(id), item.date, item.description,
                            form.d.helpName, form.d.helpEmail,
                            form.d.helpPhone)
     emailconfirm.sendConfirmationEmail(int(id))
     raise web.seeother('/helpconfirm/%d' % item.id)
Esempio n. 50
0
 def GET(self, id):
     """ View single post """
     # TODO: make the post test render as htmnl
     post = model.get_post(int(id))
     user = model.getUserById(post.user_id)
     comments = model.get_comments(int(id))
     renderedComments = ""
     if comments:
         renderedComments = renderInsert.comments(comments, model)
     votes = model.get_votes(id)
     lUser = auth.getUser()
     if lUser:
         hasUserVoted = model.hasUserVoted(auth.getUser().user_id, post.id)
     else:
         hasUserVoted = False
     return render.view(post, user, renderedComments, self.form, hasUserVoted, votes)
Esempio n. 51
0
 def POST(self, id):
     form = New.form()
     imagen = web.input(imagen_usuario={})
     filedir = 'static/images'
     filepath = imagen.imagen_usaurio.filename.replace('\\', '/')
     filename = filepath.split('/')[-1]
     #copiar archivo al servidor
     fout = open(filedir + '/' + filename, 'w')
     fout.write(imagen.imagen_usuario.file.read())
     fout.close()
     imagen_usuario = filename
     post = model.get_post(int(id))
     if not form.validates():
         return render.edit(post, form)
     model.update_post(int(id), form.d.name, form.d.ap_paterno,
                       form.d.ap_materno, form.d.account_name, form.d.age,
                       form.d.email, form.d.password, imagen_usuario)
     raise web.seeother('/')
Esempio n. 52
0
def edit_post():
    if 'username' in session:
        username = session['username']
        current_user = model.get_user(username)

    if request.method == 'GET':
        post_id = request.args.get('id')
        try:
            post = model.get_post(post_id)
        except Exception as e:
            logging.debug("edit_post1: Found exception(%s)" % e)
            return error(e)
        return render_template('edit_post.html',
                               current_user=current_user,
                               post=post)

    new_content = html.escape(request.form['content'])
    new_type = html.escape(request.form['type'])
    post_id = html.escape(request.form['id'])

    logging.debug("edit_post: Trying (%s, %s)" % (new_content, new_type))

    if not new_content:
        flash("You need to introduce some content.", 'error')
        return render_template('edit_post.html',
                               current_user=current_user,
                               post=post)

    try:
        new_post = model.edit_post(post_id, new_content, new_type)
    except Exception as e:
        logging.debug("edit_post2: Found exception(%s)" % e)
        return error(e)

    if new_post:
        flash("Succesfully edited post", )
        logging.debug("edit_post: Succesful (%s)" % (username))
    else:
        flash("Could not edit post", )

    return redirect(url_for('home'))
Esempio n. 53
0
    def GET(self,id):
        """ View single post """
        form=self.form()
        
        if id > '0' : 
           post = model.get_post(int(id))
           glyphparam = model.get_glyphparam(int(id))
           groupparam = model.get_groupparam(int(id))         
           form.fill(post)
        posts = model.get_posts()
        postspa = model.get_postspa()
        formParam = self.formParam()
        formParamG = self.formParamG()
        if glyphparam != None :
           formParam.fill(glyphparam)
        if groupparam != None :
           formParamG.fill(groupparam)
        mastglobal = model.get_globalparam(cFont.idglobal)
        master = model.get_master(cFont.idmaster)
	webglyph = cFont.glyphName
        return render.view(posts,post,form,formParam,formParamG,master,mastglobal,webglyph,glyphparam,groupparam,cFont,postspa)
Esempio n. 54
0
    def GET(self, id):
        """ View single post """
        form = self.form()

        if id > '0':
            post = model.get_post(int(id))
            glyphparam = model.get_glyphparam(int(id))
            groupparam = model.get_groupparam(int(id))
            form.fill(post)
        posts = model.get_posts()
        postspa = model.get_postspa()
        formParam = self.formParam()
        formParamG = self.formParamG()
        if glyphparam != None:
            formParam.fill(glyphparam)
        if groupparam != None:
            formParamG.fill(groupparam)
        mastglobal = model.get_globalparam(cFont.idglobal)
        master = model.get_master(cFont.idmaster)
        webglyph = cFont.glyphName
        return render.view(posts, post, form, formParam, formParamG, master,
                           mastglobal, webglyph, glyphparam, groupparam, cFont,
                           postspa)
Esempio n. 55
0
 def GET(self, id):
     post = model.get_post(int(id))
     form = New.form()
     form.fill(post)
     return render.edit(post, form)
Esempio n. 56
0
 def GET(self, id):
     post = model.get_post(int(id))
     return render.view(post)
Esempio n. 57
0
 def GET(self, id):
     post = model.get_post(int(id))
     return render.edit(post)
Esempio n. 58
0
 def GET(self, id):
     return render.viewpost(id, model.get_post(id), self.newReplyForm, db)
Esempio n. 59
0
 def GET(self, id):
     """ View single post """
     post = model.get_post(int(id))
     return render.view(post)
Esempio n. 60
0
	def GET(self):
		web.header('Content-type','application/json')
		id = web.input(_method='get').postId
		post = model.get_post(int(id))
		return json.dumps(post,cls=CJsonEncoder)