Differences between revisions 15 and 17 (spanning 2 versions)
Revision 15 as of 2007-09-10 03:46:18
Size: 3043
Editor: pc-112-141-104-200
Comment: Added my latests findings
Revision 17 as of 2007-09-10 18:33:34
Size: 2966
Editor: n01-114
Comment: Some clarification about __builtins__. Reordered minor annoyances too.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''Gaps between Jython and Django''' == Gaps between Jython and Django ==
Line 3: Line 3:
 * Jython does not have {{{__builtins__}}} as a module. Django adds "_" as a convenience method for calling gettext in {{{django/conf/__init__.py}}}. Jython needs an explicit import of {{{__builtin__}}} to achieve the same effect - django has been patched recently for this.
    * According to the Python docs, {{{__builtins__}}} is a implementation detail and shouldn't be used by portable applications. -- LeonardoSoto
 * 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]
=== Mayor 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}}}.
 * Unicode string interpolation doesn't work in the general case.
   * There is also 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.
 * 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]
 * {{{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.
 * inspect.isclass(time) shouldn't return True [http://sourceforge.net/tracker/index.php?func=detail&aid=1786009&group_id=12867&atid=112867 bug]

=== Minor annoyances ===

 * slice should be a type, not a function.
 * {{{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
Line 10: Line 24:
 * 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}}}.
 * 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]
 * 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


=== 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]
Line 14: Line 33:
 * func's and classes need {{{__module__}}}
 * 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]
 * inspect.isclass(time) shouldn't return True [http://sourceforge.net/tracker/index.php?func=detail&aid=1786009&group_id=12867&atid=112867 bug]
 * {{{PyBoolean.__tojava__}}} returns an {{{Integer}}}
   * It affects zxJDBC unless a DataHandler set the right type of boolean parameters. Fortunately, JDBC30DataHandler does right thing, at least on my limited tests -- LeonardoSoto
 * {{{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.
 * Unicode string interpolation doesn't work in the general case.
   * There is also 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.
 * slice should be a type, not a function.

Gaps between Jython and Django

Mayor problems

Minor annoyances

  • slice should be a type, not a function.
  • 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 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.
  • 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

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.

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