def create_voucher(gateway, minutes=60, code=None, quiet=True): voucher = Voucher() # Allow explicit setting of code (for tests) if code is not None: voucher.code = code voucher.gateway_id = gateway voucher.minutes = minutes db.session.add(voucher) db.session.commit() if not quiet: print 'Voucher created: %s:%s' % (voucher.id, voucher.code)
def create_voucher(gateway, minutes=60, id=None, quiet=True): voucher = Voucher() # Allow explicit setting of ID (for tests) if id is not None: voucher.id = id voucher.gateway_id = gateway voucher.minutes = minutes db.session.add(voucher) db.session.commit() if not quiet: print 'Voucher created: %s' % voucher.id