Skip to content

Commit

Permalink
prepare 0.4.31; When path of the uploaded file (plugins) doesn't yet …
Browse files Browse the repository at this point in the history
…exist, create it,
  • Loading branch information
barseghyanartur committed Mar 23, 2015
1 parent bb4968b commit 77c21c5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ are used for versioning (schema follows below):
0.3.4 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.4.31
0.4.32
-------------------------------------
yyyy-mm-ddd (not yet released).

- Checkbox select multiple field added
`fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple
<https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_elements/fields/checkbox_select_multiple>`_.

0.4.31
-------------------------------------
2015-03-23

- When path of the uploaded file (plugins) doesn't yet exist, create it,
instaid of failing.

0.4.30
-------------------------------------
2015-03-23
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
for locale_dir in locale_dirs:
locale_files += [os.path.join(locale_dir, f) for f in os.listdir(locale_dir)]

version = '0.4.30'
version = '0.4.31'

install_requires = [
'Pillow>=2.0.0',
Expand Down
4 changes: 2 additions & 2 deletions src/fobi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__title__ = 'django-fobi'
__version__ = '0.4.30'
__build__ = 0x000033
__version__ = '0.4.31'
__build__ = 0x000034
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from fobi.helpers import handle_uploaded_file
from fobi.contrib.plugins.form_elements.fields.file import UID
from fobi.contrib.plugins.form_elements.fields.file.forms import FileInputForm
from fobi.contrib.plugins.form_elements.fields.file.settings import FILES_UPLOAD_DIR
from fobi.contrib.plugins.form_elements.fields.file.settings import (
FILES_UPLOAD_DIR
)

class FileInputPlugin(FormFieldPlugin):
"""
Expand Down
4 changes: 4 additions & 0 deletions src/fobi/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ def handle_uploaded_file(upload_dir, image_file):
"""
upload_dir_absolute_path = os.path.join(settings.MEDIA_ROOT, upload_dir)

# Create path if doesn't exist yet
if not os.path.exists(upload_dir_absolute_path):
os.makedirs(upload_dir_absolute_path)

if isinstance(image_file, File):
destination_path = ensure_unique_filename(
os.path.join(upload_dir_absolute_path, image_file.name)
Expand Down

0 comments on commit 77c21c5

Please sign in to comment.