Esempio n. 1
0
  def _parse_cron_yaml(self):
    """Loads the cron.yaml file and parses it.

    Returns:
      A croninfo.CronInfoExternal containing cron jobs.

    Raises:
      yaml_errors.Error, StandardError: The cron.yaml was invalid.
    """
    for cron_yaml in ('cron.yaml', 'cron.yml'):
      try:
        with open(os.path.join(self.configuration.modules[0].application_root,
                               cron_yaml)) as f:
          cron_info = croninfo.LoadSingleCron(f)
          return cron_info
      except IOError:
        continue
    return None
Esempio n. 2
0
def _ParseCronYaml():
    """Loads the cron.yaml file and parses it.

  The CWD of the dev_appserver is the root of the application here.

  Returns a dict representing the contents of cron.yaml.
  """
    cronyaml_files = 'cron.yaml', 'cron.yml'
    for cronyaml in cronyaml_files:
        try:
            fh = open(cronyaml, "r")
        except IOError:
            continue
        try:
            cron_info = croninfo.LoadSingleCron(fh)
            return cron_info
        finally:
            fh.close()
    return None