Hello,

here is a status update of my work: TurboGears 2 on Jython

I have done pretty much work with Genshi, but it is still
far away from being finished. There is a problem, that Python only
supports SAX1, which lacks many parser components for advanced parsing.
Many parts like a lexical parser are available within
expat and SAX2. An additional disadvantage is that CPython
implements the SAX parser by using expat and is only a
layer. In advanced SAX parsing is at the moment partly broken within
Jython. So, I need a lot of time to implement many things, which
are available in expat.


But now to the good news:
I have made good success with Paver and the TG2 trunk installation.

Finally, I am able to install TG2 with some modifications completely
using Paver. The failing components need some more work,
but many of them will be fixed with the next Jython release
(decorators, advanced imports, several missing PEPs).
I will post some bug reports on the non working parts, later on.


My work on Paver (and patch for trunk) is so far finished - there is only an ugly hack
for installing parts of setuptools within the sub environment of paver,
which still needs a better solution.
Paver tends to create an additional sub environment with bin and lib data
for CPython, there was a lot of work to be done for Jython, to get
the same structure for the whole Jython layout.
The biggest disadvantage is that Jython is always executed by calling a
shell script, which has important data within (e.g. JYTHON_HOME), that
completely broke Paver and the new environment.
So far almost everything is fixed within Paver on Jython and should also
be able to work with shell scripts that start Jython and are included with
Jython packages (which are modified by paver bootstrap).
Some of the fixes also include file system operations, creating links,
changing modes of files, etc.

After talking with Kevin Dangoor, he is pretty happy to have Paver running
on Jython and will be kind to include soon the patches upstream.


A really great improvement of my work is the result to be able to create
a simple TG2 server layout with paster (there are a few ugly hacks to TG2 at
the moment):

ariane@rainbow:~/work/crash-test$ jython ../paster.py quickstart
Enter project name: tg2jython
Enter package name [tg2jython]:
Do you need Identity (usernames/passwords) in this project? [no]
Selected and implied templates:
  tg.devtools#turbogears2  TurboGears 2.0 Standard Quickstart Template

Variables:
  egg:         tg2jython
  elixir:      False
  identity:    False
  package:     tg2jython
  project:     tg2jython
  sqlalchemy:  True
  sqlobject:   False
  tgversion:   1.9.7a1dev-r4845
Creating template turbogears2
Creating directory ./tg2jython
  Recursing into +egg+.egg-info
    Creating ./tg2jython/tg2jython.egg-info/
    Copying paste_deploy_config.ini_tmpl_tmpl to ./tg2jython/tg2jython.egg-info/paste_deploy_config.ini_tmpl
...
...
...
writing tg2jython.egg-info/PKG-INFO
writing top-level names to tg2jython.egg-info/top_level.txt
writing entry points to tg2jython.egg-info/entry_points.txt
writing dependency_links to tg2jython.egg-info/dependency_links.txt
writing requirements to tg2jython.egg-info/requires.txt
reading manifest file 'tg2jython.egg-info/SOURCES.txt'
writing manifest file 'tg2jython.egg-info/SOURCES.txt'
ariane@rainbow:~/work/crash-test$


I am also able to run TurboGears 2 on Jython now, using "paster serve development.ini":

ariane@rainbow:~/work/crash-test/tg2jython$ jython ../../paster.py serve development.ini
/home/ariane/work/crash-test/tg2jython/tg2jython/model/__init__.py:9: SADeprecationWarning: The 'transactional' argument to sessionmaker() is deprecated; use autocommit=True|False instead.
  DBSession = scoped_session(sessionmaker(autoflush=True, transactional=True))
['__doc__', '__file__', '__name__', '__path__', 'config', 'lib', 'model']
Starting server.
11:00:35,980 INFO  [paste.httpserver.ThreadPool] Cannot use kill_thread_limit as ctypes/killthread is not available
serving on 0.0.0.0:8080 view at http://127.0.0.1:8080
Debug at: http://localhost:8080/_debug/view/1214835636


So far basic things are working: creating controllers, serving static data, displaying
content, etc.

At the moment templates are not working and also the access to the database back end
will need more work.

I already have a solid base with a running TG2 server, which will ease a lot my
work now.

I am working now mostly on including mako as rendering engine, because Genshi still will need more work. With mako, I will be able to show more results within the area of templates and also creating content, e.g. toscawidgets / twforms.


Ariane Paola Gomes

--
Ariane Paola Gomes

GPG key: F20E69CC
Fingerprint: 506B DFFE 34A4 AA0B 4157 61D8 6D1B D69E F20E 69CC