Hi guys,

just a quick update on the little bit of work i've been doing on this.

i've been merging leo's code with my own, and updating my own to the
latest django svn code.

I've been working on getting the django tutorial to work, and got up to:
---------------
# objects.all() displays all the polls in the database.
>>> Poll.objects.all()
[<Poll: Poll object>]
--------------
before writing this (i'm about to pack it in for the day), which threw me a 
nasty error:
  ..........
  File "/usr/local/share/jython/Lib/django/db/models/base.py", line 101, in 
__str__
  File "/usr/local/share/jython/Lib/django/utils/encoding.py", line 37, in 
force_unicode
  File "/usr/local/share/jython/Lib/django/db/models/base.py", line 101, in 
__str__
  File "/usr/local/share/jython/Lib/django/utils/encoding.py", line 37, in 
force_unicode
java.lang.StackOverflowError: java.lang.StackOverflowError

i'll look into it tomorrow (unless someone on the other side of the world 
figures it out for me :)

i've started using the jython trunk (2.3a0) so a few things have been
easier.

i fought a bit with the re.compile(u"([\u0080-\uffff])") bug, and ended
up just working around it with the following jython patch (i'm not sure
how else to go about it seeing that java doesn't differentiate between
signed and unsigned variables)

$ jython/jython/src/org/python/core$ svn diff PyArray.java 
Index: PyArray.java
===================================================================
--- PyArray.java        (revision 3484)
+++ PyArray.java        (working copy)
@@ -689,7 +689,7 @@
                                      1);
         PyObject obj = ap.getPyObject(0);
         if(obj instanceof PyString) {
-            String code = obj.toString();
+            String code = obj.toString().toLowerCase();
             if(code.length() != 1) {
                 throw Py.ValueError("typecode must be in [zcbhilfd]");
             }


i also applied the jython patch to fix the __module__ problems.

and that's about all for major stuff i think.
cheers
-Tristan

On Thu, 2007-09-13 at 13:07 +1000, Tristan King wrote:
> Hi All,
> 
> I've only just signed up to this group so i'm hoping my Re: subject
> links into the original chat about this.
> 
> Because i love the ease of development that django offers, i've been
> moving bits of django code to get an autoreloading jython service
> running.
> 
> After finding a few other blogs for other people trying to move django
> to jython, i decided to post my work here so we might be able to merge
> our efforts. (maybe we could get some svn space somewhere)
> 
> here is my trac page for my changes
> https://dev.archer.edu.au/projects/kepler/log/jython-django (changeset
> 124 is the most interesting)
> the changesets are a bit messed up since i have not updated all my files
> to reflect the current django-svn.
> 
> below i'll post a description of all the things i've done so far for all
> who're interested.
> 
> cheers
> --Tristan
> 
> ----------------
> 
> just a quick note: i'm very new to python. I've only been programming in
> it for a few weeks now. so feel free to throw constructive criticisms at
> my code :)
> 
> things i haven't done:
> 
> since i'm not interested in using the models package just yet, i haven't
> moved any of that code to jython. but Leo Soto seems to be doing a fine
> job at this. because of this i've had to work around some of the
> references to the models package (ie. when the server validates the
> models)
> 
> major things i've done include:
> 
> ****** getting the autorealod module to work.
> 
> this has been an interesting task. I started off by replacing the
> spawnve with java.lang.Runtime calls to spawn the new task. For which i
> has to spawn a few other threads to read the process's stdout and err. 
> 
> looking at the code as i type this i realise i can remove the loop
> starting at line 111, i think that's just remains of some debuging :).
> good how these things make you re look over old code :).
> 
> also the sys.executable call in jython doesn't work the same as it does
> in python, so i had to dodgy that up a bit (if anyone starts their
> jython with a name other than 'jython' it will break this :))
> 
> i've also had to work around a jython bug (i've still got to find out if
> it's a known bug) with the modules. hence the try: except: in lines
> 53:81. 
> 
> I've just spent the last hour trying to reproduce the jython bug, for
> anyone interested,
> https://dev.archer.edu.au/projects/kepler/wiki/Notes#myjythonbug . this
> is just a temporary spot till i find the respective jython ticketing
> system to throw it into :)
> 
> now where was i... So, After these changes, the reloader works as
> expected. The only issue is that it's not as quick as the python one,
> since jython has quite a hefty startup time. so there's a bit of waiting
> around sometimes for the server to start up. but it's still completely
> automatic, which is excellent!
> 
> ****** automatic java library pathing
> 
> because i didn't want to have to manually load any new jars i want to
> use in my jython app into the sys.path, i added a LIB_DIRECTORY setting
> to the settings module. this is used in the setup_environ function
> (core/management/__init__.py lines 148:153) which lists the directory
> and adds all the jars it finds to sys.path.
> 
> this probably needs a bit more work but no use cases have come up for me
> yet, so it'll stay like this till they do.
> 
> ****** readline in the jython console so manage.py shell works
> 
> this is more of a jython specific thing than django but i've just been
> messing with rlcompleter trying to tab completion in the jython console.
> i've got it working satisfactorily, but it still borks out every now and
> then.
> 
> what i'm currently messing with:
> 
> the simplejson modules. if a dictionary has javainstance objects in it,
> the simplejson encoder doesn't know what to do with it. i'm trying to
> work around this.
> 
> 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to