projects¶
projects.admin¶
Django administration interface for Project and related models.
projects.constants¶
Default values and other various configuration for projects, including available theme names and repository types.
projects.models¶
- class projects.models.EmailHook(*args, **kwargs)¶
EmailHook(id, project_id, email)
- class projects.models.ImportedFile(*args, **kwargs)¶
ImportedFile(id, project_id, version_id, name, slug, path, md5)
- class projects.models.Project(*args, **kwargs)¶
Project(id, pub_date, modified_date, name, slug, description, repo, repo_type, project_url, canonical_url, version, copyright, theme, suffix, single_version, default_version, default_branch, requirements_file, documentation_type, analytics_code, path, conf_py_file, featured, skip, mirror, use_virtualenv, python_interpreter, use_system_packages, django_packages_url, privacy_level, version_privacy_level, language, main_language_project_id, num_major, num_minor, num_point)
- all_active_versions()¶
A temporary workaround for active_versions filtering out things that were active, but failed to build
- artifact_path(type, version='latest')¶
The path to the build html docs in the project.
- cnames_symlink_path(domain)¶
Path in the doc_path that we symlink cnames
This has to be at the top-level because Nginx doesn’t know the projects slug.
- find(file, version)¶
A balla API to find files inside of a projects dir.
- full_build_path(version='latest')¶
The path to the build html docs in the project.
- full_dash_path(version='latest')¶
The path to the build dash docs in the project.
- full_doc_path(version='latest')¶
The path to the documentation root in the project.
- full_epub_path(version='latest')¶
The path to the build epub docs in the project.
- full_find(file, version)¶
A balla API to find files inside of a projects dir.
- full_json_path(version='latest')¶
The path to the build json docs in the project.
- full_latex_path(version='latest')¶
The path to the build latex docs in the project.
- full_man_path(version='latest')¶
The path to the build man docs in the project.
- full_singlehtml_path(version='latest')¶
The path to the build singlehtml docs in the project.
- get_default_branch()¶
Get the version representing “latest”
- get_default_version()¶
Get the default version (slug).
Returns self.default_version if the version with that slug actually exists (is built and published). Otherwise returns ‘latest’.
- get_docs_url(version_slug=None, lang_slug=None)¶
Return a url for the docs. Always use http for now, to avoid content warnings.
- rtd_build_path(version='latest')¶
The destination path where the built docs are copied.
- single_version_symlink_path()¶
Path in the doc_path for the single_version symlink.
- static_metadata_path()¶
The path to the static metadata JSON settings file
- subprojects_symlink_path(project)¶
Path in the doc_path that we symlink subprojects
- supported_versions(flat=True)¶
Get the list of supported versions. Returns a list of version strings.
- translations_symlink_path(language=None)¶
Path in the doc_path that we symlink translations
- class projects.models.ProjectRelationship(*args, **kwargs)¶
ProjectRelationship(id, parent_id, child_id)
- class projects.models.WebHook(*args, **kwargs)¶
WebHook(id, project_id, url)
projects.tasks¶
Tasks related to projects, including fetching repository code, cleaning conf.py files, and rebuilding documentation.
- projects.tasks.create_build(version, api, record)¶
Create the build object. If we’re recording it, save it to the DB. Otherwise just use an empty hash.
- projects.tasks.docker_build(version_pk, pdf=True, man=True, epub=True, dash=True, search=True, force=False, intersphinx=True, localmedia=True)¶
The code that executes inside of docker
- projects.tasks.ensure_version(api, project, version_pk)¶
Ensure we’re using a sane version. This also creates the “latest” version if it doesn’t exist.
- projects.tasks.fileify(version_pk)¶
Create ImportedFile objects for all of a version’s files.
This is a prereq for indexing the docs for search. It also causes celery-haystack to kick off an index of the file.
- projects.tasks.finish_build(version, build, results)¶
Build Finished, do house keeping bits
- projects.tasks.record_build(api, record, build, results, state)¶
Record a build by hitting the API.
Returns nothing
- projects.tasks.setup_environment(version)¶
Build the virtualenv and install the project into it.
- projects.tasks.setup_vcs(version, build, api)¶
Update the checkout of the repo to make sure it’s the latest. This also syncs versions in the DB.
projects.utils¶
Utility functions used by projects.
- projects.utils.find_file(file)¶
Find matching filenames in the current directory and its subdirectories, and return a list of matching filenames.
- projects.utils.run(*commands, **kwargs)¶
Run one or more commands, and return (status, out, err). If more than one command is given, then this is equivalent to chaining them together with &&; if all commands succeed, then (status, out, err) will represent the last successful command. If one command failed, then (status, out, err) will represent the failed command.
- projects.utils.safe_write(filename, contents)¶
Write contents to the given filename. If the filename’s directory does not exist, it is created. Contents are written as UTF-8, ignoring any characters that cannot be encoded as UTF-8.
- projects.utils.update_static_metadata(project_pk)¶
This is here to avoid circular imports in models.py
projects.views¶
projects.views.public¶
- projects.views.public.project_badge(request, project_slug, redirect=False)¶
Return a sweet badge for the project
- projects.views.public.project_detail(request, project_slug)¶
A detail view for a project with various dataz
- projects.views.public.project_downloads(request, project_slug)¶
A detail view for a project with various dataz
- projects.views.public.search_autocomplete(request)¶
return a json list of project names
- projects.views.public.version_autocomplete(request, project_slug)¶
return a json list of version names
projects.views.private¶
- class projects.views.private.ProjectDashboard(**kwargs)¶
A dashboard! If you aint know what that means you aint need to. Essentially we show you an overview of your content.
- model¶
alias of Project
- projects.views.private.project_advanced(request, *args, **kwargs)¶
Edit an existing project - depending on what type of project is being edited (created or imported) a different form will be displayed
- projects.views.private.project_delete(request, *args, **kwargs)¶
Make a project as deleted on POST, otherwise show a form asking for confirmation of delete.
- projects.views.private.project_edit(request, *args, **kwargs)¶
Edit an existing project - depending on what type of project is being edited (created or imported) a different form will be displayed
- projects.views.private.project_import(request, *args, **kwargs)¶
Import docs from an repo
- projects.views.private.project_manage(request, *args, **kwargs)¶
The management view for a project, where you will have links to edit the projects’ configuration, edit the files associated with that project, etc.
Now redirects to the normal /projects/<slug> view.
- projects.views.private.project_versions(request, *args, **kwargs)¶
Shows the available versions and lets the user choose which ones he would like to have built.