Ejemplo n.º 1
0
def reactivate_Number(newSMS):
    numberObject = newSMS.number
    update_query = Number.update(isActive = True).where(Number.number == numberObject.number)
    update_query.execute()
    update_query = Number.update(modifiedAt = datetime.datetime.now()).where(Number.number == numberObject.number)
    update_query.execute()
    statement = str(newSMS.number.number) + ': You have been reactivated!'
    # You have been deactivated and will no longer receive messages
    create_Outbox_Message(numberObject, statement)
    return statement
Ejemplo n.º 2
0
def deactivate_Number(newSMS):
    numberObject = newSMS.number
    # print >> sys.stderr, numberObject
    update_query = Number.update(isActive = False).where(Number.number == numberObject.number)
    update_query.execute()
    update_query = Number.update(modifiedAt = datetime.datetime.now()).where(Number.number == numberObject.number)
    update_query.execute()
    statement = str(newSMS.number.number) + ': baakusazeeko tojja kwongera kufuna bubaka. Bwobeera oyagala okuddamu okukozesa obunnakibiina bwo, weereza- okuyunga eri 0784820672'
    # You have been deactivated and will no longer receive messages If you would like to re-activate your membership, please send okuyunga to 0784820672
    create_Outbox_Message(numberObject, statement)
    return statement
Ejemplo n.º 3
0
def deactivate_Seller(newSMS):
    smsNumber = newSMS.number.number
    sellerNumber = Number.get(Number.number == smsNumber)
    seller = sellerNumber.seller
    update_query = Number.update(isActive = False).where(Number.seller == seller)
    update_query.execute()
    update_query = Number.update(modifiedAt = datetime.datetime.now()).where(Number.seller == seller)
    update_query.execute()
    statement = str(seller) + ': baakusazeeko tojja kwongera kufuna bubaka.'
    # You have been deactivated and will no longer receive messages
    create_Outbox_Message(newSMS.number, statement)
    return statement
Ejemplo n.º 4
0
def create_Seller_Number_Association(oldNumber, newNumber):
    seller = oldNumber.seller
    update_query = Number.update(seller=seller).where(Number.number == newNumber.number)
    update_query.execute()
    newNumber = Number.get(Number.number == newNumber.number)
    statement = str(oldNumber.number) + ' : ' + str(oldNumber.seller) + ' // ' + str(newNumber.number) + ' : ' + str(newNumber.seller)
    return statement
Ejemplo n.º 5
0
def store_Seller(newSMS):
    print >> sys.stderr, "within store seller"
    if check_Seller_Exists(newSMS):
        print >> sys.stderr, "within store seller if"
        statement = "Okimanyi nti e nnamba eno wagiwaandiisa dda ku lukalala?"
        # Do you know you've already registered this number for the mailing list?
        create_Outbox_Message(newSMS.number, statement)
    else:
        try:
            print >> sys.stderr, "within store seller else try"
            bodyList = split_Body(newSMS)
            if len(bodyList) > 4:
                print >> sys.stderr, "within store seller else if"
                newSeller = Seller(givenName = bodyList[1], familyName = bodyList[2], product = bodyList[3], kind = bodyList[4], market = 1)
                newSeller.save()
                update_query = Number.update(seller=newSeller).where(Number.number == newSMS.number.number)
                update_query.execute()
                numberObject = get_Number_Object(newSMS.number.number)
                listObject = get_List_Object(newSeller.market)
                newListRelationship = create_ListRelationship(listObject, numberObject, numberObject, numberObject)
                statement = newSeller
            else:
                print >> sys.stderr, "within store seller else else"
                statement = "Okutwegattako Goberera enkola eno 'okuyunga Erinnya Eppaatiike Erinnya Ery'ekika Byotunda'" #explanation of how to join
                create_Outbox_Message(newSMS.number, statement)
        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 Occurred'+ str(sys.exc_type) + '[' + str(sys.exc_value) + ']'
            return statement
    return statement
Ejemplo n.º 6
0
def create_Market(name, nickname, neighborhood, city, number):
    newMarket = Market(
        name=name.lower(), nickname=nickname.lower(), neighborhood=neighborhood.lower(), city=city.lower()
    )
    newMarket.save()
    update_query = Number.update(market=newMarket).where(Number.number == number)
    update_query.execute()
    return newMarket