auth.settings.actions_disabled.append('register') # configure auth policy if useappconfig: auth.settings.registration_requires_verification = myconf.take('user.verification', cast=int) auth.settings.registration_requires_approval = myconf.take('user.approval', cast=int) else: auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True db.auth_user.privacypref.requires = IS_IN_SET(['Standard', 'Extreme']) if use_geolocation and (not useappconfig or myconf.take('user.address', cast=int)): db.auth_user.coord.requires = IS_GEOLOCATION() db.auth_user.coord.widget = location_widget() # recommended and supported login methods are now web2py and socialauth - other code # is left as legacy but not supported if request.env.web2py_runtime_gae and login == 'google': from gluon.contrib.login_methods.gae_google_account import GaeGoogleAccount auth.settings.login_form = GaeGoogleAccount() elif login == 'janrain': # this is limited by Janrain providers # from gluon.contrib.login_methods.rpx_account import RPXAccount from gluon.contrib.login_methods.rpx_account import use_janrain use_janrain(auth, filename='private/janrain.key') elif login == 'web2pyandjanrain': # this is now proving useless as no providers really work # Dual login sort of working but not fully tested with Janrain - doesnt work with gae # from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm # from gluon.contrib.login_methods.rpx_account import RPXAccount
Field('question_long', 'double', default=0.0, label='Latitude', writable=False, readable=False), Field('question_lat', 'double', default=0.0, label='Longitude', writable=False, readable=False), Field('perccomplete', 'integer', default=0, label='Percent Complete', requires=IS_INT_IN_RANGE(0, 101, error_message='Must be between 0 and 100')), Field('notes', 'text', label='Notes', comment='General notes about question - may also document answers from knowledge engines'), Field('execstatus', 'string', label='Execution Status', default='Proposed', requires=IS_IN_SET(['Proposed', 'Planned', 'In Progress', 'Completed']))) # , widget=range100_widget - stuck with this as won't go to zero for some reason db.question.totanswers = Field.Lazy(lambda row: sum(row.question.answercounts)) db.question.numanswers = Field.Lazy(lambda row: len(row.question.numanswers)) db.question.correctanstext = Field.Lazy(lambda row: (row.question.correctans > -1 and row.question.answers[row.question.correctans]) or '') if use_geolocation: db.question.coord.requires = IS_GEOLOCATION() db.question.coord.widget = location_widget() db.question.eventid.requires = IS_IN_DB(db(db.evt.status == 'Open'), 'evt.id', '%(evt_name)s') db.question._after_insert.append(lambda fields, id: questcount_insert(fields, id)) def questcount_insert(fields, id): """ :param fields: question fields :param id: question id :return: True This updates the questcounts table with a category record and an answer group record for each questio submitted """ groupcat = 'G' countindex = getindex(fields['qtype'], fields['status'])
comment='Allows other users to link events'), Field('auth_userid', 'reference auth_user', writable=False, readable=False, default=auth.user_id), Field('createdate', 'datetime', default=request.utcnow, writable=False, readable=False), format='%(location_name)s') db.locn.addrurl.requires = IS_EMPTY_OR(IS_URL()) db.locn.coord.requires = IS_GEOLOCATION() db.locn.coord.widget = location_widget() INIT = db(db.initialised).select().first() PARAMS = db(db.website_parameters).select().first() if PARAMS: labeltoplevel = PARAMS.level1desc or 'DfltContinent' labelmidlevel = PARAMS.level2desc or 'DfltCountry' labellowlevel = PARAMS.level3desc or 'DfltSubdivision' if INIT is None or INIT.website_init is False: if db(db.continent.continent_name == "Unspecified").isempty(): contid = db.continent.insert(continent_name="Unspecified") if db(db.resolve.resolve_name == "Standard").isempty(): resolveid = db.resolve.insert(resolve_name="Standard")