I actually just decided that I probably just need to manually add new
values to db.auth.users. That way this is actually a non-issue and I won't
even need to worry about it.
I think it may be harder since I don't know how to do that, especially with
the checks on if auth.user or IS_IN_DB references but I can't see this
working any other way for what I want to do. The end goal is to take a
checkout form that will submit like normal to the payment gateway but at
the same time register users if they don't have accounts, not register
users if they're logged in or the email value exists already in the
auth.user db.
The code I have already in the controller is:
def checkout_test():
order = []
balance = 0
for product_id, qty, option_ids in session.cart:
products = db(db.product.id == product_id).select()
if products:
product = products[0]
options = [db.option[id] for id in option_ids]
total_price = qty * (product.price + sum([option.price for
option in options]))
order.append((product_id, qty, total_price, product, options))
balance += total_price
else:
pass
session.balance = balance
if form.accepts(request, formname=None):
#if not auth.user:
#if field.email IS_NOT_IN_DB:
#register email field in auth.users db
# pass
#pass
mail.send(to=['r...@rks.com','customer_email'],subject='Test
Success',message=', '.join('%s: %s' % (k, v) for (k, v) in
request.vars.iteritems()))
return dict(order=order, merchant_id=session.paypal_id)
elif form.errors:
return TABLE(*[TR(k, v) for k, v in form.errors.items()])
Of course, you'll notice some invalid code in there that I have as
placeholders for myself to logically symbolize what I need done.
--