Django

Code

Ticket #5485 (closed: wontfix)

Opened 3 years ago

Last modified 2 years ago

Changing repetitive uploaded files from underscores to numbers

Reported by: emperorcezar Assigned to: nobody
Milestone: 1.0 beta Component: Database layer (models, ORM)
Version: SVN Keywords: fs-rf-docs
Cc: emperorcezar@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

Description

Currently The filefield adds an underscore if you upload to a file that already exists. This leads to files like file_.txt This is annoying. The patch sets the system to create files file.txt, file_2.txt ..... file_99.txt etc.

Attachments

base.py.diff (1.5 kB) - added by emperorcezar on 09/14/07 22:04:25.

Change History

09/14/07 22:04:25 changed by emperorcezar

  • attachment base.py.diff added.

09/16/07 02:08:10 changed by deepak <deep.thukral@gmail.com>

  • needs_better_patch changed.
  • component changed from Uncategorized to Database wrapper.
  • needs_tests set to 1.
  • needs_docs changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Design decision needed.

What is the problem with underscore? Its simple, fast and effective.

09/16/07 03:07:42 changed by ubernostrum

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

Every solution to this problem will annoy someone; if we switch it to numbers, someone who liked the underscores will complain. Since this is essentially arbitrary, and since Django's already picked a solution, I'm going to wontfix this.

09/17/07 12:35:08 changed by emperorcezar

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

The issue is two-fold. First, some systems have a character limit on filenames (255 on BSD if I remember). Second, it's difficult to manually and visually distinguish between underscored files. Put 30 avatar_.jpg files like avatar.jpg avatar_.jpg. Then when one has to delete the correct one by hand for some reason, a mistake becomes extremely easy vs deleting avatar_15.jpg Also, at what point will the database max out on the file length? It is my opinion that the repeated underscore may be simple and fast, but they are by far not effective when an application has to scale.

12/01/07 14:25:14 changed by jacob

  • stage changed from Design decision needed to Accepted.

12/11/07 12:08:25 changed by Gulopine

  • keywords set to fs-rf.

12/17/07 20:53:12 changed by Gulopine

  • keywords changed from fs-rf to fs-rf-docs.

06/16/08 13:30:04 changed by Gulopine

  • milestone set to 1.0 beta.

07/18/08 13:49:28 changed by daviddahl

  • owner changed from nobody to daviddahl.
  • status changed from reopened to new.

I will write some tests for this patch

07/18/08 14:03:18 changed by daviddahl

With Trunk SVN: Last Changed Rev: 7950

I cannot apply this patch to attempt writing tests:

patch: **** Only garbage was found in the patch input.

Very strange.

07/18/08 14:22:19 changed by Gulopine

With #5361, this behavior will be made quite easy, and its documentation will explain how to do it. In fact, there's already a test on that patch making sure that Trac-style file numbering (filename.3.txt, etc) works just fine. I've left this ticket open so we can keep of everything that #5361 is looking to address, but any fixes to this will be applied in that ticket instead.

The fs-rf-docs keyword here means that the docs on #5361 will explain how to do it, but it won't be enabled by default. There's certainly a case for changing it, and it would be backwards-compatible, since existing filenames are already stored in the database, but at the moment I'm not planning to change the default behavior.

07/18/08 17:34:36 changed by daviddahl

  • owner changed from daviddahl to nobody.

Ok, cool thanks for the info.

07/22/08 14:21:33 changed by anonymous

  • cc set to emperorcezar@gmail.com.

08/08/08 16:00:56 changed by jacob

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

File storage is in as of [8244], so I'm marking this as wontfix -- as Marty says, it's very easy to write a custom file storage backend that works exactly how you like it.


Add/Change #5485 (Changing repetitive uploaded files from underscores to numbers)




Change Properties
Action