示例#1
0
        def _get_readme_from_cache(key):
            readme_data = None
            readme_file = None
            log.debug('Fetching readme file')
            try:
                cs = repo.get_changeset()  # fetches TIP
                renderer = MarkupRenderer()
                for f in README_FILES:
                    try:
                        readme = cs.get_node(f)
                        readme_file = f
                        readme_data = renderer.render(readme.content, f)
                        log.debug('Found readme %s' % readme_file)
                        break
                    except NodeDoesNotExistError:
                        continue
            except ChangesetError:
                log.error(traceback.format_exc())
                pass
            except EmptyRepositoryError:
                pass
            except Exception:
                log.error(traceback.format_exc())

            return readme_data, readme_file
示例#2
0
        def _get_readme_from_cache(key):
            readme_data = None
            readme_file = None
            log.debug('Looking for README file')
            try:
                # get's the landing revision! or tip if fails
                cs = db_repo.get_landing_changeset()
                if isinstance(cs, EmptyChangeset):
                    raise EmptyRepositoryError()
                renderer = MarkupRenderer()
                for f in README_FILES:
                    try:
                        readme = cs.get_node(f)
                        if not isinstance(readme, FileNode):
                            continue
                        readme_file = f
                        log.debug('Found README file `%s` rendering...' %
                                  readme_file)
                        readme_data = renderer.render(readme.content, f)
                        break
                    except NodeDoesNotExistError:
                        continue
            except ChangesetError:
                log.error(traceback.format_exc())
                pass
            except EmptyRepositoryError:
                pass
            except Exception:
                log.error(traceback.format_exc())

            return readme_data, readme_file
示例#3
0
        def _get_readme_from_cache(key):
            readme_data = None
            readme_file = None
            log.debug('Looking for README file')
            try:
                # get's the landing revision! or tip if fails
                cs = db_repo.get_landing_changeset()
                if isinstance(cs, EmptyChangeset):
                    raise EmptyRepositoryError()
                renderer = MarkupRenderer()
                for f in README_FILES:
                    try:
                        readme = cs.get_node(f)
                        if not isinstance(readme, FileNode):
                            continue
                        readme_file = f
                        log.debug('Found README file `%s` rendering...' %
                                  readme_file)
                        readme_data = renderer.render(readme.content, f)
                        break
                    except NodeDoesNotExistError:
                        continue
            except ChangesetError:
                log.error(traceback.format_exc())
                pass
            except EmptyRepositoryError:
                pass
            except Exception:
                log.error(traceback.format_exc())

            return readme_data, readme_file
示例#4
0
        def _get_readme_from_cache(key):
            readme_data = None
            readme_file = None
            log.debug('Fetching readme file')
            try:
                cs = repo.get_changeset()  # fetches TIP
                renderer = MarkupRenderer()
                for f in README_FILES:
                    try:
                        readme = cs.get_node(f)
                        readme_file = f
                        readme_data = renderer.render(readme.content, f)
                        log.debug('Found readme %s' % readme_file)
                        break
                    except NodeDoesNotExistError:
                        continue
            except ChangesetError:
                log.error(traceback.format_exc())
                pass
            except EmptyRepositoryError:
                pass
            except Exception:
                log.error(traceback.format_exc())

            return readme_data, readme_file
示例#5
0
        def _generate_readme(cache_key):
            readme_data = None
            readme_file = None
            try:
                # gets the landing revision or tip if fails
                commit = db_repo.get_landing_commit()
                if isinstance(commit, EmptyCommit):
                    raise EmptyRepositoryError()
                renderer = MarkupRenderer()
                for f in README_FILES:
                    try:
                        node = commit.get_node(f)
                    except NodeDoesNotExistError:
                        continue

                    if not node.is_file():
                        continue

                    readme_file = f
                    log.debug('Found README file `%s` rendering...',
                              readme_file)
                    readme_data = renderer.render(node.content, filename=f)
                    break
            except CommitError:
                log.exception("Problem getting commit")
                pass
            except EmptyRepositoryError:
                pass
            except Exception:
                log.exception("General failure")

            return readme_data, readme_file