Пример #1
0
 def save(self):
     # selfのステータスをDBに格納
     text = "update users set mother_fatigue=" + str(
         self.mother_fatigue) + ",money=" + str(
             self.money) + ",time='" + self.time + "',neet_fulness=" + str(
                 self.neet_fulness) + ",neet_motivation=" + str(
                     self.neet_motivation) + " where player_id=" + str(
                         self.player_id) + ";"
     sql.add(self, text)
     return True
Пример #2
0
def add_account():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    account_name = request.form.get("account_name")
    account_balance = request.form.get("account_balance")

    try:
        sql.add("accounts", (account_name, account_balance))
        return "0"
    except:
        return "1"
Пример #3
0
def add_account():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    account_name = request.form.get("account_name")
    account_balance = request.form.get("account_balance")

    try:
        sql.add("accounts", (account_name, account_balance))
        return "0"
    except:
        return "1"
Пример #4
0
def add_bill():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    bill_name = request.form.get("bill_name")
    pay_date = request.form.get("pay_date")
    pay_amount = request.form.get("pay_amount")

    try:
        sql.add("bills", (bill_name, pay_date, pay_amount))
        return "0"
    except:
        return "1"
Пример #5
0
def add_bill():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    bill_name = request.form.get("bill_name")
    pay_date = request.form.get("pay_date")
    pay_amount = request.form.get("pay_amount")

    try:
        sql.add("bills", (bill_name, pay_date, pay_amount))
        return "0"
    except:
        return "1"
Пример #6
0
    def create(self, id, password):
        text = "select exists(select * from users where player_id = " + id + ");"
        result = sql.query(self, text)

        # ユーザIDが重複するとき
        if result[0]:
            return False

        else:  # ユーザIDが重複しないとき
            text = "insert into users values(" + id + ",'" + password + "',0,1000,True,0,0,1);"
            sql.add(self, text)
            self.player_id = id
            return True
Пример #7
0
    def save(self):
        if self.time:
            time_bool = "True"
        else:
            time_bool = "False"

        # selfのステータスをDBに格納
        text = "update users set mother_fatigue=" + str(self.mother_fatigue) + ",money=" +\
               str(self.money) + ",time='"+ time_bool +"',neet_fulness=" + str(self.neet_fulness) +\
               ",neet_motivation=" + str(self.neet_motivation) + ",count=" + str(self.count) +\
               " where player_id=" + str(self.player_id) + ";"
        sql.add(self, text)
        return True
Пример #8
0
def add_spend():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    spend_description = request.form.get("spend_description")
    spend_date = request.form.get("spend_date")
    spend_amount = request.form.get("spend_amount")
    account_used = request.form.get("account_used")

    try:
        sql.add("spending", (spend_description, spend_date, spend_amount, account_used))
        return "0"
    except:
        return "1"
Пример #9
0
def add_spend():
    if request.method != "POST":
        return "Whoops, this page only takes POST requests."

    spend_description = request.form.get("spend_description")
    spend_date = request.form.get("spend_date")
    spend_amount = request.form.get("spend_amount")
    account_used = request.form.get("account_used")

    try:
        sql.add("spending",
                (spend_description, spend_date, spend_amount, account_used))
        return "0"
    except:
        return "1"
Пример #10
0
 def submit():
     if (sql.add(n, site.get(), ID.get(), Password.get()) is False):
         m.configure(text='Data already exists')
     else:
         m.config(text='Data successfully Uploaded')
Пример #11
0
#!/usr/bin/env python3

import sys

import sql
import models

sql.init_db()

if len(sys.argv) > 3:
    c = sys.argv[3]
else:
    c = None
if len(sys.argv) > 2:
    q = int(sys.argv[2])
else:
    q = 1
h = models.HW(name=sys.argv[1], quantity=q, available=q, category=c)

sql.add(h)
Пример #12
0
#!/usr/bin/env python3
import sys

import sql
import auth
from models import User

if len(sys.argv) != 2:
    print("Usage: " + sys.argv[0] + " <username>")
    sys.exit(1)

sql.init_db()
email = sys.argv[1] + "@" + auth.domain
if auth.validemail(email) is None:
    print(email + " is not a valid email.")
    sys.exit(2)

input("Are you sure you want to add " + email + "? Press Ctrl+C to cancel,"
      "or anything else to continue")

u = User(id=email)
sql.add(u)
sql.commit()
print("Added " + email + " to the authorized users list.")