Opened 10 years ago

Closed 10 years ago

#4517 closed (fixed)

[patch] Incorrect URL_VALIDATOR_USER_AGENT due to DRY violation

Reported by: James Wheare <django@…> Owned by: Adrian Holovaty
Component: Metasystem Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

Patch for django.conf.global_settings.py that keeps the URL_VALIDATOR_USER_AGENT setting string in line with the Django version number.

Attachments (2)

global_settings.diff (576 bytes) - added by James Wheare <django@…> 10 years ago.
version.diff (2.9 KB) - added by James Wheare <django@…> 10 years ago.
Moves get_version to django/init.py

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by James Wheare <django@…>

Attachment: global_settings.diff added

comment:1 Changed 10 years ago by Malcolm Tredinnick

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Having the settings file import anything even slightly complex (like management.py) is probably a bit risky, since if any other module is imported indirectly that uses settings, they can't be changed any longer.

So the idea is correct, but we should do the version compositing some other way. Pushing get_version into django/__init__.py might be better.

Changed 10 years ago by James Wheare <django@…>

Attachment: version.diff added

Moves get_version to django/init.py

comment:2 Changed 10 years ago by James Wheare <django@…>

Trac seems to munge the diff a bit (take a look at the original format), and I'm not sure if it's better to import django then call django.get_version() or import the method directly, but here's a stab.

comment:3 Changed 10 years ago by Malcolm Tredinnick

Triage Stage: AcceptedReady for checkin

Looks good, James. Thanks. I'll commit this in the morning (when I'm more awake and can read it again).

comment:4 Changed 10 years ago by Malcolm Tredinnick

Hmmm... note to self: we should import get_version into the namespace of management.py so that any existing code doing from management import get_version will continue to work. I'll fix that when I commit.

comment:5 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [5451]) Fixed #4517 -- Made sure that URL_VALIDATOR_USER_AGENT includes the up-to-date
Django version number. Thanks, James Wheare.

Note: See TracTickets for help on using tickets.
Back to Top