Exemplo n.º 1
0
 def get(self):
     #InputName=a&InputEmail=a%40b.com&InputEmail=a%40b.com&InputMessage=a&submit=Submit
     c = Company()
     c.name = self['InputName']
     c.email = self['InputEmail']
     c.details = self['InputMessage']
     c.put()
     self.redirect('/add_member')
Exemplo n.º 2
0
 def get(self):
     #InputName=a&InputEmail=a%40b.com&InputEmail=a%40b.com&InputMessage=a&submit=Submit
     c = Company()
     c.name = self['InputName']
     c.email = self['InputEmail']
     c.details = self['InputMessage']
     c.put()
     self.redirect('/add_member')
Exemplo n.º 3
0
 def create_company(self, image_key):
     c = Company()
     c.name = self['company_name']
     c.website = self['website']
     c.profile = self['profile']
     c.hello = self['hello']
     tags = re.findall(r"[\w']+", str(self['tags']))
     c.tags = tags[0:3] if len(tags)>3 else tags
     c.image = image_key
     c.put()
     return c
Exemplo n.º 4
0
        def migrate_company():
            try:
                cnx = mysql.connector.connect(
                    host=self.host,
                    user=self.username,
                    password=self.password,
                    database=self.database,
                )
                cursor = cnx.cursor()
                query = "SELECT * FROM company"
                cursor.execute(query)

                for (id, name, city, timezone, alarm_email, address, tel, logo,
                     manager, extra, creator, createdat) in cursor:
                    u = Company()
                    u.id = id
                    u.name = name
                    u.city = city
                    u.timezone = timezone
                    u.alarm_email = alarm_email
                    u.address = address
                    u.telephone = tel
                    u.logo = logo
                    if manager in [0, -1]:
                        manager = 10
                    u.manager = manager
                    u.extra = extra
                    u.created_by = 10
                    u.created_on = createdat
                    db.session.add(u)
                    db.session.commit()
                cursor.close()
                cnx.close()
                return "done"
            except Exception as e:
                return str(e), 500