Esempio n. 1
0
def addinfo():
    form = InfoForm()
    if form.validate_on_submit():
        db.session.add(Info(name=form.name.data, value=int(form.value.data)))
        db.session.commit()
        return redirect(url_for("addinfo"))
    template = render_template("admin/index/info/addinfo.html", form=form)
    return checkLogin(template)
Esempio n. 2
0
def add_data(sub, pred, obj):
    try:
        Info(sujeto = sub.strip(),
        predicado = pred.strip(),
        objeto = obj.strip()
        )
    except Exception as e:
        print sub
        print pred
        print obj
        pass
Esempio n. 3
0
 def get(self):
     self.response.headers['Content-Type'] = 'text/plain'
     devregid = self.request.get('devregid')
     if not devregid:
         self.response.out.write('Must specify devregid')
     else:
         user = users.get_current_user()
         if user:
             #Store registration_id and an unique key_name with email value
             info = Info(key_name=user.email())
             info.registration_id = devregid
             info.put()
             #Send invitation from [email protected] to user's GTalk
             xmpp.send_invite(user.email())
             self.response.out.write('OK')
         else:
             self.response.out.write('Not authorized')
Esempio n. 4
0
    def get(self):
        First_Name = self.request.get('first_name')
        email = self.request.get('email')
        city_name = self.request.get('city')
        state_name = self.request.get('state')
        zip_code = self.request.get('zip')

        b1 = Info()
        b1.First = First_Name
        b1.Email = email
        b1.City = city_name
        b1.State = state_name
        b1.Zip = zip_code
        self.response.write(
            "<script>confirm('your form has been submitted')</script>")
        file = open('contact.html')
        self.response.write(file.read())
Esempio n. 5
0
async def compare(loop):
    valid_name = []
    all_name = []
    unvalid_name = []
    await create_pool(
        loop=loop,
        host='127.0.0.1',
        port=3306,
        user="******",
        password="******",
        db="data")
    valid_persons = Info()
    all_persons = Input()
    valid_list = await valid_persons.findAll()
    count1, time = count(valid_list)
    all_list = await all_persons.findAll()
    for person in valid_list:
        valid_name.append(person["name"])
    for person in all_list:
        all_name.append(person["name"])
    allnumber, validnumber = len(all_name), len(valid_name)
    length = allnumber - validnumber

    if (length > 0):
        for i in all_name:
            t = 0
            for j in valid_name:
                if (j == i):
                    t += 1
            if (t == 0):
                unvalid_name.append(i)
    unvalid_list = []
    for i in unvalid_name:
        for person in all_list:
            if (person["name"] == i):
                unvalid_list.append(person)
    return valid_list, unvalid_list, allnumber, validnumber, count1, time
Esempio n. 6
0
    def post(self):
        try:
            parser = reqparse.RequestParser()
            parser.add_argument('title')
            parser.add_argument('content')
            parser.add_argument('username')

            data = parser.parse_args()

            title = data['title']
            content = data['content']
            id = 2  # 이거 나중에 맨 마지막 글 아이디 찾아서 바꿔줘야함!
            date = datetime.now()
            date = str(date.year) + "-" + str(date.month) + "-" + str(
                date.day) + " " + str(date.hour) + ":" + str(
                    date.minute) + ":" + str(date.second)
            # print(date)
            views = 0
            likes = 0
            writer = data['username']
            reply = [""]

            i = Info(title=title,
                     content=content,
                     id=id,
                     date=date,
                     views=views,
                     likes=likes,
                     writer=writer,
                     reply=reply)
            i.save()  # Database 안에 document 저장

            return {"message": "글 작성에 성공했습니다."}

        except:
            raise Exception("글 작성에 실패했습니다.")