예제 #1
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg("Voce precisa estar logado para continuar.")
        return

    meters = input("Quantos metros quadrados é a gaiola? ")
    if not meters:
        error_msg("Cancelado")
        return

    meters = float(meters)
    carpeted = input("Tem carpete [y, n]? ").lower().startswith('y')
    has_toys = input("Tem brinquedos [y, n]? ").lower().startswith('y')
    allow_dangerous = input("Pode receber cobras venenosas [y, n]? ").lower().startswith('y')
    name = input("Qual o nome? ")
    price = float(input("Qual o valor? "))

    cage = svc.register_cage(
        state.active_account, name,
        allow_dangerous, has_toys, carpeted, meters, price
    )

    state.reload_account()
    success_msg(f"Gaiola com o id {cage.id} registrada")
예제 #2
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg('You must login first to register a cage.')
        return

    meters = input('How many square meters is the cage? ')
    carpeted = input("Is it carpeted [y, n]? ").lower().startswith('y')
    has_toys = input("Have snake toys [y, n]? ").lower().startswith('y')
    allow_dangerous = input("Can you host venomous snakes [y, n]? ").lower().startswith('y')
    name = input("Give your cage a name: ")
    price = input("How much are you charging?  ")
    
    if ((not meters)or(not price)):
        error_msg('Dimension and price are mandatory')
        return
    try:
        meters = float(meters)
        price = float(price)
    except ValueError:    
        error_msg('Invalid dimension or price')
        return
        
    if name:
        name =str(name)
   
    cage = svc.register_cage( state.active_account, name, allow_dangerous, has_toys, carpeted, meters, price)

    state.reload_account()
    success_msg(f'Registered new cage with id {cage.id}.')
예제 #3
0
def register_cage():
  if not state.active_account:
    error_msg('Please Log In To Register')
    return
  print('       ********** Register Cage **********')
  name = input('Enter your cage name.... ')
  area = (float(input('Enter area for your cage.... [numbers only]')))
  assert type(area) == float, 'Should be Num'
  is_carpeted = (input('Is your cage carpeted [y/n] ?').strip().lower().startswith('y'))
  has_toys = (input('Does it has toys ? [y/n] ?').strip().lower().startswith('y'))
  
  cage = services.register_cage(state.active_account, name, area, is_carpeted, has_toys)

  state.reload_account()
  success_msg(f'Registered Cage Successfully With ID > {cage.id}')
예제 #4
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg('You must login first in order to register a cage')
        return
    meters = input('Area(Sq. Metres)? :')
    if not meters:
        error_msg('Cancelled')
        return
    meters = float(meters)
    carpeted = input('Is it carpeted [y,n]? :').lower().startswith('y')
    has_toys = input('Have snake toys [y,n]? :').lower().startswith('y')
    allow_dangerous=input('Can you host a venomous snake [y,n]? :').lower().startswith('y')
    name = input('Name for the Cage? :')
    price = float(input('Price for cage? :'))

    cage = svc.register_cage(state.active_account, name, allow_dangerous, has_toys, carpeted, meters, price)
    state.reload_account()
    success_msg(f'Registered a new cage with new cage-id: {cage.id}')
def register_cage():
    print(" ****************** REGISTER CAGE **************** ")

    if not state.active_account:
        error_msg("You must login first to register a cage.")
        return

    meters = input("How many square meters is the cage? ")
    if not meters:
        error_msg("Cancelled")
        return
    meters = float(meters)
    carpeted = input("Is it carpeted [y, n]? ").lower().startswith("y")
    has_toys = input("Have snake toys [y, n]? ").lower().startswith("y")
    allow_dangerous = (
        input("Can you host venomous snakes[y, n]? ").lower().startswith("y"))
    name = input("Give your cage a name: ")
    price = float(input("How much are you charging? "))

    cage = svc.register_cage(state.active_account, name, allow_dangerous,
                             has_toys, carpeted, meters, price)

    state.reload_account()
    success_msg(f"Registered new cage with id {cage.id}")  # pylint: disable=no-member