SHARE
TWEET

Untitled

a guest Oct 18th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def publish_metadata(self, metadata_id, metadata_path):
  2.     """
  3.  
  4.    :param metadata_id:
  5.    :param metadata_path:
  6.    """
  7.     metadata_publish_path = self.config['metadata']['publish_path']
  8.     russia_wkb = self.config['metadata']['russia_wkb']
  9.     try:
  10.         xml_doc = utils.prepare_xml(metadata_path)
  11.         meta_files = utils.prepare_meta_paths(xml_doc, metadata_path)
  12.         restricted = utils.detect_restriction(xml_doc)
  13.         if not restricted:
  14.             # нет ограничений на публикацию
  15.             utils.publish_metadata(
  16.                 metadata_id,
  17.                 meta_files,
  18.                 metadata_path,
  19.                 metadata_publish_path,
  20.             )
  21.         else:
  22.             # проверяем пересечение с геометрией России
  23.             intersected = utils.check_intersection(russia_wkb, xml_doc)
  24.             if intersected:
  25.                 # есть пересечение с геометрий России, можно публиковать
  26.                 utils.publish_metadata(
  27.                     metadata_id,
  28.                     meta_files,
  29.                     metadata_path,
  30.                     metadata_publish_path,
  31.                 )
  32.             else:
  33.                 raise PublishMetadataError()
  34.  
  35. def _cleanup(self, path):
  36.     """
  37.    Summary
  38.  
  39.    """
  40.     shutil.rmtree(in_path, ignore_errors=True)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top