Skip to content

Commit

Permalink
Merge branch 'maint-2.0'
Browse files Browse the repository at this point in the history
* maint-2.0:
  assets: fix deepcopy of webassets.filter.options
  assets: PEP8 code style improvements

Signed-off-by: Jiri Kuncar <[email protected]>
  • Loading branch information
jirikuncar committed Mar 24, 2015
2 parents cc2d77c + 9477f49 commit 96bfc41
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions invenio/ext/assets/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@

import copy
import os
import six
from flask import current_app, _request_ctx_stack

from flask import _request_ctx_stack, current_app

from flask_assets import Environment, FlaskResolver

from jinja2 import nodes
from jinja2.ext import Extension

import six

from webassets.bundle import is_url

from . import registry
Expand Down Expand Up @@ -128,6 +133,16 @@ def get_bundle(suffix):
bundle.extra.update(rel="stylesheet")
bundles.append((bundle.weight, bundle))

from webassets.filter import option

def option__deepcopy__(value, memo):
"""Custom deepcopy implementation for ``option`` class."""
return option(copy.deepcopy(value[0]),
copy.deepcopy(value[1]),
copy.deepcopy(value[2]))

option.__deepcopy__ = option__deepcopy__

for _, bundle in sorted(bundles):
# A little bit of madness to read the "/" at the
# beginning of the assets in ran in debug mode as well as
Expand Down Expand Up @@ -232,7 +247,7 @@ def search_for_source(self, ctx, item):
else:
abspath = super(InvenioResolver, self) \
.search_env_directory(ctx, item)
except: # FIXME do not catch all!
except Exception: # FIXME do not catch all!
# If a file is missing in production (non-debug mode), we want
# to not break and will use /dev/null instead. The exception
# is caught and logged.
Expand Down

1 comment on commit 96bfc41

@jirikuncar
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1: M110 missing component name

Please sign in to comment.