Skip to content

Commit

Permalink
fixed the remaining bug in logo uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyfadeev committed Nov 2, 2010
1 parent 2021e40 commit 2bbc90e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -10,6 +10,8 @@ settings.py
.idea
*.iml
env
django
django/*
nbproject
pip-log.txt
tmp/*
Expand All @@ -29,5 +31,6 @@ build
askbot/upfiles/*.jpg
askbot/upfiles/*.jpeg
askbot/upfiles/*.gif
askbot/upfiles/*.png
askbot/skins/common/media/mathjax/
/jinja2
2 changes: 1 addition & 1 deletion askbot/__init__.py
Expand Up @@ -22,7 +22,7 @@ def get_version():
"""returns version of the askbot app
this version is meaningful for pypi only
"""
return '0.6.20'
return '0.6.21'

#todo: maybe send_mail functions belong to models
#or the future API
Expand Down
4 changes: 2 additions & 2 deletions askbot/deps/livesettings/forms.py
Expand Up @@ -21,7 +21,7 @@ def __init__(self, *args, **kwargs):

for setting in flattened:
# Add the field to the customized field list
kw = {
kw = {#todo: maybe move into the make_field call
'label': setting.description,
'help_text': setting.help_text,
# Provide current setting values for initializing the form
Expand All @@ -30,7 +30,7 @@ def __init__(self, *args, **kwargs):
field = setting.make_field(**kw)

k = '%s__%s' % (setting.group.key, setting.key)

self.fields[k] = field
if not setting.group in groups:
groups.append(setting.group)
Expand Down
6 changes: 4 additions & 2 deletions askbot/deps/livesettings/values.py
Expand Up @@ -580,8 +580,10 @@ def __init__(self, *args, **kwargs):
kwargs['widget'] = ImageInput(url_resolver = url_resolver)
forms.FileField.__init__(self, *args, **kwargs)

def clean(self, file_data, file_name):
(base_name, ext) = os.path.splitext(file_name)
def clean(self, file_data, initial=None):
if not file_data and initial:
return initial
(base_name, ext) = os.path.splitext(file_data.name)
image_extensions = ('.jpg', '.gif', '.png')
if ext.lower() not in image_extensions:
error_message = _('Allowed image file types are %(types)s') \
Expand Down

0 comments on commit 2bbc90e

Please sign in to comment.