Example #1
0
 def get_path_to(self, content):
     """Return the path to the given content, even if the content
     is outside of the export root folder. If it is outside, the
     path will be absolute from the Silva root and prefixed with
     root:.
     """
     exported = self.getExported()
     content_path = content.getPhysicalPath()
     if is_inside_path(exported.rootPath, content_path):
         return "/".join(canonical_tuple_path(
                 [exported.root.getId()] +  relative_tuple_path(
                     exported.rootPath, content_path)))
     return "root:" + "/".join(canonical_tuple_path(
             relative_tuple_path(exported.basePath, content_path)))
Example #2
0
 def get_relative_path_to(self, content):
     exported = self.getExported()
     return '/'.join(canonical_tuple_path(
             [exported.root.getId()] +
             relative_tuple_path(
                 exported.rootPath,
                 content.getPhysicalPath())))