Exemplo n.º 1
0
 def _before_import(self, key: str, value: Any, obj: Any) -> Tuple[Any,
                                                                   Any]:
     # combine versions into specs
     value['platform_version_spec'] = to_spec(
         value['platform_min_version'], value['platform_max_version'])
     value['php_version_spec'] = to_spec(value['php_min_version'],
                                         value['php_max_version'])
     value['raw_platform_version_spec'] = to_raw_spec(
         value['raw_platform_min_version'],
         value['raw_platform_max_version'])
     value['raw_php_version_spec'] = to_raw_spec(
         value['raw_php_min_version'],
         value['raw_php_max_version'])
     obj.licenses.clear()
     obj.shell_commands.clear()
     obj.licenses.clear()
     obj.php_extensions.clear()
     obj.databases.clear()
     return value, obj
Exemplo n.º 2
0
 def _before_import(self, key: str, value: Any,
                    obj: Any) -> Tuple[Any, Any]:
     # combine versions into specs
     value['platform_version_spec'] = to_spec(value['platform_min_version'],
                                              value['platform_max_version'])
     value['php_version_spec'] = to_spec(value['php_min_version'],
                                         value['php_max_version'])
     value['raw_platform_version_spec'] = to_raw_spec(
         value['raw_platform_min_version'],
         value['raw_platform_max_version'])
     value['raw_php_version_spec'] = to_raw_spec(
         value['raw_php_min_version'], value['raw_php_max_version'])
     obj.licenses.clear()
     obj.shell_commands.clear()
     obj.licenses.clear()
     obj.php_extensions.clear()
     obj.databases.clear()
     obj.signature_digest = settings.CERTIFICATE_DIGEST
     return value, obj
Exemplo n.º 3
0
 def import_data(self, key: str, value: Any, obj: Any) -> None:
     for db in value:
         version_spec = to_spec(db['database']['min_version'],
                                db['database']['max_version'])
         raw_version_spec = to_raw_spec(db['database']['raw_min_version'],
                                        db['database']['raw_max_version'])
         # all dbs should be known already
         database = Database.objects.get(id=db['database']['id'])
         DatabaseDependency.objects.create(
             version_spec=version_spec,
             raw_version_spec=raw_version_spec,
             app_release=obj, database=database,
         )
Exemplo n.º 4
0
 def import_data(self, key: str, value: Any, obj: Any) -> None:
     for db in value:
         version_spec = to_spec(db['database']['min_version'],
                                db['database']['max_version'])
         raw_version_spec = to_raw_spec(db['database']['raw_min_version'],
                                        db['database']['raw_max_version'])
         # all dbs should be known already
         database = Database.objects.get(id=db['database']['id'])
         DatabaseDependency.objects.create(
             version_spec=version_spec,
             raw_version_spec=raw_version_spec,
             app_release=obj, database=database,
         )
Exemplo n.º 5
0
 def import_data(self, key: str, value: Any, obj: Any) -> None:
     for ext in value:
         version_spec = to_spec(ext['php_extension']['min_version'],
                                ext['php_extension']['max_version'])
         raw_version_spec = to_raw_spec(
             ext['php_extension']['raw_min_version'],
             ext['php_extension']['raw_max_version'])
         extension, created = PhpExtension.objects.get_or_create(
             id=ext['php_extension']['id'])
         PhpExtensionDependency.objects.create(
             version_spec=version_spec,
             raw_version_spec=raw_version_spec,
             app_release=obj, php_extension=extension,
         )
Exemplo n.º 6
0
 def import_data(self, key: str, value: Any, obj: Any) -> None:
     for ext in value:
         version_spec = to_spec(ext['php_extension']['min_version'],
                                ext['php_extension']['max_version'])
         raw_version_spec = to_raw_spec(
             ext['php_extension']['raw_min_version'],
             ext['php_extension']['raw_max_version'])
         extension, created = PhpExtension.objects.get_or_create(
             id=ext['php_extension']['id'])
         PhpExtensionDependency.objects.create(
             version_spec=version_spec,
             raw_version_spec=raw_version_spec,
             app_release=obj, php_extension=extension,
         )
Exemplo n.º 7
0
 def test_to_raw_spec(self):
     self.assertEqual('*', to_raw_spec('*', '*'))
     self.assertEqual('>=9,<=11', to_raw_spec('9', '11'))
     self.assertEqual('>=9', to_raw_spec('9', '*'))
     self.assertEqual('<=11', to_raw_spec('*', '11'))