0001-misc-create-hashed-subdir-for-attachments-24211.patch
tests/test_workflows.py | ||
---|---|---|
784 | 784 |
fp=StringIO.StringIO('hello world'), varname='testfile')] |
785 | 785 |
formdata.store() |
786 | 786 |
assert len(os.listdir(os.path.join(get_publisher().app_dir, 'attachments'))) == 1 |
787 |
for subdir in os.listdir(os.path.join(get_publisher().app_dir, 'attachments')): |
|
788 |
assert len(subdir) == 4 |
|
789 |
assert len(os.listdir(os.path.join(get_publisher().app_dir, 'attachments', subdir))) == 1 |
|
787 | 790 | |
788 | 791 |
item.comment = '{{ attachments.testfile.url }}' |
789 | 792 | |
... | ... | |
797 | 800 |
url2 = formdata.evolution[-1].parts[-1].content |
798 | 801 | |
799 | 802 |
assert len(os.listdir(os.path.join(get_publisher().app_dir, 'attachments'))) == 1 |
803 |
for subdir in os.listdir(os.path.join(get_publisher().app_dir, 'attachments')): |
|
804 |
assert len(subdir) == 4 |
|
805 |
assert len(os.listdir(os.path.join(get_publisher().app_dir, 'attachments', subdir))) == 1 |
|
800 | 806 |
assert url1 == url2 |
801 | 807 | |
802 | 808 |
pub.substitutions.feed(formdata) |
wcs/workflows.py | ||
---|---|---|
200 | 200 | |
201 | 201 |
if not 'filename' in odict: |
202 | 202 |
filename = file_digest(self.fp) |
203 |
dirname = os.path.join(dirname, filename[:4]) |
|
204 |
if not os.path.exists(dirname): |
|
205 |
os.mkdir(dirname) |
|
203 | 206 |
odict['filename'] = os.path.join(dirname, filename) |
204 | 207 |
self.filename = odict['filename'] |
205 | 208 |
self.fp.seek(0) |
206 |
- |