grokproject generates faulty ftesting.zcml

Reported by Santiago Videla on 2008-04-27
4
Affects Status Importance Assigned to Milestone
grok
Medium
Uli Fouquet

Bug Description

grokproject generate a wrong ftesting.zcml with Grok 0.12

Here is the error log while trying to make some basic functional testing

./bin/test
Running tests at level 1
Running unit tests:
  Running:
..
  Ran 2 tests with 0 failures and 0 errors in 0.005 seconds.
Running sample.testing.FunctionalLayer tests:
  Set up sample.testing.FunctionalLayer Traceback (most recent call last):
  File "/home/sancho/grok/eggs/tmpH0BX7D/zope.testing-3.5.1-py2.4.egg/zope/testing/testrunner.py", line 1252, in run_layer
  File "/home/sancho/grok/eggs/tmpH0BX7D/zope.testing-3.5.1-py2.4.egg/zope/testing/testrunner.py", line 1377, in setup_layer
  File "/home/sancho/grok/eggs/tmpFAB7tb/zope.app.testing-3.4.0a1-py2.4.egg/zope/app/testing/functional.py", line 196, in setUp
  File "/home/sancho/grok/eggs/tmpFAB7tb/zope.app.testing-3.4.0a1-py2.4.egg/zope/app/testing/functional.py", line 129, in __init__
  File "/home/sancho/grok/eggs/tmphT5Sxo/zope.app.debug-3.4.0a1-py2.4.egg/zope/app/debug/debug.py", line 36, in __init__
  File "/home/sancho/grok/eggs/zope.app.appsetup-3.4.1-py2.4.egg/zope/app/appsetup/appsetup.py", line 111, in config
    context = xmlconfig.file(file, context=context, execute=execute)
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/xmlconfig.py", line 610, in file
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/xmlconfig.py", line 546, in include
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/xmlconfig.py", line 378, in processxmlfile
  File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 364, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/xmlconfig.py", line 357, in endElementNS
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/config.py", line 542, in end
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/config.py", line 689, in finish
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/config.py", line 1381, in toargs
  File "/home/sancho/grok/eggs/tmplKkn8j/zope.configuration-3.4.0-py2.4.egg/zope/configuration/fields.py", line 141, in fromUnicode
ZopeXMLConfigurationError: File "/home/sancho/grok/Sample/src/sample/ftesting.zcml", line 11.2-13.8
    ConfigurationError: ('Invalid value for', 'component', "ImportError: Couldn't import zope.app.securitypolicy.zopepolicy, No module named securitypolicy.zopepolicy")

Tests with errors:
   runTest (zope.testing.testrunner.SetUpLayerFailure)
Total: 2 tests, 0 failures, 1 errors in 2.404 seconds.

modifying ftesting.zcml

from:

  <securityPolicy
      component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy"
      />

to:

  <securityPolicy
      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
      />

it works fine.

Uli Fouquet (uli-gnufix) on 2008-04-28
Changed in grok:
assignee: nobody → uli-gnufix
importance: Undecided → Medium
status: New → Confirmed
Uli Fouquet (uli-gnufix) wrote :

We could just use the correct package (zope.securitypolicy.zopepolicy.ZopeSecurityPolicy) in grokproject instead of the one used by Grok <= 0.11.1 (zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy).

Are there any objections? Otherwise I would check this patch into the grokproject trunk shortly.

Quoting Uli Fouquet <email address hidden>:
> We could just use the correct package
> (zope.securitypolicy.zopepolicy.ZopeSecurityPolicy) in grokproject
> instead of the one used by Grok <= 0.11.1
> (zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy).
>
> Are there any objections? Otherwise I would check this patch into the
> grokproject trunk shortly.

Not so fast... Why is this error occurring in the first place?
Shouldn't zope.app.securitypolicy have backward-compatibility imports?
Judging from the original error,

   ImportError: Couldn't import zope.app.securitypolicy.zopepolicy,
   No module named securitypolicy.zopepolicy,

it seems that zope.app.securitypolicy isn't even available. The
reasons for this should first be investigated, I suspect something
else is at fault here. Either way, the bug CANNOT be in ftesting.zcml
since the old-style imports must still work due to BBB.

Uli Fouquet (uli-gnufix) wrote :

Philipp von Weiterhausen wrote:

> Shouldn't zope.app.securitypolicy have backward-compatibility imports?

Holy sh..., you're right. Apparently the backwards compatibility should work but does not. I was not aware of this and will investigate. Can you name a package where such a backwards compatibility works? Just for comparison and to learn.

Quoting Uli Fouquet <email address hidden>:
> Philipp von Weiterhausen wrote:
>
>> Shouldn't zope.app.securitypolicy have backward-compatibility imports?
>
> Holy sh..., you're right. Apparently the backwards compatibility should
> work but does not. I was not aware of this and will investigate. Can you
> name a package where such a backwards compatibility works? Just for
> comparison and to learn.

There are numerous packages in Zope that provide BBB imports. It's
usually just a matter of importing the object that was moved. I've
just verified that zope.app.securitypolicy actually *has* BBB imports
(it goes a bit further by using zope.deferredimport.deprecated). So,
as I've said in my earlier message (which you're not quoting), it
seems that zope.app.securitypolicy isn't actually pulled in. THIS is
what should be investigated. Quoting my previous message:

"""
Judging from the original error,

    ImportError: Couldn't import zope.app.securitypolicy.zopepolicy,
    No module named securitypolicy.zopepolicy,

it seems that zope.app.securitypolicy isn't even available. The
reasons for this should first be investigated, I suspect something
else is at fault here.
"""

Uli Fouquet (uli-gnufix) wrote :

Philipp von Weitershausen:
> Quoting Uli Fouquet <email address hidden>:
> > Philipp von Weiterhausen wrote:
> >
> >> Shouldn't zope.app.securitypolicy have backward-compatibility imports?
> >
> > Holy sh..., you're right. Apparently the backwards compatibility should
> > work but does not. I was not aware of this and will investigate. Can you
> > name a package where such a backwards compatibility works? Just for
> > comparison and to learn.
>
> There are numerous packages in Zope that provide BBB imports. It's
> usually just a matter of importing the object that was moved. I've
> just verified that zope.app.securitypolicy actually *has* BBB imports
> (it goes a bit further by using zope.deferredimport.deprecated). So,
> as I've said in my earlier message (which you're not quoting), it
> seems that zope.app.securitypolicy isn't actually pulled in. THIS is
> what should be investigated. Quoting my previous message:
>
> """
> Judging from the original error,
>
> ImportError: Couldn't import zope.app.securitypolicy.zopepolicy,
> No module named securitypolicy.zopepolicy,
>
> it seems that zope.app.securitypolicy isn't even available. The
> reasons for this should first be investigated, I suspect something
> else is at fault here.
> """

No need to shout, Philipp!

Why do you always look into zope.app.securitypolicy? This package is
simply not used by Grok 0.12 any more. The versions.cfg changed.
zope.app.securitypolicy was pulled in by grok releases before 0.12 only.
Dependent packages fetch it only, when their testrunners are installed.

On 28 Apr 2008, at 17:12 , Uli Fouquet wrote:
> No need to shout, Philipp!

Don't worry, I wasn't shouting :)

> Why do you always look into zope.app.securitypolicy? This package is
> simply not used by Grok 0.12 any more. The versions.cfg changed.
> zope.app.securitypolicy was pulled in by grok releases before 0.12
> only.
> Dependent packages fetch it only, when their testrunners are
> installed.

I see. So it appears setup.py / versions.cfg were updated but
ftesting.zcml wasn't. That explains the mysteriously missing
zope.app.securitypolicy. Your patch sounds fine then :) I was just
worried we were plastering over a problem that had its roots somewhere
completely else.

Uli Fouquet (uli-gnufix) on 2008-05-01
Changed in grok:
status: Confirmed → Fix Committed
Martijn Faassen (faassen) wrote :

We should add zope.app.securitypolicy back again in the next release (so old projects continue to work) *and* change grokproject to depend on zope.securitypolicy in the future.

Changed in grok:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers