class MailConfig(Configuration): filename = 'mailutil.config.py' config_key = 'mail' smtp_host = ConfigSetting( default='localhost', description='The hostname used for sending SMTP email') smtp_port = ConfigSetting( default=8025, description='The port used for sending SMTP email', dangerous=True) smtp_user = ConfigSetting( default=None, description='The user name to connect to SMTP server') smtp_password = ConfigSetting( default=None, description='The password for the user to connect to the SMTP server') smtp_use_initial_encrypted_connection = ConfigSetting( default=False, description= 'If True, connect to the server using a secure connection (use with smtps)' ) smtp_upgrade_initial_connection_to_encrypted = ConfigSetting( default=False, description= 'If True, connects to the server unencrypted, but then upgrade to a secure connection using STARTTLS (use with submission or smtp)' ) smtp_keyfile = ConfigSetting( default=None, description= 'Keyfile to use for identifying the local end of the connection') smtp_certfile = ConfigSetting( default=None, description= 'Certfile to use for identifying the local end of the connection')
class AddressConfig(Configuration): filename = 'componentconfig.config.py' config_key = 'componentconfig' showheader = ConfigSetting( default=False, description='Whether the title should be shown as a heading too')
class SystemAccountConfig(Configuration): """Configuration containing general system information All templates in this configuration are PEP292 formatted strings that can use the following substitutions: $email The email address to which the message applies $secret The relevant secret key """ filename = 'systemaccountmodel.config.py' config_key = 'accounts' admin_email = ConfigSetting( default='*****@*****.**', description='The email address from which automated emails are sent', dangerous=True) request_verification_timeout = ConfigSetting( default=10, description='The time an unvalidated request is kept alive') activation_subject = ConfigSetting( default='''Your registration for $email''', description='A Subject used for activation emails') activation_email = ConfigSetting(default='''You, or someone on your behalf requested to be registered using $email.\n\n'''\ '''If you have received this message in error, please ignore it.\n\n'''\ '''Your secret key is: $secret_key\n\n''', description='Body of an activation email') new_password_subject = ConfigSetting( default='''Your password for $email''', description='Subject used for password reset emails') new_password_email = ConfigSetting(default='''You, or someone on your behalf requested to pick a new password for $email.\n\n'''\ '''If you have received this message in error, please ignore it.\n\n'''\ '''Your secret key is: $secret_key\n\n''', description='Body of a password reset email') email_change_subject = ConfigSetting( default='''Your new email $email''', description='Subject used for email address change emails') email_change_email = ConfigSetting(default='''You, or someone on your behalf requested to change your email to $email.\n\n'''\ '''If you have received this message in error, please ignore it.\n\n'''\ '''You need to accept this change before it will take effect.\n\n'''\ '''Your secret key is: $secret_key\n\n''', description='Body of an email address changed email') mailer_class = ConfigSetting( default=Mailer, description='The class to instantiate for sending email')
class MyConfig(Configuration): setting = ConfigSetting(default='the default')
class WebConfig(Configuration): filename = 'web.config.py' config_key = 'web' site_root = ConfigSetting(description='The UserInterface class to be used as the root of the web application') static_root = ConfigSetting(default=os.getcwd(), description='The directory from which static files will be served', dangerous=True) frontend_libraries = ConfigSetting(description='A collection of front end libraries to include on pages') session_key_name = ConfigSetting(default='reahl', description='The name of this site\'s cookie in a user\'s a browser') guest_key_name = ConfigSetting(default='reahl-guest', description='The name of the cookie used to store information about anonymous visitors') guest_key_lifetime = ConfigSetting(default=60*60*24*365, description='The expiry time in seconds of the anonymous visitors cookie') session_class = ConfigSetting(description='The class used for UserSessions', automatic=True) persisted_exception_class = ConfigSetting(description='The class used for PersistedExceptions', automatic=True) persisted_userinput_class = ConfigSetting(description='The class used for UserInput', automatic=True) persisted_file_class = ConfigSetting(description='The class used for PersistedFiles', automatic=True) encrypted_http_scheme = ConfigSetting(default='https', description='The http scheme used for encrypted connections.') default_http_scheme = ConfigSetting(default='http', description='The http scheme used when an encrypted connection is not required' ) encrypted_http_port = ConfigSetting(default='8363', description='The http port used for encrypted connections.', dangerous=True) default_http_port = ConfigSetting(default='8000', description='The http port used when an encrypted connection is not required', dangerous=True ) default_url_locale = ConfigSetting(default='en_gb', description='The locale used when no locale is present in an URL') cache_max_age = ConfigSetting(default=10*60, description='The max time (in seconds) a cacheable dynamic page should be cached for') session_lifetime = ConfigSetting(default=60*60*24*7*2, description='The time in seconds a user session will be kept after last use') idle_lifetime = ConfigSetting(default=60*60*2, description='The time in seconds after which a user session will be considered idle - normal setting') idle_lifetime_max = ConfigSetting(default=60*60*24*7*2, description='The time in seconds after which a user session will be considered idle - "forever" setting') idle_secure_lifetime = ConfigSetting(default=60*60, description='The time in seconds after which a secure session will be considered expired') @property def secure_key_name(self): return '%s_secure' % self.session_key_name def __init__(self): super(WebConfig, self).__init__() # We create it here, so that each instance of a WebConfig will have its own LibraryIndex instance self.frontend_libraries = LibraryIndex(JQuery(), JQueryUI(), Underscore(), HTML5Shiv(), IE9(), Reahl(), Holder(), Popper(), # must be before Bootstrap in html script includes Bootstrap4(), ReahlBootstrap4Additions())
class ConfigWithSetting(Configuration): filename = 'config_file_for_this_egg.py' config_key = 'some_key' some_setting = ConfigSetting()
class ConfigWithInjectedSetting(Configuration): filename = 'config_file_for_this_egg.py' config_key = 'some_key' injected_setting = ConfigSetting(automatic=True)
class ConfigWithDangerousDefaultedSetting(Configuration): filename = 'config_file_for_this_egg.py' config_key = 'some_key' some_setting = ConfigSetting(default='default value', dangerous=True)
class ConfigWithDependentSetting(Configuration): filename = 'config_file_for_this_egg.py' config_key = 'some_key' some_setting = ConfigSetting(default='default value') some_other_setting = ConfigSetting( default=DeferredDefault(lambda c: 'tra %s lala' % c.some_setting))