Beispiel #1
0
def create_ListRelationship(listObject, numberObject, createdBy, modifiedBy):
    if check_ListRelationship_Exists(listObject, numberObject):
        statement = 'this list relationship already exists!'
    else:
        newListRelationship = ListRelationship(listName = listObject, number = numberObject, createdBy = createdBy.id, modifiedBy = modifiedBy.id)
        newListRelationship.save()
        statement = newListRelationship
    return statement
Beispiel #2
0
def create_tables():
    Number.create_table(True)
    SMS.create_table(True)
    Seller.create_table(True)
    Market.create_table(True)
    List.create_table(True)
    ListRelationship.create_table(True)
    Outbox.create_table(True)
Beispiel #3
0
def deactivate_ListRelationship(numberObject, listName):
    listObject = get_Mini_List(listName)
    update_query = ListRelationship.update(isActive = False).where((ListRelationship.number == numberObject) and (ListRelationship.listName == listObject))
    update_query.execute()
    update_query = ListRelationship.update(modifiedAt = datetime.datetime.now()).where((ListRelationship.number == numberObject) and (ListRelationship.listName == listObject))
    update_query.execute()
    statement = str(number) + ' has been removed from ' + str(listName) + ' and will no longer receive messages.'
    create_Outbox_Message(numberObject, statement)
    return statement
Beispiel #4
0
def index(password):
    print >> sys.stderr, "within index"
    try:
        if password == PASSWORD:
            print >> sys.stderr, "within try"
            sellerList = Seller.select()
            smsList = SMS.select()
            numberList = Number.select()
            l = List.select()
            marketList = Market.select()
            lrList = ListRelationship.select()
            outboxList = Outbox.select()
            return render_template("index.html", title = 'TABLES', sellerList = sellerList, smsList = smsList, l = l, marketList = marketList)
            #return 'hello world'
        else:
            print >> sys.stderr, "wrong password"
    except:
        print >> sys.stderr, "within except"
        print >> sys.stderr, str(sys.exc_info()[0]) # These write the nature of the error
        print >> sys.stderr, str(sys.exc_info()[1])
        statement = 'An exception has Occured'+ str(sys.exc_type) + '[' + str(sys.exc_value) + ']'
        return statement
Beispiel #5
0
def check_ListRelationship_Exists(listObject, numberObject):
    for lr in ListRelationship.select():
        if lr.listName == listObject and lr.number == numberObject:
            print 'this list relationship already exists and was created by ' + str(lr.createdBy)
            return True
Beispiel #6
0
def get_Mini_Sellers_ListNumbers(sellersListName):
    sellersListNumbers = []
    sellersList = List.get(List.name == sellersListName)
    for listRelationship in ListRelationship.select().where(ListRelationship.listName == sellersList):
        sellersListNumbers.append(listRelationship.number)
    return sellersListNumbers
Beispiel #7
0
def get_Mini_ListNames(number):
    listNames = []
    for l in ListRelationship.select().where(ListRelationship.number == number):
        listNames.append(l.listName.name)
    return listNames