web/webconfig.py
brancholdstable
changeset 5993 50e1a6ad3e98
parent 5554 9b7bdbfee68b
child 5555 a64f48dd5fe4
equal deleted inserted replaced
5487:3ab2682a4b37 5993:50e1a6ad3e98
    73 
    73 
    74 class WebConfiguration(CubicWebConfiguration):
    74 class WebConfiguration(CubicWebConfiguration):
    75     """the WebConfiguration is a singleton object handling instance's
    75     """the WebConfiguration is a singleton object handling instance's
    76     configuration and preferences
    76     configuration and preferences
    77     """
    77     """
    78     cubicweb_appobject_path = CubicWebConfiguration.cubicweb_appobject_path | set(['web/views'])
    78     cubicweb_appobject_path = CubicWebConfiguration.cubicweb_appobject_path | set([join('web', 'views')])
    79     cube_appobject_path = CubicWebConfiguration.cube_appobject_path | set(['views'])
    79     cube_appobject_path = CubicWebConfiguration.cube_appobject_path | set(['views'])
    80 
    80 
    81     options = merge_options(CubicWebConfiguration.options + (
    81     options = merge_options(CubicWebConfiguration.options + (
    82         ('anonymous-user',
    82         ('anonymous-user',
    83          {'type' : 'string',
    83          {'type' : 'string',
    84           'default': None,
    84           'default': None,
    85           'help': 'login of the CubicWeb user account to use for anonymous user (if you want to allow anonymous)',
    85           'help': 'login of the CubicWeb user account to use for anonymous user (if you want to allow anonymous)',
    86           'group': 'main', 'inputlevel': 1,
    86           'group': 'web', 'level': 1,
    87           }),
    87           }),
    88         ('anonymous-password',
    88         ('anonymous-password',
    89          {'type' : 'string',
    89          {'type' : 'string',
    90           'default': None,
    90           'default': None,
    91           'help': 'password of the CubicWeb user account to use for anonymous user, '
    91           'help': 'password of the CubicWeb user account to use for anonymous user, '
    92           'if anonymous-user is set',
    92           'if anonymous-user is set',
    93           'group': 'main', 'inputlevel': 1,
    93           'group': 'web', 'level': 1,
    94           }),
    94           }),
    95         ('query-log-file',
    95         ('query-log-file',
    96          {'type' : 'string',
    96          {'type' : 'string',
    97           'default': None,
    97           'default': None,
    98           'help': 'web instance query log file',
    98           'help': 'web instance query log file',
    99           'group': 'main', 'inputlevel': 3,
    99           'group': 'web', 'level': 3,
   100           }),
   100           }),
   101         # web configuration
   101         # web configuration
   102         ('https-url',
   102         ('https-url',
   103          {'type' : 'string',
   103          {'type' : 'string',
   104           'default': None,
   104           'default': None,
   108           'https site. IMPORTANTE NOTE: to do this work, you should have your '\
   108           'https site. IMPORTANTE NOTE: to do this work, you should have your '\
   109           'apache redirection include "https" as base url path so cubicweb can '\
   109           'apache redirection include "https" as base url path so cubicweb can '\
   110           'differentiate between http vs https access. For instance: \n'\
   110           'differentiate between http vs https access. For instance: \n'\
   111           'RewriteRule ^/demo/(.*) http://127.0.0.1:8080/https/$1 [L,P]\n'\
   111           'RewriteRule ^/demo/(.*) http://127.0.0.1:8080/https/$1 [L,P]\n'\
   112           'where the cubicweb web server is listening on port 8080.',
   112           'where the cubicweb web server is listening on port 8080.',
   113           'group': 'main', 'inputlevel': 3,
   113           'group': 'main', 'level': 3,
   114           }),
   114           }),
   115         ('auth-mode',
   115         ('auth-mode',
   116          {'type' : 'choice',
   116          {'type' : 'choice',
   117           'choices' : ('cookie', 'http'),
   117           'choices' : ('cookie', 'http'),
   118           'default': 'cookie',
   118           'default': 'cookie',
   119           'help': 'authentication mode (cookie / http)',
   119           'help': 'authentication mode (cookie / http)',
   120           'group': 'web', 'inputlevel': 3,
   120           'group': 'web', 'level': 3,
   121           }),
   121           }),
   122         ('realm',
   122         ('realm',
   123          {'type' : 'string',
   123          {'type' : 'string',
   124           'default': 'cubicweb',
   124           'default': 'cubicweb',
   125           'help': 'realm to use on HTTP authentication mode',
   125           'help': 'realm to use on HTTP authentication mode',
   126           'group': 'web', 'inputlevel': 3,
   126           'group': 'web', 'level': 3,
   127           }),
   127           }),
   128         ('http-session-time',
   128         ('http-session-time',
   129          {'type' : 'time',
   129          {'type' : 'time',
   130           'default': 0,
   130           'default': 0,
   131           'help': "duration of the cookie used to store session identifier. "
   131           'help': "duration of the cookie used to store session identifier. "
   132           "If 0, the cookie will expire when the user exist its browser. "
   132           "If 0, the cookie will expire when the user exist its browser. "
   133           "Should be 0 or greater than repository\'s session-time.",
   133           "Should be 0 or greater than repository\'s session-time.",
   134           'group': 'web', 'inputlevel': 3,
   134           'group': 'web', 'level': 2,
   135           }),
   135           }),
   136         ('cleanup-session-time',
   136         ('cleanup-session-time',
   137          {'type' : 'time',
   137          {'type' : 'time',
   138           'default': '24h',
   138           'default': '24h',
   139           'help': 'duration of inactivity after which a connection '
   139           'help': 'duration of inactivity after which a connection '
   140           'will be closed, to limit memory consumption (avoid sessions that '
   140           'will be closed, to limit memory consumption (avoid sessions that '
   141           'never expire and cause memory leak when http-session-time is 0). '
   141           'never expire and cause memory leak when http-session-time is 0). '
   142           'So even if http-session-time is 0 and the user don\'t close his '
   142           'So even if http-session-time is 0 and the user don\'t close his '
   143           'browser, he will have to reauthenticate after this time of '
   143           'browser, he will have to reauthenticate after this time of '
   144           'inactivity. Default to 24h.',
   144           'inactivity. Default to 24h.',
   145           'group': 'web', 'inputlevel': 3,
   145           'group': 'web', 'level': 3,
   146           }),
   146           }),
   147         ('cleanup-anonymous-session-time',
   147         ('cleanup-anonymous-session-time',
   148          {'type' : 'time',
   148          {'type' : 'time',
   149           'default': '5min',
   149           'default': '5min',
   150           'help': 'Same as cleanup-session-time but specific to anonymous '
   150           'help': 'Same as cleanup-session-time but specific to anonymous '
   151           'sessions. You can have a much smaller timeout here since it will be '
   151           'sessions. You can have a much smaller timeout here since it will be '
   152           'transparent to the user. Default to 5min.',
   152           'transparent to the user. Default to 5min.',
   153           'group': 'web', 'inputlevel': 3,
   153           'group': 'web', 'level': 3,
   154           }),
   154           }),
   155         ('force-html-content-type',
   155         ('force-html-content-type',
   156          {'type' : 'yn',
   156          {'type' : 'yn',
   157           'default': False,
   157           'default': False,
   158           'help': 'force text/html content type for your html pages instead of cubicweb user-agent based'\
   158           'help': 'force text/html content type for your html pages instead of cubicweb user-agent based'\
   159           'deduction of an appropriate content type',
   159           'deduction of an appropriate content type',
   160           'group': 'web', 'inputlevel': 3,
   160           'group': 'web', 'level': 3,
   161           }),
   161           }),
   162         ('embed-allowed',
   162         ('embed-allowed',
   163          {'type' : 'regexp',
   163          {'type' : 'regexp',
   164           'default': None,
   164           'default': None,
   165           'help': 'regular expression matching URLs that may be embeded. \
   165           'help': 'regular expression matching URLs that may be embeded. \
   166 leave it blank if you don\'t want the embedding feature, or set it to ".*" \
   166 leave it blank if you don\'t want the embedding feature, or set it to ".*" \
   167 if you want to allow everything',
   167 if you want to allow everything',
   168           'group': 'web', 'inputlevel': 3,
   168           'group': 'web', 'level': 3,
   169           }),
   169           }),
   170         ('submit-mail',
   170         ('submit-mail',
   171          {'type' : 'string',
   171          {'type' : 'string',
   172           'default': None,
   172           'default': None,
   173           'help': ('Mail used as recipient to report bug in this instance, '
   173           'help': ('Mail used as recipient to report bug in this instance, '
   174                    'if you want this feature on'),
   174                    'if you want this feature on'),
   175           'group': 'web', 'inputlevel': 2,
   175           'group': 'web', 'level': 2,
   176           }),
   176           }),
   177 
   177 
   178         ('language-negociation',
   178         ('language-negociation',
   179          {'type' : 'yn',
   179          {'type' : 'yn',
   180           'default': True,
   180           'default': True,
   181           'help': 'use Accept-Language http header to try to set user '\
   181           'help': 'use Accept-Language http header to try to set user '\
   182           'interface\'s language according to browser defined preferences',
   182           'interface\'s language according to browser defined preferences',
   183           'group': 'web', 'inputlevel': 2,
   183           'group': 'web', 'level': 2,
   184           }),
   184           }),
   185 
   185 
   186         ('print-traceback',
   186         ('print-traceback',
   187          {'type' : 'yn',
   187          {'type' : 'yn',
   188           'default': CubicWebConfiguration.mode != 'system',
   188           'default': CubicWebConfiguration.mode != 'system',
   189           'help': 'print the traceback on the error page when an error occured',
   189           'help': 'print the traceback on the error page when an error occured',
   190           'group': 'web', 'inputlevel': 2,
   190           'group': 'web', 'level': 2,
   191           }),
   191           }),
   192 
   192 
   193         ('captcha-font-file',
   193         ('captcha-font-file',
   194          {'type' : 'string',
   194          {'type' : 'string',
   195           'default': join(CubicWebConfiguration.shared_dir(), 'data', 'porkys.ttf'),
   195           'default': join(CubicWebConfiguration.shared_dir(), 'data', 'porkys.ttf'),
   196           'help': 'True type font to use for captcha image generation (you \
   196           'help': 'True type font to use for captcha image generation (you \
   197 must have the python imaging library installed to use captcha)',
   197 must have the python imaging library installed to use captcha)',
   198           'group': 'web', 'inputlevel': 3,
   198           'group': 'web', 'level': 3,
   199           }),
   199           }),
   200         ('captcha-font-size',
   200         ('captcha-font-size',
   201          {'type' : 'int',
   201          {'type' : 'int',
   202           'default': 25,
   202           'default': 25,
   203           'help': 'Font size to use for captcha image generation (you must \
   203           'help': 'Font size to use for captcha image generation (you must \
   204 have the python imaging library installed to use captcha)',
   204 have the python imaging library installed to use captcha)',
   205           'group': 'web', 'inputlevel': 3,
   205           'group': 'web', 'level': 3,
   206           }),
   206           }),
   207 
   207 
   208         ))
   208         ))
   209 
   209 
   210     def fckeditor_installed(self):
   210     def fckeditor_installed(self):