allura.model.project

class allura.model.project.AppConfig

Configuration information for an instantiated Application in a Project

Variables:
  • options – an object on which various options are stored. options.mount_point is the url component for this app instance

  • acl – a dict that maps permissions (strings) to lists of roles that have the permission

property activity_name

Override this for each Artifact type.

load() Type[Application]
Returns:

the related Application class

parent_security_context()

ACL processing should terminate at the AppConfig

url(project=None)

return the URL for the app config. project parameter is for optimization

class allura.model.project.Project

Projects contain tools, subprojects, and their own metadata. They live in exactly one Neighborhood

classmethod accolades_index(projects)

Return a dict[project_id] = list of accolades, efficiently

property activity_name

Override this for each Artifact type.

add_user(user, role_names)

Convenience method to add member with the given role(s).

admins()

Find all the users who have ‘Admin’ role for this project

all_troves()

Returns a dict of human-readable root troves => [categories]

bulk_export_filename()

Return a filename (configurable) for this project export. The current timestamp may be included, so only run this method once per export.

bulk_export_path(rootdir)
Parameters:

rootdir – a directory path, using {nbhd} {project} or {c..} substitution vars if desired

Returns:

a bulk export path for the current project

bulk_export_status()

Returns ‘busy’ if an export is queued or in-progress. Returns None otherwise

get_userproject_user(include_disabled=False)

If this is a user-project, return the User, else None

grouped_navbar_entries()

Return a SitemapEntry list suitable for rendering the project navbar with tools grouped together by tool type.

classmethod icon_urls(projects)

Return a dict[project_id] = icon_url, efficiently

index()

Return a dict representation of this object suitable for search indexing.

Subclasses should implement this, providing a dictionary of solr_field => value. These fields & values will be stored by Solr. Subclasses should call the super().index() and then extend it with more fields.

You probably want to override at least title and text to have meaningful search results and email senders.

You can take advantage of Solr’s dynamic field typing by adding a type suffix to your field names, e.g.:

_s (string) (not analyzed) _t (text) (analyzed) _b (bool) _i (int) _f (float) _dt (datetime)

install_app(ep_name, mount_point=None, mount_label=None, ordinal=None, **override_options)

Install an app

Parameters:
  • ep_name (str) – Entry Point name, e.g. “wiki”

  • mount_point (str) – URL path, e.g. “docs”

  • mount_label (str) – Display name

  • ordinal (int) – location of tool, relative to others; None will go to the end.

  • override_options

Returns:

install_apps(apps_params)

Install many apps at once.

Better than doing individually if you expect default name conflicts (e.g. “code” for both git & svn), by using the tool_label value.

Parameters:

apps_params (list) – list of dicts, where each dict is the args used in install_app()

nav_data(admin_options=False, navbar_entries=None)

Return data about project nav entries

Parameters:
  • admin_options (bool) – include admin options?

  • navbar_entries – for performance, include this if you already have grouped_navbar_entries data

Returns:

next_mount_point(include_hidden=False)

Return the ordinal of the next open toolbar mount point for this project.

ordered_mounts(include_hidden=False)

Returns an array of a projects mounts (tools and sub-projects) in toolbar order. Note that the top-level ‘ordinal’ field may be offset from the stored ordinal value, due to anchored tools

parent_security_context()

ACL processing should proceed up the project hierarchy.

property private

Return True if this project is private, else False.

remove_user(user, role_names=None)

Convenience method to add member with the given role(s).

should_update_index(old_doc, new_doc)

Skip index update if only last_updated has changed.

Value of last_updated is updated whenever any artifact that belongs to project is changed. This generates a lot of unnecessary add_projects tasks for every simple user action.

sitemap(excluded_tools=None, included_tools=None, tools_only=False, per_tool_limit=10, xml=False)

Return the project sitemap.

Parameters:
  • excluded_tools (list) – Tool names (AppConfig.tool_name) to exclude from sitemap.

  • included_tools (list) – Tool names (AppConfig.tool_name) to include. Use None to include all tool types.

  • tools_only (bool) – Only include tools in the sitemap (exclude subprojects).

  • per_tool_limit (int) – Max number of entries included in the sitemap for a single tool type. Use None to include all.

  • xml (bool) – If True, return sitemap entries for use in the sitemap.xml instead of site navigation.

property user_project_of

If this is a user-project, return the User, else None

users()

Find all the users who have named roles for this project

users_with_role(*role_names) list[User]

Return all users in this project that have at least one of the roles specified.

e.g., project.users_with_role(‘Admin’, ‘Developer’) -> returns all

users in project having the Admin role or the Developer role, or both

class allura.model.project.ProjectCategory
class allura.model.project.ProjectFile
class allura.model.project.ProjectNameFieldProperty(field_type, *args, **kwargs)

Make project names be the username instead of u/whatever, when a user-project. Particularly nice if the username and user-project name don’t match exactly. (This is a python “descriptor”)

class allura.model.project.TroveCategory
property fullpath_within_type

remove first section of full path, and use nicer separator

class allura.model.project.TroveCategoryMapperExtension(mapper)
after_delete(obj, state, sess)

Receive an object instance and its current state after that instance is deleted.

after_insert(obj, state, sess)

Receive an object instance and its current state after that instance is inserted into its collection.

after_update(obj, state, sess)

Receive an object instance and its current state after that instance is updated.