moinsetup

Changeset

45:659dbbadf408
2011-09-17 Paul Boddie raw files shortlog changelog graph Added a method that shows the configuration settings including computed settings.
moinsetup.py (file)
     1.1 --- a/moinsetup.py	Fri Sep 16 00:35:03 2011 +0200
     1.2 +++ b/moinsetup.py	Sat Sep 17 00:12:44 2011 +0200
     1.3 @@ -287,6 +287,7 @@
     1.4      "A class for installing and initialising MoinMoin."
     1.5  
     1.6      method_names = (
     1.7 +        "show_config",
     1.8          "setup",
     1.9          "setup_wiki",
    1.10          "install_moin",
    1.11 @@ -318,6 +319,21 @@
    1.12          "install_page_package",
    1.13          )
    1.14  
    1.15 +    source_config_names = (
    1.16 +        "moin_distribution", "prefix", "site_packages", "htdocs_dir_source"
    1.17 +        )
    1.18 +
    1.19 +    instance_config_names = (
    1.20 +        "common_dir", "farm_config", "site_config",
    1.21 +        "site_name", "site_identifier",
    1.22 +        "front_page_name", "superuser", "theme_default", "htdocs_dir"
    1.23 +        )
    1.24 +
    1.25 +    site_config_names = (
    1.26 +        "web_app_dir", "web_site_dir", "web_static_dir",
    1.27 +        "url_path", "static_url_path"
    1.28 +        )
    1.29 +
    1.30      # NOTE: Need to detect Web server user.
    1.31  
    1.32      web_user = "www-data"
    1.33 @@ -455,6 +471,19 @@
    1.34          else:
    1.35              self.htdocs_dir = join(self.web_static_dir or self.common_dir, "htdocs")
    1.36  
    1.37 +    def show_config(self):
    1.38 +
    1.39 +        "Show the configuration."
    1.40 +
    1.41 +        print
    1.42 +        for section in ("source", "instance", "site"):
    1.43 +            print section.title()
    1.44 +            print "-" * len(section)
    1.45 +            print
    1.46 +            for setting in getattr(self, "%s_config_names" % section):
    1.47 +                print "%-20s%s" % (setting, getattr(self, setting))
    1.48 +            print
    1.49 +
    1.50      def _get_abspath(self, d):
    1.51          return d and abspath(d) or None
    1.52