示例#1
0
    # Reload the Field definitions
    reload(s3base.s3fields)
else:
    import s3 as s3base

# Use session for persistent per-user variables
# - beware of a user having multiple tabs open!
# - don't save callables or class instances as these can't be pickled
if not session.s3:
    session.s3 = Storage()

# AAA
auth = s3base.AuthS3()
current.auth = auth

s3_audit = s3base.S3Audit(migrate=migrate, fake_migrate=fake_migrate)
current.s3_audit = s3_audit

# Use username instead of email address for logins
# - would probably require further customisation
#   to get this working within Eden
#auth.settings.username_field = True

auth.settings.hmac_key = settings.get_auth_hmac_key()
auth.define_tables(migrate=migrate, fake_migrate=fake_migrate)

# Shortcuts for models/controllers/views
s3_has_role = auth.s3_has_role
s3_has_permission = auth.s3_has_permission
s3_logged_in_person = auth.s3_logged_in_person
示例#2
0
# Use session for persistent per-user variables
# - beware of a user having multiple tabs open!
# - don't save callables or class instances as these can't be pickled
if not session.s3:
    session.s3 = Storage()

# Use username instead of email address for logins
# - would probably require further customisation
#   to get this working within Eden
#auth.settings.username_field = True

auth.settings.hmac_key = settings.get_auth_hmac_key()
auth.define_tables(migrate=migrate, fake_migrate=fake_migrate)

current.audit = audit = s3base.S3Audit(migrate=migrate,
                                       fake_migrate=fake_migrate)

# Shortcuts for models/controllers/views
s3_has_role = auth.s3_has_role
s3_has_permission = auth.s3_has_permission
s3_logged_in_person = auth.s3_logged_in_person

# CRUD
s3.crud = Storage()

# S3 Custom Validators and Widgets, imported here into the global
# namespace in order to access them without the s3base namespace prefix
s3_action_buttons = s3base.S3CRUD.action_buttons
s3_fullname = s3base.s3_fullname
S3ResourceHeader = s3base.S3ResourceHeader
from s3.s3navigation import s3_rheader_tabs