Python markupsafe.escape_silent() Examples
The following are 18
code examples of markupsafe.escape_silent().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
markupsafe
, or try the search function
.
Example #1
Source File: tests.py From Financial-Portfolio-Flask with MIT License | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #2
Source File: tests.py From Flask with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #3
Source File: tests.py From Flask with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #4
Source File: tests.py From data with GNU General Public License v3.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #5
Source File: tests.py From data with GNU General Public License v3.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #6
Source File: tests.py From data with GNU General Public License v3.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #7
Source File: tests.py From data with GNU General Public License v3.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #8
Source File: utils.py From grest with GNU General Public License v3.0 | 5 votes |
def get_header(name): if (name in request.headers): return request.headers.get(escape(name)) else: return None
Example #9
Source File: tests.py From syntheticmass with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #10
Source File: tests.py From luci-py with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #11
Source File: tests.py From luci-py with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #12
Source File: tests.py From luci-py with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #13
Source File: tests.py From luci-py with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #14
Source File: tests.py From luci-py with Apache License 2.0 | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #15
Source File: tests.py From Flask-P2P with MIT License | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #16
Source File: tests.py From jbox with MIT License | 5 votes |
def test_escape_silent(self): assert escape_silent(None) == Markup() assert escape(None) == Markup(None) assert escape_silent('<foo>') == Markup(u'<foo>')
Example #17
Source File: index.py From grest with GNU General Public License v3.0 | 4 votes |
def index(self, request): try: # patch __log self.__log = self._GRest__log __validation_rules__ = { "skip": fields.Int(required=False, validate=lambda skip: skip >= 0, missing=0), "limit": fields.Int(required=False, validate=lambda lim: lim >= 1 and lim <= 100, missing=QUERY_LIMIT), "order_by": fields.Str(required=False, missing="?") } (primary, secondary) = validate_models(self) query_data = validate_input(__validation_rules__, request) skip = query_data.get("skip") limit = query_data.get("skip") + query_data.get("limit") order_by = escape(query_data.get("order_by")) if order_by: if order_by.startswith("-"): # select property for descending ordering order_by_prop = order_by[1:] else: # select property for ascending ordering order_by_prop = order_by primary_model_props = primary.model.defined_properties().keys() if all([order_by_prop not in primary_model_props, order_by_prop != "?"]): raise HTTPException(msg.INVALID_ORDER_PROPERTY, 404) total_items = len(primary.model.nodes) if total_items <= 0: raise HTTPException(msg.NO_ITEM_EXISTS.format( model=primary.model_name), 404) if skip > total_items: raise HTTPException(msg.VALIDATION_FAILED, 422) items = primary.model.nodes.order_by(order_by)[skip:limit] if items: return serialize({pluralize(primary.model_name): [item.to_dict() for item in items]}) else: raise HTTPException(msg.NO_ITEM_EXISTS.format( model=primary.model_name), 404) except DoesNotExist as e: self.__log.exception(e) raise HTTPException(msg.ITEM_DOES_NOT_EXIST, 404)
Example #18
Source File: validation.py From grest with GNU General Public License v3.0 | 4 votes |
def validate_models(self, primary_id=None, secondary_model_name=None, secondary_id=None): class Primary: id = None model = None model_name = None selection_field = None class Secondary: id = None model = None model_name = None selection_field = None if primary_id: Primary.id = escape(unquote(primary_id)) Primary.model = self.__model__.get("primary") Primary.model_name = Primary.model.__name__.lower() Primary.selection_field = self.__selection_field__.get("primary") if secondary_model_name: Secondary.model_name = escape(unquote(secondary_model_name)) if secondary_id: Secondary.id = escape(unquote(secondary_id)) Secondary.model = Secondary.selection_field = None if "secondary" in self.__model__: Secondary.model = self.__model__.get( "secondary").get(Secondary.model_name) if "secondary" in self.__selection_field__: Secondary.selection_fields = self.__selection_field__.get( "secondary") Secondary.selection_field = Secondary.selection_fields.get( Secondary.model_name) if all([Secondary.model_name is not None, Secondary.model is None]): raise HTTPException(msg.RELATION_DOES_NOT_EXIST, 404) return (Primary, Secondary)