Skip to content
This repository has been archived by the owner on Jan 9, 2018. It is now read-only.

Commit

Permalink
Fixing some linting bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez committed May 26, 2012
1 parent ec0827d commit afbf991
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions staticfiles/context_processors.py
@@ -1,12 +1,14 @@
import warnings
from django.conf import settings


def static(request):
"""
Adds static-related context variables to the context.
"""
return {'STATIC_URL': settings.STATIC_URL}


def static_url(request):
warnings.warn(
"The context processor 'staticfiles.context_processors.static_url' "
Expand Down
1 change: 1 addition & 0 deletions staticfiles/management/commands/findstatic.py
Expand Up @@ -6,6 +6,7 @@

from staticfiles import finders


class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
args = "[file ...]"
Expand Down
3 changes: 3 additions & 0 deletions staticfiles/templatetags/static.py
Expand Up @@ -3,6 +3,7 @@

register = template.Library()


class PrefixNode(template.Node):

def __repr__(self):
Expand Down Expand Up @@ -47,6 +48,7 @@ def render(self, context):
context[self.varname] = prefix
return ''


@register.tag
def get_static_prefix(parser, token):
"""
Expand All @@ -65,6 +67,7 @@ def get_static_prefix(parser, token):
"""
return PrefixNode.handle_token(parser, token, "STATIC_URL")


@register.tag
def get_media_prefix(parser, token):
"""
Expand Down
4 changes: 2 additions & 2 deletions staticfiles/tests/tests.py
Expand Up @@ -20,7 +20,7 @@
try:
from django.utils.functional import empty
except ImportError:
empty = None
empty = None # noqa

from staticfiles import finders, storage
from staticfiles.conf import settings
Expand All @@ -37,7 +37,7 @@ def rmtree_errorhandler(func, path, exc_info):
"""
exctype, value = exc_info[:2]
# lookin for a windows error
if exctype is not WindowsError or 'Access is denied' not in str(value):
if exctype is not WindowsError or 'Access is denied' not in str(value): # noqa
raise
# file type should currently be read only
if ((os.stat(path).st_mode & stat.S_IREAD) != stat.S_IREAD):
Expand Down
2 changes: 1 addition & 1 deletion staticfiles/tests/urls/default.py
@@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls.defaults import * # noqa

urlpatterns = patterns('',
url(r'^static/(?P<path>.*)$', 'staticfiles.views.serve'),
Expand Down
2 changes: 1 addition & 1 deletion staticfiles/tests/urls/helper.py
@@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls.defaults import * # noqa
from staticfiles.urls import staticfiles_urlpatterns

urlpatterns = staticfiles_urlpatterns()
5 changes: 4 additions & 1 deletion staticfiles/utils.py
Expand Up @@ -17,6 +17,7 @@ def get_files_for_app(app, ignore_patterns=None):
"instead.", DeprecationWarning)
return AppStaticStorage(app).get_files(ignore_patterns)


def get_app_prefix(app):
"""
Return the path name that should be prepended to files for this app.
Expand All @@ -28,6 +29,7 @@ def get_app_prefix(app):
"instead.", DeprecationWarning)
return AppStaticStorage(app).get_prefix()


def matches_patterns(path, patterns=None):
"""
Return True or False depending on whether the ``path`` should be
Expand All @@ -40,6 +42,7 @@ def matches_patterns(path, patterns=None):
return True
return False


def get_filtered_patterns(storage, ignore_patterns=None, location=''):
"""
Return a filtered list of patterns that match the storage location.
Expand All @@ -62,6 +65,7 @@ def get_filtered_patterns(storage, ignore_patterns=None, location=''):
ignore_filtered.append(tail)
return ignore_filtered


def get_files(storage, ignore_patterns=None, location=''):
"""
Recursively walk the storage directories yielding the paths
Expand All @@ -84,4 +88,3 @@ def get_files(storage, ignore_patterns=None, location=''):
dir = os.path.join(location, dir)
for fn in get_files(storage, ignore_patterns, dir):
yield fn

0 comments on commit afbf991

Please sign in to comment.