Changeset 459 in main


Ignore:
Timestamp:
11/09/11 16:41:09 (8 years ago)
Author:
pcosquer
Message:

models: settings: adds a trailing slash to DOCUMENT_DIR
+ DocumentStorage?: checks existing files in the righ directory

Location:
trunk/openPLM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/models.py

    r440 r459  
    652652        md5_value = md5.hexdigest() + "-%s" + ext 
    653653        path = os.path.join(ext2, md5_value % rand()) 
    654         while os.path.exists(path): 
     654        while os.path.exists(os.path.join(self.location, path)): 
    655655            path = os.path.join(ext2, md5_value % rand()) 
    656656        return path 
     
    688688    """ 
    689689    filename = models.CharField(max_length=200) 
    690     file = models.FileField(upload_to="docs", storage=docfs) 
     690    file = models.FileField(upload_to=".", storage=docfs) 
    691691    size = models.PositiveIntegerField() 
    692692    thumbnail = models.ImageField(upload_to=".", storage=thumbnailfs, 
  • trunk/openPLM/settings.py

    r416 r459  
    120120###################### 
    121121 
    122 #: directory that stores documents 
    123 DOCUMENTS_DIR = "/var/openPLM/docs" 
     122#: directory that stores documents. Make sure to use a trailing slash. 
     123DOCUMENTS_DIR = "/var/openPLM/docs/" 
    124124THUMBNAILS_DIR = os.path.join(MEDIA_ROOT, "thumbnails/") 
    125 #: directory that stores thumbnails. Make sure to use a 
    126 # trailing slash. 
     125#: directory that stores thumbnails. Make sure to use a trailing slash. 
    127126THUMBNAILS_URL = MEDIA_URL + "thumbnails/" 
    128127 
  • trunk/openPLM/settings_tests.py

    r442 r459  
    114114 
    115115#: directory that stores documents 
    116 DOCUMENTS_DIR = "/tmp" 
     116DOCUMENTS_DIR = "/tmp/docs/" 
    117117THUMBNAILS_DIR = os.path.join(MEDIA_ROOT, "thumbnails") 
    118118#: directory that stores thumbnails 
Note: See TracChangeset for help on using the changeset viewer.