Exemplo n.º 1
0
except IOError:
    for i in range(5):
        print "YOU ARE RUNNING THE STOCK CONFIG, which is not in git, smtp passwords and so on, ask jef for fr1ckets_priv.conf"
    app.config.from_pyfile('fr1ckets.conf')

print len(sys.argv)
print sys.argv
if len(sys.argv) < 4:
    print "usage: {0} how_many discount_in_eur reason".format(sys.argv[0])
    sys.exit(1)

N_VOUCHERS = int(sys.argv[1])
DISCOUNT = int(sys.argv[2])
REASON = " ".join(sys.argv[3:])

with app.app_context():
    setup.setup_db()
    d = {
        'discount': DISCOUNT,
        'claimed': False,
        'claimed_at': None,
        'comments': 'generated by script',
        'reason': REASON,
    }
    for i in range(N_VOUCHERS):
        code = model.voucher_create(g.db_cursor, d)
        print code

    g.db_commit = True
    setup.wrapup_db(None)
Exemplo n.º 2
0
				elif row['when'].lower() in [ 'mon', 'monday', 'maa', 'maandag' ]:
					ticket = 'ticket_vip_monday'
				elif row['when'].lower() in [ 'all', 'allemaal' ]:
					ticket = 'ticket_vip_all'
				p = find_product(ticket)
				if not ticket or not p:
					print "can't parse {0} in {1}! fail.".format(row['when'], row)
					sys.exit(1)

				products.append({
					'product_id' : p['id'],
					'n' : 1,
					'person_dob' : row['dob'],
					'person_name' : row['name'],
					'person_volunteers_during' : 0,
					'person_volunteers_after' : 0,
					'person_food_vegitarian' : int(row['vegitarian']),
				})
				persons += 1
			business_info = { 'name' : '', 'address' : '', 'vat' : '' }
			purchase = model.purchase_create(g.db_cursor, email, products, business_info, False)

			print "{0}({1}): {2}".format(email, purchase['id'], products)
			model.purchase_history_append(g.db_cursor, purchase['id'],
				msg='script created VIP purchase for={0}'.format(row['email']))

		print "persons={0}".format(persons)

		g.db_commit = True
		setup.wrapup_db(None)