Differences between revisions 1 and 35 (spanning 34 versions)
Revision 1 as of 2007-08-04 15:42:52
Size: 38
Comment:
Revision 35 as of 2007-09-23 19:08:14
Size: 5105
Editor: pc-112-141-104-200
Comment: universal newlines and unicode interpolation are fixed now
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''Gaps between Jython and Django''' == Gaps between Jython and Django ==

=== Major problems ===

 * Jython does not support non-str keys in {{{__dict__}}} right now. If Groves' {{{HashMap}}} replacement works out maybe this issue will disappear. Problem encountered in {{{django/utils/_threading_local.py}}}.
 * There is a problem with the algorithm deciding whether to call {{{__str__}}} or {{{__unicode__}}}. More research is needed, but it affects the lazy string evaluation on which the Django i18n system relies ({{{django/utils/functional.py}}}), among other things.
   * I found that {{{object.__unicode__}}} doesn't exist in CPython, and if it's removed from jython this works as expected. [https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1800378&group_id=12867 bug] [https://sourceforge.net/tracker/?func=detail&atid=312867&aid=1800381&group_id=12867 patch] -- TristanKing
 * Something goes wrong with {{{re.compile(u"([\u0080-\uffff])")}}} in {{{django/utils/text.py}}} I think it is a lacking in our array implementation but this needs more investigation.
   * See [http://sourceforge.net/tracker/index.php?func=detail&aid=1544953&group_id=12867&atid=112867 bug 1544953]
 * metaclasses need to know the {{{__module__}}} of its classes [http://sourceforge.net/tracker/index.php?func=detail&aid=1781500&group_id=12867&atid=112867 bug] [http://sourceforge.net/tracker/index.php?func=detail&aid=1789137&group_id=12867&atid=312867 patch]
 * {{{django/views/debug.py}}} wants to know a function's {{{__module__}}}. functions don't have a {{{__module__}}} attribute in jython yet. [http://sourceforge.net/tracker/index.php?func=detail&aid=1800472&group_id=12867&atid=312867 patch]
 * {{{inspect.getargs()}}} doesn't work.
   * That's because {{{co_code}}} isn't supported by {{{PyTableCode}}}.
     * '''But''', {{{co_code}}} is used by {{{getargs()}}} only to discover anonymous tuple arguments. Commenting such section seems to be enough to get the other cases working.
     * workaround [https://dev.archer.edu.au/projects/kepler/svn/jython-django/trunk/jython-patches/co_code-workaround.patch patch]. just sets {{{co_code = ""}}}. i haven't come across any problems for this inside django yet, but i'm sure it'll break other python code -- TristanKing
 * {{{time}}} module lacks {{{strptime()}}}.
   * workaround [https://dev.archer.edu.au/projects/kepler/svn/jython-django/trunk/jython-patches/time-strptime.patch patch]. this is incomplete, untested, and not optimal but works for the django tutorial -- TristanKing
 * inspect.isclass(time) shouldn't return True [http://sourceforge.net/tracker/index.php?func=detail&aid=1786009&group_id=12867&atid=112867 bug]
   * Django [http://code.djangoproject.com/changeset/6194 works around this] until it's fixed.

=== Minor annoyances ===

 * slice should be a type, not a function. [http://sourceforge.net/tracker/index.php?func=detail&aid=1791931&group_id=12867&atid=112867 bug] [http://sourceforge.net/tracker/index.php?func=detail&aid=1798544&group_id=12867&atid=312867 patch]
 * {{{PyBoolean.__tojava__}}} returns an {{{Integer}}}
   * It affects zxJDBC unless a DataHandler sets the right type of boolean parameters. Fortunately, JDBC30DataHandler does this thing, at least on my limited tests -- LeonardoSoto
 * Jython does not have {{{__builtins__}}} as a module. Django adds "_" as a convenience method for calling gettext in {{{django/conf/__init__.py}}}.
    * According to the Python docs, {{{__builtins__}}} is a implementation detail and shouldn't be used by portable applications, so it's a Django problem. (See note about {{{__builtins__}}} here: http://docs.python.org/ref/naming.html)
 * Jython methods are not descriptors. It seems a implementation detail. [https://hg.leosoto.com/django.jythonport/diff/50371f2df15a/django/dispatch/saferef.py Here] is the relevant code and a potential fix from the Django side.

=== Already Fixed ===

 * Jython does not have {{{sys.stdout.isatty}}}. Jython should get added to the exclusions around that call in {{{django/core/management.py}}} (win32 and 'Pocket PC' are already excluded).
   * Fixed in [http://code.djangoproject.com/changeset/6032 Django changeset 6032]
 * stringmap (or the {{{__dict__}}} implementation) needs a {{{pop(o)}}} method.
 * Jython lists and tuples don't have {{{__iter__}}} .
   * Fixed in [http://code.djangoproject.com/changeset/6211 Django changeset 6211]
 * Jython does not have {{{os.getpid()}}}.
   * Django workarounds it now.
 * Jython does not have {{{os.W_OK}}} needed in {{{django/core/management.py}}}. This probably will not be hard to add this since {{{java.io.File}}} has a {{{canWrite()}}}.
   * {{{os.chmod}}} should be implemented too (After checking for write permissions, Django will try to change them if necessary).
     * That's hard. Maybe Django shouldn't check for permissions if running on Jython.
   * Django don't check or change file permissions when running on Jython now
 * The {{{U}}} (Universal newlines) flag for {{{open()}}} isn't recognized on Jython
 * Unicode string interpolation doesn't work

Gaps between Jython and Django

Major problems

Minor annoyances

Already Fixed

  • Jython does not have sys.stdout.isatty. Jython should get added to the exclusions around that call in django/core/management.py (win32 and 'Pocket PC' are already excluded).

  • stringmap (or the __dict__ implementation) needs a pop(o) method.

  • Jython lists and tuples don't have __iter__ .

  • Jython does not have os.getpid().

    • Django workarounds it now.
  • Jython does not have os.W_OK needed in django/core/management.py. This probably will not be hard to add this since java.io.File has a canWrite().

    • os.chmod should be implemented too (After checking for write permissions, Django will try to change them if necessary).

      • That's hard. Maybe Django shouldn't check for permissions if running on Jython.
    • Django don't check or change file permissions when running on Jython now
  • The U (Universal newlines) flag for open() isn't recognized on Jython

  • Unicode string interpolation doesn't work

DjangoOnJython (last edited 2014-05-22 23:24:19 by AdamBurke)