Commits

Olemis Lang committed e8e2c3d

BH Multiproduct #115 : Rewrite Option accessor to enable polymorphism

  • Participants
  • Parent commits ca08d76
  • Branches t115_bep3_product_env

Comments (0)

Files changed (2)

+t115/t115_r1436300_option_accessor.diff
 #t333/t333_r1427886_schema_autoinc.diff
 #t333/t333_r1427886_mp_gen_schema.diff
 #t115/t115_r1429886_product_envs.diff
 #t115/t115_r1429886_product_config.diff
 #t115/t115_r1429886_product_envs_testing.diff
 #t115/t115_r1431447_product_envs_bep3_p1.diff
-t115/t115_r1433322_unittest2_assertRaises_msg.diff
+#t115/t115_r1433322_unittest2_assertRaises_msg.diff

File t115/t115_r1436300_option_accessor.diff

+# HG changeset patch
+# Parent bdbd5545552f423a9df3eafa357b9cb6c29b3aae
+BH Multiproduct #115 : Polymorphic access to Section methods in Option accessor
+
+diff -r bdbd5545552f trac/trac/config.py
+--- a/trac/trac/config.py	Mon Jan 21 12:25:38 2013 +0000
++++ b/trac/trac/config.py	Wed Jan 23 00:08:24 2013 -0500
+@@ -567,7 +567,9 @@
+     """Descriptor for configuration options."""
+ 
+     registry = {}
+-    accessor = Section.get
++
++    def accessor(self, section, name, default):
++        return section.get(name, default)
+ 
+     @staticmethod
+     def get_registry(compmgr=None):
+@@ -615,17 +617,20 @@
+ 
+ class BoolOption(Option):
+     """Descriptor for boolean configuration options."""
+-    accessor = Section.getbool
++    def accessor(self, section, name, default):
++        return section.getbool(name, default)
+ 
+ 
+ class IntOption(Option):
+     """Descriptor for integer configuration options."""
+-    accessor = Section.getint
++    def accessor(self, section, name, default):
++        return section.getint(name, default)
+ 
+ 
+ class FloatOption(Option):
+     """Descriptor for float configuration options."""
+-    accessor = Section.getfloat
++    def accessor(self, section, name, default):
++        return section.getfloat(name, default)
+ 
+ 
+ class ListOption(Option):
+@@ -673,7 +678,8 @@
+     Relative paths are resolved to absolute paths using the directory
+     containing the configuration file as the reference.
+     """
+-    accessor = Section.getpath
++    def accessor(self, section, name, default):
++        return section.getpath(name, default)
+ 
+ 
+ class ExtensionOption(Option):