예제 #1
0
 def inject(self, doc):
     path = doc.pod_path
     try:
         content = GoogleSheetsPreprocessor.download(
             path=path, sheet_id=self.config.id, gid=self.config.gid,
             raise_errors=True)
     except (errors.HttpError, base.PreprocessorError):
         doc.pod.logger.error('Error downloading sheet -> %s', path)
         raise
     if not content:
         return
     existing_data = doc.pod.read_yaml(doc.pod_path)
     fields = GoogleSheetsPreprocessor.format_content(
         content, path=path, format_as=self.config.format,
         preserve=self.config.preserve, existing_data=existing_data)
     fields = utils.untag_fields(fields)
     doc.inject(fields=fields)
예제 #2
0
파일: google_drive.py 프로젝트: kezlya/grow
 def inject(self, doc):
     path, key_to_update = self._parse_path(self.config.path)
     try:
         content = GoogleSheetsPreprocessor.download(
             path=path, sheet_id=self.config.id, gid=self.config.gid,
             raise_errors=True)
     except (errors.HttpError, base.PreprocessorError):
         doc.pod.logger.error('Error downloading sheet -> %s', path)
         raise
     if not content:
         return
     existing_data = doc.pod.read_yaml(doc.pod_path)
     fields = GoogleSheetsPreprocessor.format_content(
         content, path=path, format_as=self.config.format,
         preserve=self.config.preserve, existing_data=existing_data,
         key_to_update=key_to_update)
     fields = self._normalize_formatted_content(fields)
     fields = utils.untag_fields(fields)
     doc.inject(fields=fields)
예제 #3
0
 def read_yaml(self, path):
     fields = utils.parse_yaml(self.read_file(path), pod=self)
     return utils.untag_fields(fields)
예제 #4
0
 def fields(self):
   catalog = self.pod.catalogs.get(self.locale)
   fields = utils.untag_fields(self.tagged_fields, catalog=catalog)
   if fields is None:
     return {}
   return fields
예제 #5
0
 def fields(self):
     fields = utils.untag_fields(self.tagged_fields)
     return {} if not fields else fields
예제 #6
0
파일: documents.py 프로젝트: meizon/pygrow
 def fields(self):
   tagged_fields = self.get_tagged_fields()
   fields = utils.untag_fields(tagged_fields)
   if fields is None:
     return {}
   return fields
예제 #7
0
파일: builtins.py 프로젝트: stucox/pygrow
def yaml(path, _pod):
  fields = utils.parse_yaml(_pod.read_file(path), pod=_pod)
  return utils.untag_fields(fields)
예제 #8
0
 def fields(self):
     tagged_fields = self.yaml
     fields = utils.untag_fields(tagged_fields)
     return {} if not fields else fields
예제 #9
0
파일: collection.py 프로젝트: Yzupnick/grow
 def fields(self):
     fields = utils.untag_fields(self.tagged_fields)
     return {} if not fields else fields
예제 #10
0
파일: pods.py 프로젝트: chargrizzle/pygrow
 def read_yaml(self, path):
     fields = utils.parse_yaml(self.read_file(path), pod=self)
     return utils.untag_fields(fields)
예제 #11
0
def yaml(path, _doc, _pod):
  catalog = _pod.catalogs.get(_doc.locale) if _doc else None
  fields = utils.parse_yaml(_pod.read_file(path), pod=_pod)
  return utils.untag_fields(fields, catalog=catalog)
예제 #12
0
 def fields(self):
     identifier = self.locale or self.collection.default_locale
     tagged_fields = self.get_tagged_fields()
     fields = utils.untag_fields(tagged_fields, locale=str(identifier))
     return {} if not fields else fields
예제 #13
0
 def fields(self):
   catalog = self.pod.catalogs.get(self.locale)
   return utils.untag_fields(copy.deepcopy(self.tagged_fields),
                             catalog=catalog)