class raven(Section): sentry_servers = ListOption() sentry_include_paths = ListOption( item=StringOption()) sentry_exclude_paths = ListOption( item=StringOption(), help='Ignore module prefixes when attempting to discover which ' 'function an error comes from.') sentry_timeout = IntOption( default=5, help='Timeout value for sending messages to remote.') sentry_name = StringOption( null=True, help='This will override the server_name value for this installation.') sentry_auto_log_stacks = BoolOption( default=False, help='Should raven automatically log frame stacks (including ' 'locals) all calls as it would for exceptions.') sentry_key = StringOption( null=True) sentry_max_length_string = IntOption( default=200, help='The maximum characters of a string that should be stored.') sentry_max_length_list = IntOption( default=50, help='The maximum number of items a list-like container should store.') sentry_site = StringOption( null=True, help='An optional, arbitrary string to identify this client ' 'installation.') sentry_public_key = StringOption( null=True, help='Public key of the project member which will authenticate as ' 'the client.') sentry_private_key = StringOption( null=True, help='Private key of the project member which will authenticate as ' 'the client.') sentry_project = IntOption( default=1, help='Sentry project ID. The default value for installations is 1.') sentry_processors = ListOption( item=StringOption(), default=[ 'raven.processors.SanitizePasswordsProcessor', ], help='List of processors to apply to events before sending them ' 'to the Sentry server.') sentry_dsn = StringOption( help='A sentry compatible DSN.') sentry_client = StringOption( default='raven.contrib.django.DjangoClient') sentry_debug = BoolOption( default=False)
class MySchema(Schema): foo = ListOption(item=DictOption( spec={ 'bar': StringOption(), 'baz': IntOption(), 'bla': BoolOption(), }))
class MySchema(Schema): foo = self.cls(spec={ 'bar': StringOption(), 'baz': IntOption(), 'bla': BoolOption(), }, parse_json=False)
class devserver(Section): devserver_args = ListOption( item=StringOption(), default=[], help='Additional command line arguments to pass to the runserver command (as defaults).') devserver_default_addr = StringOption( default='127.0.0.1', help='The default address to bind to.') devserver_default_port = StringOption( default='8000', help='The default port to bind to.') devserver_wsgi_middleware = ListOption( item=StringOption(), default=[], help='A list of additional WSGI middleware to apply to the runserver command.') devserver_modules = ListOption( item=StringOption(), default=[ 'devserver.modules.sql.SQLRealTimeModule', ], help='List of devserver modules to enable') devserver_ignored_prefixes = ListOption( item=StringOption(), default=['/media', '/uploads'], help='List of prefixes to supress and skip process on. By default, ' 'ADMIN_MEDIA_PREFIX, MEDIA_URL and STATIC_URL ' '(for Django >= 1.3) will be ignored (assuming MEDIA_URL and ' 'STATIC_URL is relative).') devserver_truncate_sql = BoolOption( default=True, help='Truncate SQL queries output by SQLRealTimeModule.') devserver_truncate_aggregates = BoolOption( default=False) devserver_active = BoolOption( default=False) devserver_ajax_content_length = IntOption( default=300, help='Maximum response length to dump.') devserver_ajax_pretty_print = BoolOption( default=False) devserver_sql_min_duration = IntOption( default=None, help='Minimum time a query must execute to be shown, value is in ms.') devserver_auto_profile = BoolOption( default=False, help='Automatically profile all view functions.')
class saml2(Section): saml2idp_autosubmit = BoolOption(default=True) saml2idp_issuer = StringOption(default='http://127.0.0.1:8000') saml2idp_certificate_file = StringOption( default='keys/certificate.pem') saml2idp_private_key_file = StringOption( default='keys/private-key.pem') saml2idp_signing = BoolOption(default=True) saml2idp_valid_acs = ListOption( item=StringOption(), default=[ 'https://login.salesforce.com', ], help="List of ACS URLs accepted by /+saml login") saml2idp_processor_classes = ListOption( item=StringOption(), default=[ 'saml2idp.salesforce.Processor', 'saml2idp.google_apps.Processor', ], help="List of SAML 2.0 AuthnRequest processors")
def test_equal(self): """Test DictOption equality.""" option1 = DictOption() option2 = DictOption(spec={'foo': BoolOption()}) option3 = DictOption(strict=True) option4 = DictOption(item=StringOption()) option5 = DictOption(item=IntOption()) self.assertEqual(option1, option1) self.assertNotEqual(option1, option2) self.assertNotEqual(option1, option3) self.assertEqual(option1, option4) self.assertNotEqual(option1, option5)
def test_init(self): """Test default values for DictOption attributes.""" opt = self.cls() self.assertEqual(opt.spec, {}) self.assertEqual(opt.strict, False) spec = {'a': IntOption(), 'b': BoolOption()} opt = self.cls(spec=spec) self.assertEqual(opt.spec, spec) self.assertEqual(opt.strict, False) opt = self.cls(spec=spec, strict=True) self.assertEqual(opt.spec, spec) self.assertEqual(opt.strict, True)
class openid(Section): openid_use_as_admin_login = BoolOption(default=False) openid_create_users = BoolOption(default=False) openid_update_details_from_sreg = BoolOption(default=False) openid_physical_multifactor_required = BoolOption(default=False) openid_strict_usernames = BoolOption(default=False) openid_sreg_required_fields = ListOption(item=StringOption()) openid_sreg_extra_fields = ListOption(item=StringOption()) openid_follow_renames = BoolOption(default=False) openid_launchpad_teams_mapping_auto = BoolOption(default=False) openid_launchpad_teams_mapping_auto_blacklist = ListOption( item=StringOption()) openid_launchpad_teams_mapping = DictOption() openid_launchpad_staff_teams = ListOption(item=StringOption()) openid_disallow_inames = BoolOption(default=False) allowed_external_openid_redirect_domains = ListOption( item=StringOption()) openid_trust_root = StringOption() openid_sso_server_url = StringOption(null=True)
def test_parse_dict_with_dicts(self): innerspec = { 'bar': StringOption(), 'baz': IntOption(), 'bla': BoolOption(), } spec = { 'name': StringOption(), 'size': IntOption(), 'options': DictOption(spec=innerspec) } class MySchema(Schema): foo = DictOption(spec=spec) config = StringIO("""[__main__] foo = outerdict [outerdict] options = innerdict [innerdict] bar = something baz = 42 """) expected_values = { '__main__': { 'foo': { 'name': '', 'size': 0, 'options': { 'bar': 'something', 'baz': 42, 'bla': False } } } } schema = MySchema() parser = SchemaConfigParser(schema) parser.readfp(config) self.assertEqual(parser.values(), expected_values)
class SchemaB(Schema): bar = BoolOption()
class OpenProximitySchema(Django13Schema): ################################################ # openproximity general settings ################################################ openproximity = Section('openproximity') openproximity.aircable_path = StringOption( default='/tmp/aircable', help= 'Path were we store the database file (if using sqlite) and storing files for campaigns etc' ) openproximity.op2_debug = BoolOption( default=True, help='Disable if you want to hide the "Databrowse" tab') openproximity.op2_translate = BoolOption( default=True, help='Disable if you want to hide the "Translate" tab') openproximity.op2_twitter = BoolOption( default=True, help='Disable if you want to hide the Twitter news client') openproximity.op2_logo = StringOption( default='logo.gif', help='Logo to display instead of AIRcable logo') openproximity.op2_plugins = DictOption( item=BoolOption(), help= """A list of plugins name with they're enable/disable state overrides plugins defaults)""" ) openproximity.op2_scanners = ListOption( item=TupleOption(4), help= """A list of ([MAC filter], scanner priority) for dongle configuration on initial discovery""" ) openproximity.op2_uploaders = ListOption( item=TupleOption(4), help= """A list of ([MAC filter], max connections) for dongle configuration on initial discovery""" ) ################################################ # cherrypy settings ################################################ cherrypy = Section('cherrypy') cherrypy.cp_host = StringOption(default="localhost", help='hostname to listen on') cherrypy.cp_port = IntOption(default=8088, help='port to listen on') cherrypy.cp_server_name = StringOption( default="localhost", help="CherryPy's SERVER_NAME environ entry") cherrypy.cp_daemonize = BoolOption(default=False, help='whether to detach from terminal') cherrypy.cp_pidfile = StringOption( default=None, help="write the spawned process-id to this file") cherrypy.cp_workdir = StringOption( default=None, help="change to this directory when daemonizing") cherrypy.cp_threads = IntOption(default=20, help='Number of threads for server to use') cherrypy.cp_ssl_certificate = StringOption(default=None, help="SSL certificate filename") cherrypy.cp_ssl_private_key = StringOption(default=None, help="SSL private key filename") cherrypy.cp_server_user = StringOption( default='www-data', help="user to run daemonized process") cherrypy.cp_server_group = StringOption(default='www-data', help="group to daemonized process") ################################################ # rpyc settings ################################################ rpyc = Section('rpyc') rpyc.rpc_host = StringOption(default="localhost", help='hostname to listen on') rpyc.rpc_port = IntOption(default=8010, help='port to listen on') rpyc.rpc_daemonize = BoolOption(default=False, help='whether to detach from terminal') rpyc.rpc_threaded = BoolOption( default=True, help='run in threaded way instead of forked') rpyc.rpc_autoregister = BoolOption( default=False, help='try registering the server in name servers') rpyc.rpc_pidfile = StringOption( default=None, help="write the spawned process-id to this file") rpyc.rpc_server_user = StringOption(default='www-data', help="user to run daemonized process") rpyc.rpc_server_group = StringOption(default='www-data', help="group to daemonized process") ################################################ # debugging settings ################################################ debug = Section('debug') debug.debug_console = StringOption( default='INFO', help='console debug level, default INFO') debug.debug_level = StringOption(default='DEBUG', help='in file debug level, default DEBUG') debug.debug_path = StringOption( default='/var/log/openproximity', help='default path used for storing log files') debug.debug_maxsize = IntOption(default=10, help='max log file in MB, defaults to 10') debug.debug_count = IntOption( default=5, help='amount of log files to store when rotating, defaults to 2') debug.debug_filename = StringOption( default=None, help='file name used for this debug session, defaults to sys.argv[1]') debug.debug_console_format = StringOption( default='%(name)s %(module)s:%(funcName)s: %(message)s', help='console log formatting') debug.debug_format = StringOption( default= '%(asctime)-12s - %(levelname)5s - %(name)10s - %(funcName)-12s: %(message)s', help='file log formatting') debug.debug_disables = StringOption( default='', help='comma separated list of disable log modules') rpc_client = Section("rpc_client") rpc_client.client_mode = StringOption() rpc_client.client_daemonize = BoolOption(default=False) rpc_client.client_pidfile = StringOption(default=None) rpc_client.client_host = StringOption(default="localhost") rpc_client.client_port = IntOption(default=8010)
class MySchema(Schema): foo = BoolOption() class bar(Section): baz = IntOption()
class bar(Section): baz = BoolOption()
class __main__(Section): foo = BoolOption()
class MySchema(Schema): foo = StringOption() bar = BoolOption()
class froo(Section): twaddle = ListOption(item=BoolOption())
class MySchema(Schema): foo = self.cls(item=BoolOption())
class MySchema(Schema): foo = BoolOption()
class SchemaB(Schema): foo = BoolOption()
class foo(Section): baz = BoolOption()
class nexus(Section): nexus_media_prefix = StringOption( default='/nexus/media/') nexus_use_django_media_url = BoolOption( default=False)
class MySchema(Schema): foo = BoolOption(default=True) class bar(Section): baz = IntOption() bla = StringOption(default='hello')
class MySchema(Schema): foo = DictOption(spec={ 'bar': IntOption(), 'baz': BoolOption()})
class MySchema(Schema): foo = IntOption() bar = BoolOption()