XSLTools

Change of examples/Common/QtConfigurator/__init__.py

370:6fca0ee493a6
examples/Common/QtConfigurator/__init__.py
     1.1 --- a/examples/Common/QtConfigurator/__init__.py	Mon Oct 31 23:59:52 2005 +0000
     1.2 +++ b/examples/Common/QtConfigurator/__init__.py	Mon Oct 31 23:59:56 2005 +0000
     1.3 @@ -37,17 +37,19 @@
     1.4  
     1.5      def form_init(self):
     1.6  
     1.7 -        # NOTE: This would be done for whole page updates in a Web application.
     1.8 +        self.reset_collection(self.child("hard_disks"))
     1.9 +        self.reset_collection(self.child("memory_units"))
    1.10 +        self.reset_collection(self.child("storage_units"))
    1.11 +
    1.12 +    def form_populate(self):
    1.13  
    1.14          # Get field data.
    1.15 +        # NOTE: This would be done for whole page updates in a Web application.
    1.16  
    1.17          self.populate_list(self.child("base_system"), self.get_elements("base-system"))
    1.18          self.populate_list(self.child("keyboard"), self.get_elements("keyboard"))
    1.19          self.populate_list(self.child("mouse"), self.get_elements("mouse"))
    1.20          self.populate_list(self.child("screen"), self.get_elements("screen"))
    1.21 -        self.reset_collection(self.child("hard_disks"))
    1.22 -        self.reset_collection(self.child("memory_units"))
    1.23 -        self.reset_collection(self.child("storage_units"))
    1.24  
    1.25      # General functionality.
    1.26  
    1.27 @@ -182,6 +184,7 @@
    1.28                  ConfiguratorResource.__init__(self, *args, **kw)
    1.29          resource = Configurator(*args, **kw)
    1.30          resource.form_init()
    1.31 +        resource.form_populate()
    1.32  
    1.33      else:
    1.34          import XSLForms.Resources.PyQtWebResources
    1.35 @@ -190,8 +193,9 @@
    1.36                  XSLForms.Resources.PyQtWebResources.XSLFormsResource.__init__(self, "configuration")
    1.37                  ConfiguratorResource.__init__(self, *args, **kw)
    1.38          resource = Configurator(*args, **kw)
    1.39 -        # Do not initialise the resource here - it happens when a Web request is
    1.40 -        # received.
    1.41 +        # Do not initialise or populate the resource here: both happen when a
    1.42 +        # Web request is received (initialisation when no form document is
    1.43 +        # found; population when a form document is prepared for output).
    1.44  
    1.45      return resource
    1.46