Skip to content

Replaced " with ' #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions filemanager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def handle_form(self, form, files):
and not re.match(r'[\w\d_ -]+', name).group(0) == name
)
if invalid_folder_name:
messages.append("Invalid folder name : " + name)
messages.append('Invalid folder name : ' + name)
return messages

invalid_file_name = (
Expand All @@ -118,12 +118,12 @@ def handle_form(self, form, files):
)
)
if invalid_file_name:
messages.append("Invalid file name : " + name)
messages.append('Invalid file name : ' + name)
return messages

invalid_path = not re.match(r'[\w\d_ -/]+', path).group(0) == path
if invalid_path:
messages.append("Invalid path : " + path)
messages.append('Invalid path : ' + path)
return messages
if action == 'upload':
for f in files.getlist('ufile'):
Expand All @@ -132,12 +132,12 @@ def handle_form(self, form, files):
or not re.match('[\w\d_ -/.]+', f.name).group(0) == f.name
)
if file_name_invalid:
messages.append("File name is not valid : " + f.name)
messages.append('File name is not valid : ' + f.name)
elif f.size > self.maxfilesize*1024:
messages.append(
"File size exceeded "
'File size exceeded '
+ str(self.maxfilesize)
+ " KB : "
+ ' KB : '
+ f.name
)
elif (
Expand All @@ -148,9 +148,9 @@ def handle_form(self, form, files):
)
):
messages.append(
"Total Space size exceeded "
'Total Space size exceeded '
+ str(self.maxspace)
+ " KB : "
+ ' KB : '
+ f.name
)
elif (
Expand All @@ -159,9 +159,9 @@ def handle_form(self, form, files):
and f.name.split('.')[-1] not in self.extensions
):
messages.append(
"File extension not allowed (."
'File extension not allowed (.'
+ f.name.split('.')[-1]
+ ") : "
+ ') : '
+ f.name
)
elif (
Expand All @@ -171,7 +171,7 @@ def handle_form(self, form, files):
not in self.extensions
):
messages.append(
"No file extension in uploaded file : "
'No file extension in uploaded file : '
+ f.name
)
else:
Expand Down Expand Up @@ -356,7 +356,7 @@ def media(self, path):
w = width*60/mx
h = height*60/mx
img = img.resize((w, h), Image.ANTIALIAS)
response = HttpResponse(content_type=mimetype or "image/" + ext)
response = HttpResponse(content_type=mimetype or 'image/' + ext)
response['Cache-Control'] = 'max-age=3600'
img.save(
response,
Expand All @@ -383,7 +383,7 @@ def media(self, path):
w = width*60/mx
h = height*60/mx
img = img.resize((w, h), Image.ANTIALIAS)
response = HttpResponse(content_type="image/png")
response = HttpResponse(content_type='image/png')
response['Cache-Control'] = 'max-age:3600'
img.save(response, 'png')
return response
Expand Down
6 changes: 3 additions & 3 deletions filemanager/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class Media:

def render(self, name, value, attrs=None):
rendered = super(CKEditorWidget, self).render(name, value, attrs)
div = "<div style='height:20px'></div>"
div = '<div style=\'height:20px\'></div>'
return rendered + mark_safe(
div
+ u"""<script type="text/javascript">
+ u'''<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
CKEDITOR.replace('%s',%s);
}, false);
</script>""" % (attrs['id'], self.config)
</script>''' % (attrs['id'], self.config)
)
10 changes: 5 additions & 5 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import os
import sys

sys.path.insert(0, "tests")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
sys.path.insert(0, 'tests')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')

if __name__ == "__main__":
if __name__ == '__main__':
from django.core.management import execute_from_command_line
args = sys.argv
args.insert(1, "test")
args.insert(2, "filemanager")
args.insert(1, 'test')
args.insert(2, 'filemanager')
execute_from_command_line(args)
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def get_install_requires():


setup(
name="django-filemanager",
version="0.0.1",
author="Information Management Group",
author_email="[email protected]",
description="A file manager for Django",
license="MIT",
packages=find_packages(exclude=["tests", ]),
name='django-filemanager',
version='0.0.1',
author='Information Management Group',
author_email='[email protected]',
description='A file manager for Django',
license='MIT',
packages=find_packages(exclude=['tests', ]),
install_requires=get_install_requires(),
zip_safe=False,
include_package_data=True,
Expand Down