Return to Views.
Bases: projector.views.project.ProjectView
Base repository view.
View attributes
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Should be overridden at subclass. It always requires django.http.HttpRequest instance to be passed as first positional argument.
May return a dict or django.http.HttpResponse instance. If dict is returned it is treated as context and view would try to render it using self.template_name.
Returns: | dict or django.http.HttpResponse instance |
---|
Bases: projector.views.project_repository.RepositoryView
Repository browsing view.
In fact, this is only a wrapper for vcs.web.simplevcs.views.browse_repository view.
View attributes
Wrapped view
- browse_repository(request, template_name, repository=None, repository_path=None, repository_alias=None, revision=None, node_path='', extra_context={})¶
Generic repository browser view.
Required arguments:
- Either repository or (repository_path and repository_alias is required
- template_name: The full name of a template to use in rendering the page.
Optional arguments:
- revision: object with which backend may identify changeset. In example, mercurial backend recognizes hex or short strings, revision numbers (given as integer or string) or tip string. If none specified, most recent changeset (sometimes called tip) is taken.
- node_path: relative location of the node in the repository (location to file or directory). By default this is an empty string which would retrieve root node from repository.
- extra_context: A dictionary of values to add to the template context. By default, this is an empty dictionary.
Template context:
In addition to extra_context, the template’s context will be:
- repository: same what was given or computed from repository_path and repository_alias
- changeset: based on the given revision or tip if none given
- root: repository’s node on the given node_path
- readme_node: FileNode instance if returning root is a DirNode and a readme file can be found at it’s file listing (can be a file which name starts with README, with or without any extension, case is irrelevant); if no readme file could be found, None is returned
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Bases: projector.views.project_repository.RepositoryView
View presenting differences between two file nodes.
In fact, this is only a wrapper for vcs.web.simplevcs.views.browse_repository view.
View attributes
Wrapped view
- diff_file(request, file_path, template_name, repository=None, repository_path=None, repository_alias=None, revision_old=None, revision_new=None, extra_context=None)¶
Generic repository browser view showing diff of specified file.
Required arguments:
- Either repository or (repository_path and repository_alias is required)
- file_path: relative location of the file node in the repository.
- revision_old: object identifying changeset at backend.
- revision_new: object identifying changeset at backend.
- template_name: The full name of a template to use in rendering the page.
Optional arguments:
- extra_context: A dictionary of values to add to the template context. By default, this is an empty dictionary.
Template context:
In addition to extra_context, the template’s context will be:
- repository: same what was given or computed from repository_path and repository_alias
- file_old: FileNode retrieved by backend for given revision_old param
- file_new: FileNode retrieved by backend for given revision_new param
- diff_content: unified diff for retrieved file_old and file_new contents
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Bases: projector.views.project_repository.RepositoryView
This view returns FileNode from repository as file attachment.
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Bases: projector.views.project_repository.RepositoryBrowse
View presenting file from repository but with additional annotate information (shows changeset for which each line was added/changed).
View attributes
In fact, annotate is done at the template level.
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Bases: projector.views.project_repository.RepositoryView
Shows list of changesets for requested project’s repository.
View attributes
Additional context variables
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.
Bases: projector.views.project_repository.RepositoryView
Shows detailed information about requested commit.
In fact, this is only a wrapper for vcs.web.simplevcs.views.diff_changeset view.
View attributes
Wrapped view
- diff_changeset(request, template_name, repository=None, repository_path=None, repository_alias=None, revision=None, extra_context=None)¶
Generic repository browser view showing diffs for given revision.
Required arguments:
- Either repository or (repository_path and repository_alias is required
- revision: object identifying changeset at backend.
- template_name: The full name of a template to use in rendering the page.
Optional arguments:
- extra_context: A dictionary of values to add to the template context. By default, this is an empty dictionary.
Template context:
In addition to extra_context, the template’s context will be:
- repository: same what was given or computed from repository_path and repository_alias
- changeset: Changeset retrieved by backend for given revision param; nodes from added and changed attributes of the changeset have one extra attribute: diff which is instance of vcs.utils.diffs.DiffProcessor
Checks if user has permissions to call this view. By default, this method would perform checks using requested Project instance and permission list retrieved by get_required_perms method.
Combined with has_errors could be used like this:
def response(self, request):
if self.has_errors:
return self.get_error_response()
...
Returns list of required perms based on instance’s attributes. If modified, make sure it’s thread-safe, i.e. don’t change self.perms directly but create new temporary list of permissions.