Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14426 closed (fixed)

Factor "mysite" out of all code example import statements

Reported by: gabrielhurley Owned by: gabrielhurley
Component: Documentation Version: 1.2
Severity: Keywords:
Cc: idahogray@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the spirit of #14255 it seems like it would be wise to remove the "mysite" (as in from mysite.foo.bar import baz) wherever it may appear, not just specifically from the tutorial.

There are still ~20 remaining instances of it within docs/intro/, docs/ref/contrib/, and docs/topics/.

There's also a very old reference in docs/releases/0.96.txt... but touching something that old seems almost sacrilegious ;-)

Attachments (3)

remove_mysite_from_import.diff (4.2 KB) - added by idahogray 5 years ago.
remove_mysite_from_import.2.2.diff (8.3 KB) - added by gabrielhurley 5 years ago.
remove_mysite_from_import.3.diff (10.5 KB) - added by idahogray 5 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by PaulM

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

Seems like a good idea to me.

Changed 5 years ago by idahogray

comment:2 Changed 5 years ago by idahogray

  • Has patch set

Attached a patch factoring out mysite in import statments from the docs/ directory. I ran

grep -R "from mysite" ./

and looked through all of the results. I only changed the ones that I thought made sense.

Changed 5 years ago by gabrielhurley

comment:3 Changed 5 years ago by gabrielhurley

  • Status changed from new to assigned

Thanks idahogray! I was gonna get to this myself eventually, but your patch was a great start. I added a new patch based on yours that changes a couple more instances that weren't specifically of the "from mysite" sort. If you'd take a look at it and give me a sanity-check then I'd say we can wrap this one up!

Changed 5 years ago by idahogray

comment:4 Changed 5 years ago by idahogray

  • Cc idahogray@… added

I found a few more, please double check to make sure I didn't remove invalid ones. I used this command to locate them:

grep -Rn --exclude="*\.svn-base" "mysite\." ./

I did not touch anything in howto/deployment, not sure if it also needs attention.

comment:5 Changed 5 years ago by gabrielhurley

I had looked at a number of the items changed in the latest patch, and consciously decided not to change them for the following reason:

On a practical level, you can't really have reusable projects, so it isn't as harmful to include "mysite" in front of project-level modules (e.g. mysite.views, or mysite.urls), and in these cases it would be much more confusing to new users of Django to just see a line like "from views import archive, about, contact" in the docs. There wouldn't be any clear indication of which "views" we're talking about.

So even though it's perfectly valid to drop the "mysite" from those cases if you know what you're doing, I'm going to intentionally leave them in for the sanity of newbies ;-)

comment:6 Changed 5 years ago by gabrielhurley

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

(In [14270]) Fixed #14426 -- Removed "mysite" import statements from examples that might teach people "bad habits" in regards to creating reusable apps.

comment:7 Changed 5 years ago by gabrielhurley

(In [14271]) [1.2.X] Fixed #14426 -- Removed "mysite" import statements from examples that might teach people "bad habits" in regards to creating reusable apps.

Thanks to idahogray for assisting with the patch (and sorry for forgetting the attribution in the patch on trunk).

Backport of [14270] from trunk.

comment:8 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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