Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7741 closed (fixed)

move django.newforms to django.forms

Reported by: gwilson Owned by: gwilson
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 (0)

Change History (9)

comment:1 Changed 6 years ago by Simon Greenhill

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(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.

comment:3 follow-up: Changed 6 years ago by Mads Sülau Jørgensen <django@…>

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 [source:django/trunk/django/newforms/__init__.py@8005] or [source:django/trunk/django/forms/__init__.py@8005].

comment:4 in reply to: ↑ 3 Changed 6 years ago by Karen Tracey <kmtracey@…>

  • Resolution set to fixed
  • Status changed from reopened to closed

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.

comment:5 Changed 6 years ago 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.

comment:6 Changed 6 years ago 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.

comment:7 Changed 6 years ago by CHasenpflug

  • Needs documentation set
  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

comment:8 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:9 Changed 3 years ago by jacob

  • milestone 1.0 alpha deleted

Milestone 1.0 alpha deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.