Skip to content

Commit

Permalink
Merge pull request #40 from alphagov/DMSandboxEnvironment
Browse files Browse the repository at this point in the history
Use new DMSandboxEnvironment class
  • Loading branch information
benvand committed Apr 25, 2017
2 parents 1f1dd3c + 5a9a229 commit 0a3c31b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dmcontent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .errors import ContentTemplateError, QuestionNotFoundError
from .questions import ContentQuestion

__version__ = '4.1.0'
__version__ = '4.2.0'
5 changes: 3 additions & 2 deletions dmcontent/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import collections

from jinja2 import Markup, StrictUndefined, TemplateSyntaxError, UndefinedError
from jinja2.sandbox import SandboxedEnvironment
from markdown import markdown
from six import string_types

from dmutils.jinja2_environment import DMSandboxedEnvironment

from .errors import ContentTemplateError


Expand All @@ -23,7 +24,7 @@ def __init__(self, field_value, markdown=None):
raise ContentTemplateError(e.message)

def make_template(self, field_value):
env = SandboxedEnvironment(autoescape=True, undefined=StrictUndefined)
env = DMSandboxedEnvironment(autoescape=True, undefined=StrictUndefined)
template = markdown(field_value, []) if self.markdown else field_value

return env.from_string(template)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e .
git+https://github.com/alphagov/digitalmarketplace-utils.git@25.0.1#egg=digitalmarketplace-utils==25.0.1
git+https://github.com/alphagov/digitalmarketplace-utils.git@25.1.0#egg=digitalmarketplace-utils==25.1.0

0 comments on commit 0a3c31b

Please sign in to comment.