Django

Code

Ticket #7741 (closed: fixed)

Opened 3 months ago

Last modified 3 months ago

move django.newforms to django.forms

Reported by: gwilson Assigned to: gwilson
Milestone: 1.0 alpha Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 1
Needs tests: 0 Patch needs improvement: 0

Description

Ticket for tracking the backwards-incompatible change before 1.0 of moving the django.newforms package to django.forms and making oldforms only importable from django.oldforms and not django.forms. Other changes include:

  • Updates of all newforms/oldforms imports.
  • Moving newforms documentation (newforms.txt) to forms.txt, and moving the oldforms documentation (currently at forms.txt) to oldforms.txt.
  • Updating references to newforms/oldforms in all documentation.

To follow/assist this work, see my bzr branch.

Attachments

Change History

07/18/08 18:43:17 changed by Simon Greenhill

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

07/18/08 20:22:26 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

(In [7971]) Fixed #7741: django.newforms is now django.forms. This is obviously a backwards-incompatible change. There's a warning upon import of django.newforms itself, but deeper imports will raise errors.

(follow-up: ↓ 4 ) 07/20/08 05:35:11 changed by Mads Sülau Jørgensen <django@mads.sulau.dk>

  • status changed from closed to reopened.
  • resolution deleted.

Something went wrong with the move I think, it is not possible to access submodules of the django.newforms module with specific imports, such as from django.newforms.widgets import TextInput. Altough from django.newforms import widgets works as expected.

Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.newforms.widgets import TextInput
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named widgets

The correct import of django.forms.widgets works as expected, and I'd suspect the error to be located in either django/trunk/django/newforms/__init__.py@8005 or django/trunk/django/forms/__init__.py@8005.

(in reply to: ↑ 3 ) 07/20/08 08:30:51 changed by Karen Tracey <kmtracey@gmail.com>

  • status changed from reopened to closed.
  • resolution set to fixed.

Replying to Mads Sülau Jørgensen <django@mads.sulau.dk>:

Something went wrong with the move I think, it is not possible to access submodules of the django.newforms module with specific imports, such as from django.newforms.widgets import TextInput. Altough from django.newforms import widgets works as expected.

Note the log message immediately above your re-opening states:

"There's a warning upon import of django.newforms itself, but deeper imports will raise errors."

I believe the way it was done was intentional. Just go ahead and migrate from importing newforms to importing forms in your code now, it's going to have to be done eventually.

07/20/08 08:45:01 changed by madssj

I think breaking existing code should be avoided where possible. The ImportError can be avoided by doing some __path__ appending, leaving older sites working but running with DeprecationWarnings which must be the overall goal before removal of the newforms module.

07/20/08 08:56:11 changed by russellm

madssj: The newforms docs have always said that the newforms name was temporary, and part of the form framework transition plan. The import format suggested in the docs (from django import newforms as forms) raises the appropriate deprecation warning. The backwards incompatibility docs describe the change that has occurred, and the way to transition your code.

It is unfortunate that other import forms break, but the effort involved in avoiding the breakage you describe simply isn't worth it for a temporary transition aid.

07/21/08 00:28:10 changed by CHasenpflug

  • status changed from closed to reopened.
  • needs_docs set to 1.
  • resolution deleted.

The documentation, docs/newforms.txt, has not been updated as part of [7971] or since then source:/django/trunk/docs/newforms.txt#8014. References are still made to newforms in the docs. Reopening this ticket as it initially referenced updating the documentation and I'm unable to find an open ticket for the documentation changes needed.

07/21/08 10:07:28 changed by jacob

  • status changed from reopened to closed.
  • resolution set to fixed.

I've opened #7864 to keep track of this separately.


Add/Change #7741 (move django.newforms to django.forms)




Change Properties
Action