[Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Diaz, Eduardo
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/simplehttp://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 

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Diaz, Eduardo 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/simplehttp://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):
 snip
   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

That appears to be an incompatibility between CPython and Jython.  In
CPython, the following works::

 $ ~/projects/Zope-CVS/bin/python2.5
 Python 2.5.4 (r254:67916, May 22 2009, 13:23:05)
 [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
 Type help, copyright, credits or license for more information.
  print __doc__
 None
  class Foo:
 ...  docstring 
 ... usage = '\n' + __doc__
 ...
  print Foo.usage

  docstring
 

I'm guessint that the class statement blows up under Jython.

 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):
snip
 /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!

This appears to be an difference in how partial imports are handled
under CPython and Jython.  Does Jython have an equivalent to the '-i'
option under CPython?  I.e., stopping in the interpreter after running a
script::

 $ python -i some_script.py
 ...
 

If so, you could run with it, and then 

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Diaz, Eduardo
You are right, that seems to be the problem with string concatenation, it
doesn't work under jython

On Mon, Jan 4, 2010 at 10:31 AM, Tres Seaver tsea...@palladion.com wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Diaz, Eduardo 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):
  snip
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

 That appears to be an incompatibility between CPython and Jython.  In
 CPython, the following works::

  $ ~/projects/Zope-CVS/bin/python2.5
  Python 2.5.4 (r254:67916, May 22 2009, 13:23:05)
  [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
  Type help, copyright, credits or license for more information.
   print __doc__
  None
   class Foo:
  ...  docstring 
  ... usage = '\n' + __doc__
  ...
   print Foo.usage

  docstring
  

 I'm guessint that the class statement blows up under Jython.

  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):
 snip
 
 /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 

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Chris McDonough
Diaz, Eduardo wrote:
 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
   

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Diaz, Eduardo
Yes, it does

:P

On Mon, Jan 4, 2010 at 10:42 AM, Chris McDonough chr...@plope.com wrote:

 Diaz, Eduardo wrote:

 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 

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Diaz, Eduardo
Ok, I'm going to give it a try in a while for now, this is the problem with
jinja2, it needs to compile something

easy_install -i http://dist.repoze.org/bfg/1.1/simple/ repoze.bfg.jinja2
Searching for repoze.bfg.jinja2
Best match: repoze.bfg.jinja2 0.5
Processing repoze.bfg.jinja2-0.5-py2.5.egg
repoze.bfg.jinja2 0.5 is already the active version in easy-install.pth

Using
/home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg.jinja2-0.5-py2.5.egg
Processing dependencies for repoze.bfg.jinja2
Searching for Jinja2
Reading http://dist.repoze.org/bfg/1.1/simple/Jinja2/
Best match: Jinja2 2.1.1
Downloading http://dist.repoze.org/bfg/1.1/Jinja2-2.1.1.tar.gz
Processing Jinja2-2.1.1.tar.gz
Running Jinja2-2.1.1/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-wxGcPq/Jinja2-2.1.1/egg-dist-tmp-eTzSIB
warning: no files found matching 'Makefile'
warning: no files found matching 'ez_setup.py'
warning: no previously-included files matching '*' found under directory
'docs/_build/doctrees'
error: Setup script exited with error: Compiling extensions is not supported
on Jython

The problem with chameleon is that jython doesn't have the parser module.

Going to keep checking with other templating engines.

On Mon, Jan 4, 2010 at 4:10 PM, Chris McDonough chr...@plope.com wrote:

 Diaz, Eduardo wrote:

 That helps with the zcml problem but now, there is a problem with
 chameleon, is there another template language I can use?

 This is the stack trace:

 paster serve MyProject.ini Starting server in PID 8071.
 serving on 0.0.0.0:6543 http://0.0.0.0:6543 view at
 http://127.0.0.1:6543

 
 Exception happened during processing of request from (u'127.0.0.1', 53678)
 Traceback (most recent call last):
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 1062, in process_request_in_thread
self.finish_request(request, client_address)
  File /home/iamedu/Tools/jython2.5.1/Lib/SocketServer.py, line 254, in
 finish_request
self.RequestHandlerClass(request, client_address, self)
  File /home/iamedu/Tools/jython2.5.1/Lib/SocketServer.py, line 522, in
 __init__
self.handle()
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 436, in handle
BaseHTTPRequestHandler.handle(self)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 436, in handle
BaseHTTPRequestHandler.handle(self)
  File /home/iamedu/Tools/jython2.5.1/Lib/BaseHTTPServer.py, line 316, in
 handle
self.handle_one_request()
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 431, in handle_one_request
self.wsgi_execute()
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 286, in wsgi_execute
result = self.server.wsgi_application(self.wsgi_environ,
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/router.py,
 line 127, in __call__
response = view_callable(context, request)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/router.py,
 line 127, in __call__
response = view_callable(context, request)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py,
 line 1656, in _bfg_requestonly_view
response = rendered_response(renderer,
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py,
 line 1533, in rendered_response
result = renderer(response, {'view':view,
 'renderer_name':renderer_name,
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/chameleon_zpt.py,
 line 43, in __call__
result = self.template(**system)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/decorator.py,
 line 13, in __get__
val = self.wrapped(inst)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/chameleon_zpt.py,
 line 33, in template
return PageTemplateFile(self.path, auto_reload=auto_reload)
  File
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/chameleon_zpt.py,
 line 11, in __init__
raise ImportError(why[0])
 ImportError: No module named parser
 

 The source code where this happens says:

 try:
from chameleon.zpt.template import PageTemplateFile
 except ImportError, why: # pragma: no cover
# Chameleon doesn't work on non-CPython platforms
class PageTemplateFile(object):
def __init__(self, *arg, **kw):
raise ImportError(why[0])

 So I'm guessing that something needs to be compile with C, I tried jinja2
 but I cannot even install it.


 It's not actually a compilation requirement problem; Chameleon 

Re: [Repoze-dev] Jython Support on 1.2

2010-01-04 Thread Chris McDonough
It looks like Jinja2 has an optional speedups module that Jython is choking 
on:

http://bitbucket.org/mitsuhiko/jinja2-main/src/tip/setup.py

You might try checking Jinja2 out from bitbucket, commenting out the features 
stanza in its setup.py and installing it into your virtualenv (if you're using 
one; otherwise just globally) by hand (jython setup.py install I guess) before 
trying to install repoze.bfg.jinja2.  I suspect it might work after that.

Yes, the parser module is related to the ast module (doesn't seem to be 
supported on non-CPython platforms).

- C


Diaz, Eduardo wrote:
 Ok, I'm going to give it a try in a while for now, this is the problem 
 with jinja2, it needs to compile something
 
 easy_install -i http://dist.repoze.org/bfg/1.1/simple/ repoze.bfg.jinja2
 Searching for repoze.bfg.jinja2
 Best match: repoze.bfg.jinja2 0.5
 Processing repoze.bfg.jinja2-0.5-py2.5.egg
 repoze.bfg.jinja2 0.5 is already the active version in easy-install.pth
 
 Using 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg.jinja2-0.5-py2.5.egg
 Processing dependencies for repoze.bfg.jinja2
 Searching for Jinja2
 Reading http://dist.repoze.org/bfg/1.1/simple/Jinja2/
 Best match: Jinja2 2.1.1
 Downloading http://dist.repoze.org/bfg/1.1/Jinja2-2.1.1.tar.gz
 Processing Jinja2-2.1.1.tar.gz
 Running Jinja2-2.1.1/setup.py -q bdist_egg --dist-dir 
 /tmp/easy_install-wxGcPq/Jinja2-2.1.1/egg-dist-tmp-eTzSIB
 warning: no files found matching 'Makefile'
 warning: no files found matching 'ez_setup.py'
 warning: no previously-included files matching '*' found under directory 
 'docs/_build/doctrees'
 error: Setup script exited with error: Compiling extensions is not 
 supported on Jython
 
 The problem with chameleon is that jython doesn't have the parser module.
 
 Going to keep checking with other templating engines.
 
 On Mon, Jan 4, 2010 at 4:10 PM, Chris McDonough chr...@plope.com 
 mailto:chr...@plope.com wrote:
 
 Diaz, Eduardo wrote:
 
 That helps with the zcml problem but now, there is a problem
 with chameleon, is there another template language I can use?
 
 This is the stack trace:
 
 paster serve MyProject.ini Starting server in PID 8071.
 serving on 0.0.0.0:6543 http://0.0.0.0:6543
 http://0.0.0.0:6543 view at http://127.0.0.1:6543
 
 
 Exception happened during processing of request from
 (u'127.0.0.1', 53678)
 Traceback (most recent call last):
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 1062, in process_request_in_thread
self.finish_request(request, client_address)
  File /home/iamedu/Tools/jython2.5.1/Lib/SocketServer.py, line
 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File /home/iamedu/Tools/jython2.5.1/Lib/SocketServer.py, line
 522, in __init__
self.handle()
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 436, in handle
BaseHTTPRequestHandler.handle(self)
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 436, in handle
BaseHTTPRequestHandler.handle(self)
  File /home/iamedu/Tools/jython2.5.1/Lib/BaseHTTPServer.py,
 line 316, in handle
self.handle_one_request()
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 431, in handle_one_request
self.wsgi_execute()
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/Paste-1.7.2-py2.5.egg/paste/httpserver.py,
 line 286, in wsgi_execute
result = self.server.wsgi_application(self.wsgi_environ,
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/router.py,
 line 127, in __call__
response = view_callable(context, request)
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/router.py,
 line 127, in __call__
response = view_callable(context, request)
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py,
 line 1656, in _bfg_requestonly_view
response = rendered_response(renderer,
  File
 
 /home/iamedu/Tests/jython/sys/Lib/site-packages/repoze.bfg-1.2a10-py2.5.egg/repoze/bfg/configuration.py,
 line 1533, in rendered_response
result = renderer(response, {'view':view,
 'renderer_name':renderer_name,
  File