When is the configuration read in Zope 2.7?
During the product registration the ZReST product is imported. on the module level it contains default_output_encoding = getConfiguration().rest_output_encoding or default_enc I would inspect that at this point the configuration from zope.conf has been read and rest_output_encoding should be available but instead the following AttributeError occurs. Any ideas why? Traceback (most recent call last): File "test.py", line 490, in get_suite mod = package_import(modname) File "test.py", line 464, in package_import mod = __import__(modname) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/AccessControl/tests/testUserFolder.py", line 24, in ? Zope.startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/App/startup.py", line 45, in startup OFS.Application.import_products() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 631, in import_products import_product(product_dir, product_name, raise_exc=debug_mode) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 654, in import_product product=__import__(pname, global_dict, global_dict, silly) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/__init__.py", line 7, in ? import ZReST File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/ZReST.py", line 27, in ? default_output_encoding = getConfiguration().rest_output_encoding or default_enc AttributeError: DefaultConfiguration instance has no attribute 'rest_output_encoding' Andreas -- Andreas Jung -------------------------------- www.zopyx.com Software-Entwicklung und Consulting Andreas Jung
Sounds like its using the "default" configuration (which means Zope.configure never got called). I assume it works during normal startup, just not during unit tests? On Fri, 2004-05-14 at 13:09, Andreas Jung wrote:
During the product registration the ZReST product is imported. on the module level it contains
default_output_encoding = getConfiguration().rest_output_encoding or default_enc
I would inspect that at this point the configuration from zope.conf has been read and rest_output_encoding should be available but instead the following AttributeError occurs. Any ideas why?
Traceback (most recent call last): File "test.py", line 490, in get_suite mod = package_import(modname) File "test.py", line 464, in package_import mod = __import__(modname) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/AccessControl/tests/testUserFolder.py", line 24, in ? Zope.startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/App/startup.py", line 45, in startup OFS.Application.import_products() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 631, in import_products import_product(product_dir, product_name, raise_exc=debug_mode) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 654, in import_product product=__import__(pname, global_dict, global_dict, silly) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/__init__.py", line 7, in ? import ZReST File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/ZReST.py", line 27, in ? default_output_encoding = getConfiguration().rest_output_encoding or default_enc AttributeError: DefaultConfiguration instance has no attribute 'rest_output_encoding'
Andreas
No, this happened during the standard Zope startup. Andreas --On Freitag, 14. Mai 2004 13:25 Uhr -0400 Chris McDonough <chrism@plope.com> wrote:
Sounds like its using the "default" configuration (which means Zope.configure never got called). I assume it works during normal startup, just not during unit tests?
On Fri, 2004-05-14 at 13:09, Andreas Jung wrote:
During the product registration the ZReST product is imported. on the module level it contains
default_output_encoding = getConfiguration().rest_output_encoding or default_enc
I would inspect that at this point the configuration from zope.conf has been read and rest_output_encoding should be available but instead the following AttributeError occurs. Any ideas why?
Traceback (most recent call last): File "test.py", line 490, in get_suite mod = package_import(modname) File "test.py", line 464, in package_import mod = __import__(modname) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/AccessControl/tests/test UserFolder.py", line 24, in ? Zope.startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/App/startup.py", line 45, in startup OFS.Application.import_products() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 631, in import_products import_product(product_dir, product_name, raise_exc=debug_mode) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 654, in import_product product=__import__(pname, global_dict, global_dict, silly) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/__init__. py", line 7, in ? import ZReST File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/ZReST.py" , line 27, in ? default_output_encoding = getConfiguration().rest_output_encoding or default_enc AttributeError: DefaultConfiguration instance has no attribute 'rest_output_encoding'
Andreas
-- Andreas Jung -------------------------------- www.zopyx.com Software-Entwicklung und Consulting Andreas Jung
I've got no suggestions. Is it broken in the 2.7 branch at the moment? On Fri, 2004-05-14 at 17:24, Andreas Jung wrote:
No, this happened during the standard Zope startup.
Andreas
--On Freitag, 14. Mai 2004 13:25 Uhr -0400 Chris McDonough <chrism@plope.com> wrote:
Sounds like its using the "default" configuration (which means Zope.configure never got called). I assume it works during normal startup, just not during unit tests?
On Fri, 2004-05-14 at 13:09, Andreas Jung wrote:
During the product registration the ZReST product is imported. on the module level it contains
default_output_encoding = getConfiguration().rest_output_encoding or default_enc
I would inspect that at this point the configuration from zope.conf has been read and rest_output_encoding should be available but instead the following AttributeError occurs. Any ideas why?
Traceback (most recent call last): File "test.py", line 490, in get_suite mod = package_import(modname) File "test.py", line 464, in package_import mod = __import__(modname) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/AccessControl/tests/test UserFolder.py", line 24, in ? Zope.startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/__init__.py", line 46, in startup _startup() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Zope/App/startup.py", line 45, in startup OFS.Application.import_products() File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 631, in import_products import_product(product_dir, product_name, raise_exc=debug_mode) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/OFS/Application.py", line 654, in import_product product=__import__(pname, global_dict, global_dict, silly) File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/__init__. py", line 7, in ? import ZReST File "/home/chrism/opt/tests/sandbox/Zope/lib/python/Products/ZReST/ZReST.py" , line 27, in ? default_output_encoding = getConfiguration().rest_output_encoding or default_enc AttributeError: DefaultConfiguration instance has no attribute 'rest_output_encoding'
Andreas
I am under the impression that the ZOPE_CONFIG patch broke 2.7 branch. Please see http://zope.org/Collectors/Zope/1233 Configuration is used very early, that's why I suggested to put the logic into getConfiguration. Zope tests fail for me, unfortunately Andreas cannot reproduce this. Stefan On Samstag, Mai 15, 2004, at 00:54 Europe/Vienna, Chris McDonough wrote:
I've got no suggestions. Is it broken in the 2.7 branch at the moment?
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
I am under the impression that the ZOPE_CONFIG patch broke 2.7 branch. Please see http://zope.org/Collectors/Zope/1233
Both problems are not related. I made the ZRest.py patch before the ZOPE_CONFIG patch and the daily testrunner output showed my reported problem the night before.
Configuration is used very early, that's why I suggested to put the logic into getConfiguration.
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
I'll have a closer look into this next week... Andreas -- Andreas Jung -------------------------------- www.zopyx.com Software-Entwicklung und Consulting Andreas Jung
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
The ZOPE_CONFIG patch was responsible for other failures. I reverted the change and check for a better solution by next week. -aj -- Andreas Jung -------------------------------- www.zopyx.com Software-Entwicklung und Consulting Andreas Jung
I think Fred might have some ideas about how to do the ZOPE_CONFIG feature better if you can coax them out of him. ;-) On Sat, 2004-05-15 at 03:56, Andreas Jung wrote:
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
The ZOPE_CONFIG patch was responsible for other failures. I reverted the change and check for a better solution by next week.
-aj
Things changed around a bit since I did this patch. I'm trying to get a new one working but am having some issues with the 2.7 trunk in svn. I think in general the startup sequence could use some clean up. I'm working on mapping how it all works maybe that would help make it less opaque. -EAD On May 15, 2004, at 12:53 PM, Chris McDonough wrote:
I think Fred might have some ideas about how to do the ZOPE_CONFIG feature better if you can coax them out of him. ;-)
On Sat, 2004-05-15 at 03:56, Andreas Jung wrote:
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
The ZOPE_CONFIG patch was responsible for other failures. I reverted the change and check for a better solution by next week.
-aj
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
On Mon, 2004-05-17 at 11:41, Erik A.Dahl wrote:
Things changed around a bit since I did this patch. I'm trying to get a new one working but am having some issues with the 2.7 trunk in svn.
The 2.7 branch is still in CVS; only the HEAD is in subversion.
I think in general the startup sequence could use some clean up. I'm working on mapping how it all works maybe that would help make it less opaque.
OK... - C
Things changed around a bit since I did this patch. I'm trying to get a new one working but am having some issues with the 2.7 trunk in svn. I think in general the startup sequence could use some clean up. I'm working on mapping how it all works maybe that would help make it less opaque. -EAD On May 15, 2004, at 12:53 PM, Chris McDonough wrote:
I think Fred might have some ideas about how to do the ZOPE_CONFIG feature better if you can coax them out of him. ;-)
On Sat, 2004-05-15 at 03:56, Andreas Jung wrote:
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
The ZOPE_CONFIG patch was responsible for other failures. I reverted the change and check for a better solution by next week.
-aj
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Ok, I think I have a fix for this but we have a little semantics issue. I thought that once the Zope config was set it could not be changed. In the new ZOPE_CONFIG patch the environ variable only gets used as a last resort in Zope.app() if no other configuration has been set. To do this I added a isConfigured() function to App.config to check its _config global. I'm assuming that this is the "official" Zope config, correct? Now there is a test testZopeRunConfigure in lib/python/Zope/Startup/tests/testStarter.py that runs App.config.getConfiguration() and then makes a test config file and sets it. The result is a test where the config is reset within one run. This test fails with the semantics described above. Which is correct? I'm enclosing the patch for reference. -EAD On May 17, 2004, at 12:20 PM, Erik A.Dahl wrote:
Things changed around a bit since I did this patch. I'm trying to get a new one working but am having some issues with the 2.7 trunk in svn. I think in general the startup sequence could use some clean up. I'm working on mapping how it all works maybe that would help make it less opaque.
-EAD
On May 15, 2004, at 12:53 PM, Chris McDonough wrote:
I think Fred might have some ideas about how to do the ZOPE_CONFIG feature better if you can coax them out of him. ;-)
On Sat, 2004-05-15 at 03:56, Andreas Jung wrote:
--On Samstag, 15. Mai 2004 1:59 Uhr +0200 "Stefan H. Holek" <stefan@epy.co.at> wrote:
Zope tests fail for me, unfortunately Andreas cannot reproduce this.
The ZOPE_CONFIG patch was responsible for other failures. I reverted the change and check for a better solution by next week.
-aj
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
I tried the patch but a unittest is still failing: ajung@localhost:~/sandboxes/Zope-2_7-branch: python2.3 test.py --dir lib/python/Zope Running unit tests from /develop/sandboxes/Zope-2_7-branch INFO:event:INFO(0) Zope hello Error in test testZopeRunConfigure (Zope.Startup.tests.testStarter.ZopeStarterTestCase) Traceback (most recent call last): File "/develop/sandboxes/Zope-2_7-branch/lib/python/Zope/Startup/tests/testStarter.py", line 359, in testZopeRunConfigure self.failUnlessEqual(new_config.zserver_threads, 100) AttributeError: DefaultConfiguration instance has no attribute 'zserver_threads' -aj --On Montag, 17. Mai 2004 14:38 Uhr -0400 "Erik A.Dahl" <edahl@confmon.com> wrote:
Ok,
I think I have a fix for this but we have a little semantics issue. I thought that once the Zope config was set it could not be changed. In the new ZOPE_CONFIG patch the environ variable only gets used as a last resort in Zope.app() if no other configuration has been set. To do this I added a isConfigured() function to App.config to check its _config global. I'm assuming that this is the "official" Zope config, correct?
Now there is a test testZopeRunConfigure in lib/python/Zope/Startup/tests/testStarter.py that runs App.config.getConfiguration() and then makes a test config file and sets it. The result is a test where the config is reset within one run. This test fails with the semantics described above. Which is correct? I'm enclosing the patch for reference.
-EAD
-- Andreas Jung -------------------------------- www.zopyx.com Software-Entwicklung und Consulting Andreas Jung
participants (5)
-
Andreas Jung -
Chris McDonough -
Erik A.Dahl -
Erik A.Dahl -
Stefan H. Holek