Ok, I think I know why this is happening,

the exception raises in the _validate method of the Orderable class, this is
where it happends:

if self.max is not None and value > self.max:
    raise TooBig(value, self.max)

Here, max is a ValidatedProperty it has a __set___ method which gives it a
value, the problem with jython seems to be that it isn't getting the value
from the instance dictionary, so I came up a workaround,

I define the __get__ method in the ValidatedPropertyClass like this:


def __get__(self, inst, owner):
    name, check = self._info
    return inst.__dict__[name]

And now the tests run ok:

jython setup.py test -q

running test
running egg_info
writing MyProject.egg-info/PKG-INFO
writing entry points to MyProject.egg-info/entry_points.txt
writing requirements to MyProject.egg-info/requires.txt
writing top-level names to MyProject.egg-info/top_level.txt
writing dependency_links to MyProject.egg-info/dependency_links.txt
reading manifest file 'MyProject.egg-info/SOURCES.txt'
writing manifest file 'MyProject.egg-info/SOURCES.txt'
running build_ext
.
----------------------------------------------------------------------
Ran 1 test in 0.005s

OK

I know it is not elegant, and I'll submit a bug to the jython developers...
but for now, I want to go on and there's another problem with running the
project, and here it is:

paster serve MyProject.ini
Traceback (most recent call last):
  File "/home/iamedu/Tests/jython/sys/bin/paster", line 7, in <module>
    sys.exit(
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
line 84, in run
    invoke(command, command_name, options, args[1:])
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
line 123, in invoke
    exit_code = runner.run(args)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
line 123, in invoke
    exit_code = runner.run(args)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
line 218, in run
    result = self.command()
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/serve.py",
line 275, in command
    app = self.loadapp(app_spec, name=app_name,
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/serve.py",
line 311, in loadapp
    return loadapp(
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py",
line 204, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py",
line 225, in loadobj
    return context.create()
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py",
line 625, in create
    return self.object_type.invoke(self)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/loadwsgi.py",
line 110, in invoke
    return fix_call(context.object, context.global_conf,
**context.local_conf)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/util/fixtypeerror.py",
line 57, in fix_call
    val = callable(*args, **kw)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteDeploy-1.3.3-py2.5.egg/paste/deploy/util/fixtypeerror.py",
line 57, in fix_call
    val = callable(*args, **kw)
  File "/home/iamedu/Tests/jython/MyProject/myproject/run.py", line 11, in
app
    config.load_zcml(zcml_file)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py",
line 424, in load_zcml
    xmlconfig.file(filename, package, execute=True)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
line 647, in file
    include(context, name, package)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
line 546, in include
    processxmlfile(f, context)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
line 378, in processxmlfile
    parser.parse(src)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
line 378, in processxmlfile
    parser.parse(src)
  File "/home/iamedu/Tools/jython2.5.1/Lib/xml/sax/drivers2/drv_javasax.py",
line 141, in parse
    self._parser.parse(JyInputSourceWrapper(source))
  File "/home/iamedu/Tools/jython2.5.1/Lib/xml/sax/drivers2/drv_javasax.py",
line 178, in startElement
    self._cont_handler.startElementNS((uri or None, lname), qname,
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
line 230, in startElementNS
    self.context.begin(name, data, info)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py",
line 534, in begin
    self.stack.append(self.stack[-1].contained(__name, __data, __info))
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py",
line 835, in contained
    return RootStackItem.contained(self, name, data, info)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py",
line 703, in contained
    factory = self.context.factory(self.context, name)
  File
"/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py",
line 480, in factory
    raise ConfigurationError("Unknown directive", ns, n)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
"file:///home/iamedu/Tests/jython/MyProject/myproject/configure.zcml", line
10.8
    ConfigurationError: ('Unknown directive', u'
http://namespaces.repoze.org/bfg', u'view')


On Mon, Jan 4, 2010 at 9:03 AM, Diaz, Eduardo <eduardo.d...@ediaz.me> wrote:

> Hello! I'm trying to run repoze.bfg on jython 2.5.1 without luck for now,
> I'm willing to fix what's needed for it to run...
>
> So first let me describe what I've done.
>
> I've installed setuptools on jython and followed tha installing repoze
> tutorial, virtualenv and easy_install -i
> http://dist.repoze.org/bfg/1.2/simple<http://dist.repoze.org/bfg/1.1/simple> 
> repoze.bfg
> works fine, but I can't create the project with paster, this is the error
> message:
>
> paster create -t bfg_starter
> Traceback (most recent call last):
>   File "/home/iamedu/Tests/jython/sys/bin/paster", line 7, in <module>
>     sys.exit(
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
> line 84, in run
>     invoke(command, command_name, options, args[1:])
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
> line 123, in invoke
>     exit_code = runner.run(args)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
> line 123, in invoke
>     exit_code = runner.run(args)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/command.py",
> line 218, in run
>     result = self.command()
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/create_distro.py",
> line 73, in command
>     self.extend_templates(templates, tmpl_name)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/create_distro.py",
> line 262, in extend_templates
>     tmpl = entry.load()(entry.name)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/setuptools-0.6c11-py2.5.egg/pkg_resources.py",
> line 1954, in load
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/paster.py",
> line 46, in <module>
>     class BFGShellCommand(Command):
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/paster.py",
> line 68, in BFGShellCommand
>     usage = '\n' + __doc__
> TypeError: cannot concatenate 'str' and 'NoneType' objects
>
> I decided to continue my tests so I created the project with my python2.5
> and used that one. I deleted the MyProject.egg-info directory and ran:
>
> jython setup.py egg_info
>
> after that I ran:
>
> jython setup.py develop
>
> And to this point it works well, when I try to run the tests I get the
> following:
>
>  jython setup.py test -qrunning test
> running egg_info
> writing MyProject.egg-info/PKG-INFO
> writing entry points to MyProject.egg-info/entry_points.txt
> writing requirements to MyProject.egg-info/requires.txt
> writing top-level names to MyProject.egg-info/top_level.txt
> writing dependency_links to MyProject.egg-info/dependency_links.txt
> reading manifest file 'MyProject.egg-info/SOURCES.txt'
> writing manifest file 'MyProject.egg-info/SOURCES.txt'
> running build_ext
> Traceback (most recent call last):
>   File "setup.py", line 11, in <module>
>     setup(name='MyProject',
>   File "/home/iamedu/Tools/jython2.5.1/Lib/distutils/core.py", line 151, in
> setup
>     dist.run_commands()
>   File "/home/iamedu/Tools/jython2.5.1/Lib/distutils/core.py", line 151, in
> setup
>     dist.run_commands()
>   File "/home/iamedu/Tools/jython2.5.1/Lib/distutils/dist.py", line 974, in
> run_commands
>     self.run_command(cmd)
>   File "/home/iamedu/Tools/jython2.5.1/Lib/distutils/dist.py", line 994, in
> run_command
>     cmd_obj.run()
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/test.py",
> line 121, in run
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/test.py",
> line 101, in with_project_on_sys_path
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/test.py",
> line 128, in run_tests
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 767, in
> __init__
>     self.parseArgs(argv)
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 794, in
> parseArgs
>     self.createTests()
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 794, in
> parseArgs
>     self.createTests()
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 799, in
> createTests
>     self.test = self.testLoader.loadTestsFromNames(self.testNames,
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 565, in
> loadTestsFromNames
>     suites = [self.loadTestsFromName(name, module) for name in names]
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 544, in
> loadTestsFromName
>     return self.loadTestsFromModule(obj)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/setuptools-0.6c11-py2.5.egg/setuptools/command/test.py",
> line 34, in loadTestsFromModule
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 533, in
> loadTestsFromName
>     module = __import__('.'.join(parts_copy))
>   File "/home/iamedu/Tools/jython2.5.1/Lib/unittest.py", line 533, in
> loadTestsFromName
>     module = __import__('.'.join(parts_copy))
>   File "/home/iamedu/Tests/jython/MyProject/myproject/tests.py", line 3, in
> <module>
>     from repoze.bfg.configuration import Configurator
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py",
> line 9, in <module>
>     from zope.configuration import xmlconfig
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 28, in <module>
>     import zope.configuration.config as config
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.configuration-3.6.0-py2.5.egg/zope/configuration/config.py",
> line 24, in <module>
>     import zope.schema
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/__init__.py",
> line 18, in <module>
>     from zope.schema._field import Field, Container, Iterable, Orderable
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_field.py",
> line 31, in <module>
>     from zope.schema.interfaces import IField
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/interfaces.py",
> line 233, in <module>
>     class IMinMaxLen(ILen):
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/interfaces.py",
> line 236, in IMinMaxLen
>     min_length = Int(
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 382, in __init__
>     super(Int, self).__init__(*args, **kw)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 231, in __init__
>     self.min = min
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 42, in __set__
>     inst.validate(value)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 138, in validate
>     self._validate(value)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 138, in validate
>     self._validate(value)
>   File
> "/home/iamedu/Tests/jython/sys/Lib/site-packages/zope.schema-3.5.4-py2.5.egg/zope/schema/_bootstrapfields.py",
> line 246, in _validate
>     raise TooBig(value, self.max)
> zope.schema._bootstrapinterfaces.TooBig: (0,
> <zope.schema._bootstrapfields.ValidatedProperty object at 0x2>)
>
> And when running:
>
> paster serve MyProject.ini
>
> I get pretty much the same error message (it ends in the same)
>
> Any ideas of what might be happening?
>
> Thanks a lot for your time and help!
>
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to