コード例 #1
0
ファイル: utils.py プロジェクト: uxder/grow
 def func(path):
     constructed_doc = pod.get_doc(path, locale=self.loader_locale())
     if not constructed_doc.exists:
         raise errors.DocumentDoesNotExistError(
             'Referenced document does not exist: {}'.format(path))
     tracking_func(constructed_doc.pod_path)
     return constructed_doc
コード例 #2
0
ファイル: utils.py プロジェクト: fertolg/grow
 def func(path):
     contructed_doc = pod.get_doc(path, locale=locale)
     if not contructed_doc.exists:
         raise errors.DocumentDoesNotExistError(
             'Referenced document does not exist: {}'.format(path))
     pod.podcache.dependency_graph.add(pod_path,
                                       contructed_doc.pod_path)
     return contructed_doc
コード例 #3
0
ファイル: pods.py プロジェクト: cdhermann/grow
    def get_url(self, pod_path, locale=None):
        if pod_path.startswith('/content'):
            doc = self.get_doc(pod_path, locale=locale)
        else:
            doc = self.get_static(pod_path, locale=locale)

        if not doc.exists:
            raise errors.DocumentDoesNotExistError(
                'Referenced document does not exist: {}'.format(pod_path))
        return doc.url
コード例 #4
0
ファイル: pods.py プロジェクト: uxder/grow
    def get_static(self, pod_path, locale=None):
        """Returns a StaticFile, given the static file's pod path."""
        document = static_document.StaticDocument(
            self, pod_path, locale=locale)
        if document.exists:
            return document

        text = ('Either no file exists at "{}" or the "static_dirs" setting was '
                'not configured for this path in {}.'.format(
                    pod_path, self.FILE_PODSPEC))
        raise errors.DocumentDoesNotExistError(text)