Opened 8 years ago

Closed 8 years ago

#27588 closed Cleanup/optimization (fixed)

Avoid affixing colon to migration name in makemigrations output

Reported by: Charlie DeTar Owned by: nobody
Component: Core (Management commands) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This ticket concerns a minor annoyance. When generating migrations using ./manage.py makemigrations --empty, it is necessary to edit generated file to create the migration, so users must pay attention to the filename generated by the management command. makemigrations reports the filename like this:

Migrations for 'app':
  app/migrations/0056_auto_20161210_1755.py:

In most X11 terminals, double-clicking on the filename will select the text between spaces and copy it into the mouse paste buffer. However, since there's a colon affixed to the end of the generated filename, it gets selected as well, meaning that it's necessary for users to either edit the pasted contents prior to use, or carefully select all of the characters except the colon.

May I suggest simply adding a space between the filename and the colon, so that double-clicking the name won't select the colon. Or alternatively, eliminating the colon. Allowing the filename to stand free will prevent the affixed colon from getting in the way.

A one-character patch to add a space:

--- makemigrations-orig.py	2016-12-10 10:56:18.224099088 -0700
+++ makemigrations.py	2016-12-10 10:50:45.518233440 -0700
@@ -210,7 +210,7 @@
                     migration_string = os.path.relpath(writer.path)
                     if migration_string.startswith('..'):
                         migration_string = writer.path
-                    self.stdout.write("  %s:\n" % (self.style.MIGRATE_LABEL(migration_string),))
+                    self.stdout.write("  %s :\n" % (self.style.MIGRATE_LABEL(migration_string),))
                     for operation in migration.operations:
                         self.stdout.write("    - %s\n" % operation.describe())
                 if not self.dry_run:

This would eliminate an annoyance for X11 mouse users, and have no negative impact on users of other systems. Since it's possible that someone's parsing the output of makemigrations and expecting affixed colons, it could be considered a breaking change.

Change History (2)

comment:1 by Tim Graham, 8 years ago

Summary: Avoid affixing colon to generated migration nameAvoid affixing colon to migration name in makemigrations output
Triage Stage: UnreviewedReady for checkin
Type: UncategorizedCleanup/optimization

I think the colon could be omitted without any harm.

comment:2 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 7a4e2fc:

Fixed #27588 -- Removed unneeded colon in makemigrations output.

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