diff --git a/src/rezplugins/package_repository/mongo.py b/src/rezplugins/package_repository/mongo.py index d2f3bddc8..3f10386fe 100644 --- a/src/rezplugins/package_repository/mongo.py +++ b/src/rezplugins/package_repository/mongo.py @@ -4,7 +4,6 @@ import os import time -from tempfile import NamedTemporaryFile from urllib.parse import quote_plus import datetime from tempfile import gettempdir @@ -17,8 +16,6 @@ from rez.package_repository import PackageRepository from rez.package_resources import PackageFamilyResource, VariantResourceHelper,\ PackageResourceHelper, package_pod_schema, VariantResource -from rez.package_serialise import dump_package_data -from rez.serialise import load_from_file, FileFormat from rez.utils.resources import cached_property, ResourcePool from pymongo import MongoClient @@ -128,13 +125,7 @@ def _load(self): res = self._repository.packages.find_one({"name": self.name, "version": self.get("version")}) if not res: return {} - - file = NamedTemporaryFile(prefix=self.name, suffix=".py").name - - with open(file, "w") as stream: - dump_package_data(res.get("data"), stream) - - return load_from_file(file, FileFormat.py) + return res.get("data") class MongoVariantResource(VariantResourceHelper): @@ -269,7 +260,7 @@ def _get_variant_document(self, variant_resource: VariantResource, overrides=Non post.update(overrides) # We need to convert all data to string representation, so it can be added to the DB. Maybe there's a # built-in way to do this in Rez? - str_data = {k: str(v) for k, v in data.items()} + str_data = {k: str(v) for k, v in data.items() if v is not None} post["data"] = str_data post["timestamp"] = datetime.datetime.utcnow()