class allura.model.artifact.Artifact

Base class for anything you want to keep track of.

  • Automatically indexed into Solr (see index() method)
  • Has a discussion thread that can have files attached to it
  • mod_date – last-modified datetime
  • acl – dict of permission name => [roles]
  • labels – list of plain old strings
__json__(posts_limit=None, is_export=False, user=None)

Return a JSON-encodable dict representation of this Artifact.

classmethod artifacts_labeled_with(label, app_config)

Return all artifacts of type cls that have the label label and are in the tool denoted by app_config.

attach(filename, fp, **kw)

Attach a file to this Artifact.

  • filename – file name
  • fp – a file-like object (implements read())
  • **kw – passed through to Attachment class constructor

Delete this Artifact.


Return domain part of email address for this Artifact

Return a ‘mailto’ URL for this Artifact, with optional subject.


Return the discussion thread and parent_id for this artifact.

Returns:(allura.model.discuss.Thread, parent_thread_id (int))
classmethod is_limit_exceeded(app_config, user=None, count_by_user=None)

Returns True if any of artifact creation rate limits are exceeded, False otherwise

Return the link text to use when a shortlink to this artifact is expanded into an <a></a> tag.

By default this method returns type_s + shorthand_id(). Subclasses should override this method to provide more descriptive link text.


Persistent, email-friendly (Message-ID header) id of this artifact


Return the allura.model.project.AppConfig instance for this Artifact.

ACL processing for this Artifact continues at the AppConfig object. This lets AppConfigs provide a ‘default’ ACL for all artifacts in the tool.


If an artifact is a “secondary” artifact (discussion of a ticket, for instance), return the artifact that is the “primary”.


Return the allura.model.project.Project instance to which this Artifact belongs.


Return the _id of the allura.model.project.Project instance to which this Artifact belongs.


Return all Artifacts that are related to this one.


How to refer to this artifact within the app instance context.

For a wiki page, it might be the title. For a ticket, it might be the ticket number. For a discussion, it might be the message ID. Generally this should have a strong correlation to the URL.

subscribe(user=None, topic=None, type=u'direct', n=1, unit=u'day')

Subscribe user to the allura.model.notification.Mailbox for this Artifact.


If user is None, c.user will be subscribed.

Returns:a presentation name for this type of artifact
Return type:str

Unsubscribe user from the allura.model.notification.Mailbox for this Artifact.


If user is None, c.user will be unsubscribed.


Return the URL for this Artifact.

Subclasses must implement this.

class allura.model.artifact.Snapshot

A snapshot of an Artifact, used in VersionedArtifact


Redact author data for a given user

class allura.model.artifact.VersionedArtifact

An Artifact that has versions. Associated data like attachments and discussion thread are not versioned.


Save off a snapshot of the artifact and increment the version #

class allura.model.artifact.Message

A message

  • _id – an email friendly (e.g. message-id) string id
  • slug – slash-delimeted random identifier. Slashes useful for threaded searching and ordering
  • full_slug – string of slash-delimited “timestamp:slug” components. Useful for sorting by timstamp
class allura.model.artifact.Feed

Used to generate rss/atom feeds. This does not need to be extended; all feed items go into the same collection


Redact author data

classmethod feed(q, feed_type, title, link, description, since=None, until=None, page=None, limit=None)

Produces feedgenerator Feed

classmethod post(artifact, title=None, description=None, author=None, author_link=None, author_name=None, pubdate=None, link=None, **kw)

Create a Feed item. Returns the item. But if anon doesn’t have read access, create does not happen and None is returned.

class allura.model.artifact.VotableArtifact

Voting support for the Artifact. Use as a mixin.


Check that user voted for this artifact.

Return: 1 if user voted up -1 if user voted down 0 if user doesn’t vote

class allura.model.artifact.MovedArtifact