comparison MoinMoin/config/multiconfig.py @ 3881:15bd8dae9003

merged some 1.7 changesets
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 27 Jul 2008 13:21:17 +0200
parents e5a9570d3001 85cd05b8af42
children f85cd27073a9
comparison
equal deleted inserted replaced
3879:f042906b346e 3881:15bd8dae9003
360 self.url_prefix_action = action_prefix[:-1] 360 self.url_prefix_action = action_prefix[:-1]
361 361
362 if self.url_prefix_local is None: 362 if self.url_prefix_local is None:
363 self.url_prefix_local = self.url_prefix_static 363 self.url_prefix_local = self.url_prefix_static
364 364
365 if self.secrets is None: # admin did not setup a real secret, so make up something
366 self.secrets = self.calc_secrets()
367
365 secret_key_names = ['action/cache', 'wikiutil/tickets', 'xmlrpc/ProcessMail', 'xmlrpc/RemoteScript', ] 368 secret_key_names = ['action/cache', 'wikiutil/tickets', 'xmlrpc/ProcessMail', 'xmlrpc/RemoteScript', ]
366 if self.jabber_enabled: 369 if self.jabber_enabled:
367 secret_key_names.append('jabberbot') 370 secret_key_names.append('jabberbot')
368 371
369 secret_min_length = 10 372 secret_min_length = 10
384 if len(secret) < secret_min_length: 387 if len(secret) < secret_min_length:
385 raise ValueError 388 raise ValueError
386 except (KeyError, ValueError): 389 except (KeyError, ValueError):
387 raise error.ConfigurationError("You must set a (at least %d chars long) secret string for secrets['%s']!" % ( 390 raise error.ConfigurationError("You must set a (at least %d chars long) secret string for secrets['%s']!" % (
388 secret_min_length, secret_key_name)) 391 secret_min_length, secret_key_name))
392
393 def calc_secrets(self):
394 """ make up some 'secret' using some config values """
395 varnames = ['data_dir', 'data_underlay_dir', 'language_default',
396 'mail_smarthost', 'mail_from', 'page_front_page',
397 'theme_default', 'sitename', 'logo_string',
398 'interwikiname', 'user_homewiki', 'acl_rights_before', ]
399 secret = ''
400 for varname in varnames:
401 var = getattr(self, varname, None)
402 if isinstance(var, (str, unicode)):
403 secret += repr(var)
404 return secret
389 405
390 _meta_dict = None 406 _meta_dict = None
391 def load_meta_dict(self): 407 def load_meta_dict(self):
392 """ The meta_dict contains meta data about the wiki instance. """ 408 """ The meta_dict contains meta data about the wiki instance. """
393 if self._meta_dict is None: 409 if self._meta_dict is None:
692 "List of trusted user names with wiki system administration super powers (not to be confused with ACL admin rights!). Used for e.g. software installation, language installation via SystemPagesSetup and more. See also HelpOnSuperUser."), 708 "List of trusted user names with wiki system administration super powers (not to be confused with ACL admin rights!). Used for e.g. software installation, language installation via SystemPagesSetup and more. See also HelpOnSuperUser."),
693 ('auth', DefaultExpression('[MoinAuth()]'), 709 ('auth', DefaultExpression('[MoinAuth()]'),
694 "list of auth objects, to be called in this order (see HelpOnAuthentication)"), 710 "list of auth objects, to be called in this order (see HelpOnAuthentication)"),
695 ('auth_methods_trusted', ['http', 'xmlrpc_applytoken'], 711 ('auth_methods_trusted', ['http', 'xmlrpc_applytoken'],
696 'authentication methods for which users should be included in the special "Trusted" ACL group.'), 712 'authentication methods for which users should be included in the special "Trusted" ACL group.'),
697 ('secrets', '', 'Either a long shared secret string used for multiple purposes or a dict {"purpose": "longsecretstring", ...} for setting up different shared secrets for different purposes. REQUIRED!'), 713 ('secrets', None, """Either a long shared secret string used for multiple purposes or a dict {"purpose": "longsecretstring", ...} for setting up different shared secrets for different purposes. If you don't setup own secret(s), a secret string will be auto-generated from other config settings."""),
698 ('DesktopEdition', 714 ('DesktopEdition',
699 False, 715 False,
700 "if True, give all local users special powers - ''only use this for a local desktop wiki!''"), 716 "if True, give all local users special powers - ''only use this for a local desktop wiki!''"),
701 ('SecurityPolicy', 717 ('SecurityPolicy',
702 None, 718 None,