Пример #1
0
 def get_references(self, name):
     ref_set = ReferenceSet(self.context, name)
     options = self.getOptions()
     exported = self.getExported()
     have_external = 0
     root = exported.root
     for reference in ref_set.get_references():
         if not options.external_rendering:
             if not reference.target_id:
                 # The reference is broken. Return an empty path.
                 yield ""
             if not reference.is_target_inside_container(root):
                 if options.external_references:
                     have_external += 1
                     continue
                 else:
                     raise ExternalReferenceError(
                         _(u"External references"),
                         self.context, reference.target, root)
             # Add root path id as it is always mentioned in exports
             path = [root.getId()] + reference.relative_path_to(root)
             yield '/'.join(canonical_tuple_path(path))
         else:
             # Return url to the target
             yield absoluteURL(reference.target, exported.request)
     if have_external:
         # Report the collected problems.
         exported.reportProblem(
             (u'Content contains {0} reference(s) pointing outside ' +
              u'of the export.').format(
                 have_external),
             self.context)