예제 #1
0
def delete(id, accessToken=None):
    '''
    Delete a list.

    :param id:
    :return:
    '''

    try:

        mylist = _get(id)

        if not mylist:
            logging.error("List %s doesn't exist.", id)
            return False

        print mylist

        if 'tasks' in mylist:
            for task in mylist['tasks']:
                tasks.delete(task, accessToken=accessToken)

        db.lists().child(id).delete()

        return True

    except Exception as e:
        logging.exception("Couldn't delete list with id %s!" % id)
        return False
예제 #2
0
def delete(id, accessToken=None):
    '''
    Delete a list.

    :param id:
    :return:
    '''

    try:

        mylist = _get(id)

        if not mylist:
            logging.error("List %s doesn't exist.", id)
            return False

        print mylist

        if 'tasks' in mylist:
            for task in mylist['tasks']:
                tasks.delete(task, accessToken=accessToken)

        db.lists().child(id).delete()

        return True

    except Exception as e:
        logging.exception("Couldn't delete list with id %s!" % id)
        return False
예제 #3
0
def _update(id, mylist):

    try:

        db.lists().child(id).update(mylist)
        return True

    except:
        logging.exception("Failed updating task with id %s", id)
        return False
예제 #4
0
def _update(id, mylist):

    try:

        db.lists().child(id).update(mylist)
        return True

    except:
        logging.exception("Failed updating task with id %s", id)
        return False
예제 #5
0
def new(id, name, adminIds, userIds, public, accessToken=None):
    '''
    Creates a new list with the parameters inputted.

    :param id:
    :param name:
    :param admins: list
    :param users: list
    :param public: bool
    :return: True for success, False otherwise.
    '''

    try:

        if _get(id):
            logging.error("List with id %s already exists!", id)
            return False

        mylist = {}
        mylist['id'] = id
        mylist['name'] = name

        for admin in adminIds:
            if not users.exists(admin, accessToken=accessToken):
                logging.error("Admin %s doesn't exist!", admin)
        mylist['admins'] = adminIds or []
        for user in userIds:
            if not users.exists(user, accessToken=accessToken):
                logging.error("User %s doesn't exist!", user)
        mylist['users'] = userIds or []
        mylist['scores'] = {}
        mylist['public'] = public
        mylist['tasks'] = {}

        db.lists().child(id).put(mylist)

        return True
    except Exception as e:
        logging.exception("Couldn't create new list with id %s!" % id)
        return False
예제 #6
0
def new(id, name, adminIds, userIds, public, accessToken=None):
    '''
    Creates a new list with the parameters inputted.

    :param id:
    :param name:
    :param admins: list
    :param users: list
    :param public: bool
    :return: True for success, False otherwise.
    '''

    try:

        if _get(id):
            logging.error("List with id %s already exists!", id)
            return False

        mylist = {}
        mylist['id'] = id
        mylist['name'] = name

        for admin in adminIds:
            if not users.exists(admin, accessToken=accessToken):
                logging.error("Admin %s doesn't exist!", admin)
        mylist['admins'] = adminIds or []
        for user in userIds:
            if not users.exists(user, accessToken=accessToken):
                logging.error("User %s doesn't exist!", user)
        mylist['users'] = userIds or []
        mylist['scores'] = {}
        mylist['public'] = public
        mylist['tasks'] = {}

        db.lists().child(id).put(mylist)

        return True
    except Exception as e:
        logging.exception("Couldn't create new list with id %s!" % id)
        return False
예제 #7
0
def _get(id):

    return db.lists().child(id).get()
예제 #8
0
def _get(id):

    return db.lists().child(id).get()
예제 #9
0
        return False

db = db.DB
while True:
    print("")
    islem = input("İşlem Seçiniz: ")
    print("")
    if not control(islem):
        print("Lütfen Sadece Rakam Olarak İşlem Seçiniz.")
    else:
        islem = int(islem)
        if islem==1:
            print(welcome)
        elif islem==2:
            print("Mevcut Tablo Listesi")
            print(db.lists())
        elif islem==3:
            print("Tablo oluşturmak için adımları doğru takip ediniz.")
            db.create()
        elif islem==4:
            print("Tablo oluşturmak için önce var olan tablolardan birini seçiniz.")
            print(db.lists())
            db.insert()
        elif islem==5:
            print("Listedeki Hangi Tablonun Verilerini Çekmek İstiyorsunuz?.")
            print(db.lists())
            db.select()
        elif islem==6:
            print("Listedeki Hangi Tablonun Verilerini Güncelleme İstiyorsunuz?.")
            print(db.lists())
            db.update()