# Join it all together
return ".".join(e for e in s if e)
+ @functools.cached_property
+ def canary(self):
+ """
+ Creates a canary that will be inserted into all exports
+ and will be checked if we import a source to avoid that we will
+ import our own data in a circle.
+ """
+ # Make a unique canary
+ canary = "canary.%s" % self.zone(prefix="dbl")
+
+ # Remove the trailing dot
+ canary = canary.removesuffix(".")
+
+ return canary
+
@functools.cached_property
def __domains(self):
"""
"""
Returns all domains that are on this list
"""
- stmt = (
+ domains = self.backend.db.fetch(
sqlmodel
.select(
self.__domains.c.name,
)
)
- return self.backend.db.fetch(stmt)
+ canary_inserted = False
+
+ # Walk through all domains and insert the canary
+ for domain in domains:
+ # If we have not inserted the canary, yet, we will do
+ # it whenever it alphabetically fits
+ if not canary_inserted and domain > self.canary:
+ yield self.canary
+ canary_inserted = True
+
+ # Add the domain, too
+ yield domain
+
+ # If we have added all domains but not the canary, we will add the canary anyways
+ if not canary_inserted:
+ yield self.canary
def add_domain(self, name, added_by, report=None, block=True):
"""