commit
e973a538d9
|
|
@ -13,13 +13,12 @@ _logger = logging.getLogger(__name__)
|
|||
|
||||
_map_view_validator = None
|
||||
|
||||
|
||||
@view_validation.validate('map')
|
||||
def schema_map_view(arch, **kwargs):
|
||||
global _map_view_validator
|
||||
|
||||
if _map_view_validator is None:
|
||||
with misc.file_open(os.path.join('odex30_web_map', 'views', 'odex30_web_map.rng')) as f:
|
||||
with misc.file_open('odex30_web_map/views/odex30_web_map.rng') as f:
|
||||
_map_view_validator = etree.RelaxNG(etree.parse(f))
|
||||
|
||||
if _map_view_validator.validate(arch):
|
||||
|
|
@ -28,3 +27,18 @@ def schema_map_view(arch, **kwargs):
|
|||
for error in _map_view_validator.error_log:
|
||||
_logger.error(ustr(error))
|
||||
return False
|
||||
|
||||
# @view_validation.validate('map')
|
||||
# def schema_map_view(arch, **kwargs):
|
||||
# global _map_view_validator
|
||||
#
|
||||
# if _map_view_validator is None:
|
||||
# with misc.file_open(os.path.join('odex30_web_map', 'views', 'odex30_web_map.rng')) as f:
|
||||
# _map_view_validator = etree.RelaxNG(etree.parse(f))
|
||||
#
|
||||
# if _map_view_validator.validate(arch):
|
||||
# return True
|
||||
#
|
||||
# for error in _map_view_validator.error_log:
|
||||
# _logger.error(ustr(error))
|
||||
# return False
|
||||
|
|
|
|||
Loading…
Reference in New Issue