Пример #1
0
    def post(self):
        venture_vals = {}
        venture = Venture()
        venture_keys = ["name", "street", "street2", "city", "county",
                        "postcode", "latitude", "longitude",
                        "category", "website", "email", "phone"]
        for item in venture_keys:
            venture_vals[item] = cgi.escape(self.request.get(item))
        for value in venture_vals:
            setattr(venture, value, str(venture_vals[value]))

        try:
            image = self.request.get('img')
            venture.logo = db.Blob(image)
        except:
            pass

        if "http://" in venture.website:
            venture.website = venture.website.replace("http://", "")

        venture.approved = False
        venture.save()

        send_addition_email(venture)

        # flush on successful save to force cache rebuild
        memcache.flush_all()
        template_vars = {"venture" : venture}

        template = template_env.get_template("unapproved.html")
        time.sleep(3) #Errors switching from add to unapproved, adding delay to try and fix.

        self.response.out.write(template.render(template_vars))
Пример #2
0
    def post(self):
        venture_vals = {}
        venture = Venture()
        venture_keys = ["name", "street", "city", "county",
                        "postcode", "latitude", "longitude",
                        "category", "website", "email", "phone"]
        for item in venture_keys:
            venture_vals[item] = cgi.escape(self.request.get(item))
        for value in venture_vals:
            setattr(venture, value, str(venture_vals[value]))

        try:
            image = self.request.get('img')
            venture.logo = db.Blob(image)
        except:
            pass

        venture.approved = False
        venture.save()

        # flush on successful save to force cache rebuild
        memcache.flush_all()

        self.redirect("/venture/?uniqueid=%d" % venture.uniqueid)