示例#1
0
文件: main.py 项目: Thunae/CSSI
 def post(self):
     top_line = self.request.get("top-line")
     bottom_line = self.request.get("bottom-line")
     meme_url = self.request.get("template")
     newMeme = Meme(url = meme_url, top_text = top_line,bottom_text = bottom_line)
     newMeme.put()
     results = {
         "top" : top_line,
         "bottom" : bottom_line,
         "url" : meme_url
     }
     result_template = jinja_env.get_template('result.html')
     self.response.write(result_template.render(results))
     print(top_line)
示例#2
0
    def post(self):  
        results_template = the_jinja_env.get_template('templates/results.html')
        meme_first_line = self.request.get('user-first-ln')
        meme_second_line = self.request.get('user-second-ln')
        meme_img_choice = self.request.get('meme-type')

        user_meme = Meme(first_line = meme_first_line, 
                         second_line = meme_second_line,
                         pic_type = meme_img_choice)
        user_meme.put()
        the_variable_dict = {"line1": meme_first_line, 
                             "line2": meme_second_line, 
                             "img_url": user_meme.get_meme_url()}
        self.response.write(results_template.render(the_variable_dict)) 
示例#3
0
 def post(self):
     top_line = self.request.get("top-line")
     bottom_line = self.request.get("bottom-line")
     meme_url = self.request.get("template")
     data_dict = {
         "top_line": top_line,
         "bottom_line": bottom_line,
         "url": meme_url
     }
     meme1 = Meme(first_line=data_dict["top_line"],
                  second_line=data_dict["bottom_line"],
                  pic_type=data_dict["url"])
     meme1.put()
     result_template = the_jinja_env.get_template('templates/result.html')
     self.response.write(result_template.render(data_dict))
示例#4
0
 def post(self):
     meme = Meme(line1=self.request.get('user-first-ln'),
                 line2=self.request.get('user-second-ln'),
                 img_choice=self.request.get('meme-type'))
     meme_key = meme.put()
     self.response.write("Meme created: " + str(meme_key) + "<br>")
     self.response.write("<a href='/allmemes'>All memes</a>")
    def post(self):
        checkLoggedInAndRegistered(self)

        user = users.get_current_user()

        meme = Meme(line1=self.request.get('user-first-ln'),
                    line2=self.request.get('user-second-ln'),
                    owner=user.nickname(),
                    img_choice=self.request.get('meme-type'))
        meme_key = meme.put()
        self.response.write("Meme created: " + str(meme_key) + "<br>")
        self.response.write("<a href='/allmemes'>All memes</a> | ")
        self.response.write("<a href='/usermemes'>My memes</a>")
示例#6
0
    def post(self):
        user = users.get_current_user() # get current logged in user
        meme_key_string = self.request.get('meme_key')
        image_name = self.request.get('image')
        image_key = Image.query(Image.name == image_name).fetch(1)[0].key # get the key of the correct image by nickname

        if meme_key_string:
            meme = get_meme_from_key(meme_key_string)
            if meme.creator != user.user_id():
                self.response.status = "403 Forbidden"
                return
        else:
            meme = Meme()

        meme.top_text=self.request.get('top_text')
        meme.middle_text=self.request.get('middle_text')
        meme.bottom_text=self.request.get('bottom_text')
        meme.image=image_key
        meme.creator=user.user_id() # grab the user ID from currently logged in user, store with Meme

        meme_key = meme.put()
        self.redirect('/view?meme_key=' + meme_key.urlsafe())
示例#7
0
 def post(self):
     new_message = Meme(image_url=self.request.get('image_url'),
                        caption=self.request.get('caption'))
     new_message.put()
     time.sleep(0.5)
     self.redirect('/')
示例#8
0
文件: main.py 项目: kcheung/iOSCourse
 def post(self):
     new_message = Meme(image_url=self.request.get("image_url"), caption=self.request.get("caption"))
     new_message.put()
     time.sleep(0.5)
     self.redirect("/")
示例#9
0
def run_query(first_line, second_line, pic_type):
    meme = Meme(line1=first_line, line2=second_line, img_choice=pic_type)
    meme_key = meme.put()
    print("&&&&&&&&&&&&&&&&&&&&&&&&&")
    print meme_key