I started with the scaffolding version of db.py, tweaking it as follows:




if not request.env.web2py_runtime_gae:
    ## if NOT running on Google App Engine use SQLite or other DB
    db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
else:
    ## connect to Google BigTable (optional 'google:datastore://namespace')
    db = DAL('google:datastore')
    ## store sessions and tickets there
    session.connect(request, response, db=db)
    ## or store session in Memcache, Redis, etc.
    ## from gluon.contrib.memdb import MEMDB
    ## from google.appengine.api.memcache import Client
    ## session.connect(request, response, db = MEMDB(Client()))

## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()

## (dps) added for SOAP auth support
auth.settings.allow_basic_login = True
# see below: auth.settings.registration_requires_approval = True

## create all tables needed by auth if not custom tables
auth.define_tables(username=True)

## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'me@myownplace'   #  so to speak

mail.settings.login = 'me:myself'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = True
auth.settings.reset_password_requires_verification = True




and today I thought to comment out this section,

## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in 
private/janrain.key
# from gluon.contrib.login_methods.rpx_account import use_janrain
# use_janrain(auth, filename='private/janrain.key')




but that didn't seem to make any difference.

/dps


On Thursday, August 22, 2013 12:27:30 AM UTC-7, Massimo Di Pierro wrote:
>
> Where is the line:
>
> auth.define_tables(username=True)
>
> Can you post the content of the file that contains it?
>
> On Wednesday, 21 August 2013 15:52:45 UTC-5, Dave S wrote:
>>
>> I am tying to add authorization to a simple server I had working.
>>
>> In the db model, I have the line
>>  
>>
>> auth.define_tables(username=True)
>>
>>
>> default.py has, as the docs suggest
>> @auth.requires_login()
>> def call():
>>     return service()
>>
>> def user():
>>     return dict(form=auth())
>>
>>
>> but the tables seem not to be created yet.  Using the url 
>> <.../app/default/call> pops up the login form, and I can complete the form, 
>> and the 
>> request_validation setting appears to be doing something.  But I can't 
>> examine the auth_user table (from the appadmin interface) to see the entry.
>>
>> When I worked through the image app example, auth was added as a later 
>> step (IIRC) and auth_user and the related tables were created and can be 
>> examined.
>>
>> I seem to have lost track of how to get the tables created in my current 
>> app.
>>
>> Thanks.
>>
>> /dps
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to