distro_tracker.core¶
Core internal API¶
The API in the module listed here might be useful to you if you want to add a new feature to distro-tracker.
distro_tracker.core.models¶
Models for the distro_tracker.core
app.
-
class
distro_tracker.core.models.
Keyword
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Describes a keyword which can be used to tag package messages.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
default
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
emailsettings_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
membershippackagespecifics_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager object>¶
-
subscription_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
teammembership_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
EmailSettings
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Settings for an email
-
user_email
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
default_keywords
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
email
¶
-
user
¶
-
save
(*args, **kwargs)[source]¶ Overrides the default save method to add the set of default keywords to the user’s own default keywords after creating an instance.
-
is_subscribed_to
(package)[source]¶ Checks if the user is subscribed to the given package.
- Parameters
package (
Package
or string) – The package (or package name)
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
packagename_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
subscription_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
user_email_id
¶
-
-
class
distro_tracker.core.models.
PackageManagerQuerySet
(model=None, query=None, using=None, hints=None)[source]¶ Bases:
django.db.models.query.QuerySet
A custom
PackageManagerQuerySet
for thePackageManager
manager. It is needed in order to change the bulk delete behavior.
-
class
distro_tracker.core.models.
PackageManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for thePackageName
model.-
get_queryset
()[source]¶ Overrides the default query set of the manager to exclude any
PackageName
objects with a type that does not match this manager instance’stype
.If the instance does not have a
type
, then allPackageName
instances are returned.
-
exists_with_name
(package_name)[source]¶ - Parameters
package_name (string) – The name of the package
- Returns True
If a package with the given name exists.
-
create
(*args, **kwargs)[source]¶ Overrides the default
create
method to inject apackage_type
to the instance being created.The type is the type given in this manager instance’s
type
attribute.
-
get_or_create
(*args, **kwargs)[source]¶ Overrides the default
get_or_create
to set the correct package type.The type is the type given in this manager instance’s
type
attribute.
-
all_with_subscribers
()[source]¶ A method which filters the packages and returns a QuerySet containing only those which have at least one subscriber.
- Return type
QuerySet
ofPackageName
instances.
-
-
class
distro_tracker.core.models.
PackageName
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model describing package names.
Three different types of packages are supported:
Source packages
Binary packages
Pseudo packages
PackageName associated to no source/binary/pseudo packages are referred to as “Subscription-only packages”.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
binary
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
pseudo
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
subscriptions
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <distro_tracker.core.models.PackageManager object>¶
-
source_packages
= <distro_tracker.core.models.PackageManager object>¶
-
binary_packages
= <distro_tracker.core.models.PackageManager object>¶
-
pseudo_packages
= <distro_tracker.core.models.PackageManager object>¶
-
default_manager
= <django.db.models.manager.Manager object>¶
-
get_action_item_for_type
(action_item_type)[source]¶ - Param
The name of the
ActionItemType
of theActionItem
which is to be returned or anActionItemType
instance.- Returns
An action item with the given type name which is associated to this
PackageName
instance.None
if the package has no action items of that type.- Return type
ActionItem
orNone
-
delete
(*args, **kwargs)[source]¶ Custom delete method so that PackageName proxy classes do not remove the underlying PackageName. Instead they update their corresponding “type” field to False so that they no longer find the package name.
The delete method on PackageName keeps its default behaviour.
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
action_items
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
binary_bug_stats
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
binary_package_versions
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
bug_stats
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
data
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
membershippackagespecifics_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
news_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_dependencies
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_dependents
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_package_versions
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
subscription_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
teams
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
distro_tracker.core.models.
PseudoPackageName
(*args, **kwargs)[source]¶ Bases:
distro_tracker.core.models.PackageName
A convenience proxy model of the
PackageName
model.It returns only those
PackageName
instances whosepseudo
attribute is True.-
objects
= <distro_tracker.core.models.PackageManager object>¶
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
distro_tracker.core.models.PackageName.MultipleObjectsReturned
-
-
class
distro_tracker.core.models.
BinaryPackageName
(*args, **kwargs)[source]¶ Bases:
distro_tracker.core.models.PackageName
A convenience proxy model of the
PackageName
model.It returns only those
PackageName
instances whosebinary
attribute is True.-
objects
= <distro_tracker.core.models.PackageManager object>¶
-
property
main_source_package_name
¶ Returns the main source package name to which this binary package name is mapped.
The “main source package” is defined as follows:
If the binary package is found in the default repository, the returned source package name is the one which has the highest version.
If the binary package is not found in the default repository, the returned source package name is the one of the source package with the highest version.
- Return type
string
This is used for redirecting users who try to access a Web page for by giving this binary’s name.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
distro_tracker.core.models.PackageName.MultipleObjectsReturned
-
sourcepackage_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
SourcePackageName
(*args, **kwargs)[source]¶ Bases:
distro_tracker.core.models.PackageName
A convenience proxy model of the
PackageName
model.It returns only those
PackageName
instances whosesource
attribute is True.-
objects
= <distro_tracker.core.models.PackageManager object>¶
-
main_version
¶ Returns the main version of this
SourcePackageName
instance. :rtype: stringIt is defined as either the highest version found in the default repository, or if the package is not found in the default repository at all, the highest available version.
-
main_entry
¶ Returns the
SourcePackageRepositoryEntry
which represents the package’s entry in either the default repository (if the package is found there) or in the first repository (as defined by the repository order) which has the highest available package version.
-
repositories
¶ Returns all repositories which contain a source package with this name.
- Return type
QuerySet
ofRepository
instances.
-
short_description
()[source]¶ Returns the most recent short description for a source package. If there is a binary package whose name matches the source package, its description will be used. If not, the short description for the first binary package will be used.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
distro_tracker.core.models.PackageName.MultipleObjectsReturned
-
-
distro_tracker.core.models.
get_web_package
(package_name)[source]¶ Utility function mapping a package name to its most adequate Python representation (among
SourcePackageName
,PseudoPackageName
,PackageName
andNone
).The rules are simple: a source package is returned as SourcePackageName, a pseudo-package is returned as PseudoPackageName, a binary package is turned into the corresponding SourcePackageName (which might have a different name!).
If the package name is known but is none of the above, it’s only returned if it has associated
News
since that proves that it used to be a former source package.If that is not the case, then
None
is returned. You can use a “src:” or “bin:” prefix to the package name to restrict the lookup among source packages or binary packages, respectively.- Return type
PackageName
orNone
- Parameters
package_name (string) – The name for which a package should be found.
-
class
distro_tracker.core.models.
SubscriptionManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theSubscription
class.-
create_for
(package_name, email, active=True)[source]¶ Creates a new subscription based on the given arguments.
- Parameters
package_name (string) – The name of the subscription package
email (string) – The email address of the user subscribing to the package
active – Indicates whether the subscription should be activated as soon as it is created.
- Returns
The subscription for the given
(email, package_name)
pair.- Return type
-
unsubscribe
(package_name, email)[source]¶ Unsubscribes the given email from the given package.
- Parameters
email – The email of the user
package_name – The name of the package the user should be unsubscribed from
- Returns True
If the user was successfully unsubscribed
- Returns False
If the user was not unsubscribed, e.g. the subscription did not even exist.
-
get_for_email
(email)[source]¶ Returns a list of active subscriptions for the given user.
- Parameters
email (string) – The email address of the user
- Return type
iterable
ofSubscription
instances
Note
Since this method is not guaranteed to return a
QuerySet
object, clients should not count on chaining additional filters to the result.
-
all_active
(keyword=None)[source]¶ Returns all active subscriptions, optionally filtered on having the given keyword.
- Return type
iterable
ofSubscription
instances
Note
Since this method is not guaranteed to return a
QuerySet
object, clients should not count on chaining additional filters to the result.
-
-
class
distro_tracker.core.models.
Subscription
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model describing a subscription of a single
EmailSettings
to a singlePackageName
.-
email_settings
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
active
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.SubscriptionManager object>¶
-
class
KeywordsAdapter
(subscription)[source]¶ Bases:
object
An adapter for accessing a
Subscription
’s keywords.When a
Subscription
is initially created, it uses the default keywords of the user. Only after modifying the subscription-specific keywords, should it use a different set of keywords.This class allows the clients of the class:Subscription class to access the
keywords
field without having to think about whether the subscription is using the user’s keywords or not, rather the whole process is handled automatically and seamlessly.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
email_settings_id
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package_id
¶
-
-
class
distro_tracker.core.models.
Architecture
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model describing a single architecture.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
binarypackagerepositoryentry_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
sourcepackage_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
RepositoryManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theRepository
model.-
get_default
()[source]¶ Returns the default
Repository
instance.If there is no default repository, returns an empty
QuerySet
- Return type
-
-
class
distro_tracker.core.models.
Repository
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model describing Debian repositories.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
shorthand
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
uri
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
public_uri
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
suite
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
codename
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
components
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
architectures
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
default
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
optional
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
binary
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_packages
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.RepositoryManager object>¶
-
classmethod
find
(identifier)[source]¶ Looks up a repository, trying first with a match on “name”; if that fails, sequentially try “shorthand”, “codename” and “suite”.
Matching by “codename” and “suite” will only be used if they return a single match.
If no match is found, then raises a ValueError.
-
property
sources_list_entry
¶ Returns the sources.list entries based on the repository’s attributes.
- Return type
string
-
property
component_urls
¶ Returns a list of URLs which represent full URLs for each of the components of the repository.
- Return type
-
get_source_package_entry
(package_name)[source]¶ Returns the canonical
SourcePackageRepositoryEntry
with the given name, if found in the repository.This means the instance with the highest
version
is returned.If there is no
SourcePackageRepositoryEntry
for the given name in this repository, returnsNone
.- Parameters
package_name (string or
SourcePackageName
) – The name of the package for which the entry should be returned- Return type
SourcePackageRepositoryEntry
orNone
-
add_source_package
(package, **kwargs)[source]¶ The method adds a new class:SourcePackage to the repository.
- Parameters
package (
SourcePackage
) – The source package to add to the repository
The parameters needed for the corresponding
SourcePackageRepositoryEntry
should be in the keyword arguments.Returns the newly created
SourcePackageRepositoryEntry
for the givenSourcePackage
.- Return type
-
has_source_package_name
(source_package_name)[source]¶ Checks whether this
Repository
contains a source package with the given name.- Parameters
source_package_name (string) – The name of the source package
- Returns True
If it contains at least one version of the source package with the given name.
- Returns False
If it does not contain any version of the source package with the given name.
-
has_source_package
(source_package)[source]¶ Checks whether this
Repository
contains the givenSourcePackage
.- Returns True
If it does contain the given
SourcePackage
- Returns False
If it does not contain the given
SourcePackage
-
has_binary_package
(binary_package)[source]¶ Checks whether this
Repository
contains the givenBinaryPackage
.- Returns True
If it does contain the given
SourcePackage
- Returns False
If it does not contain the given
SourcePackage
-
add_binary_package
(package, **kwargs)[source]¶ The method adds a new class:BinaryPackage to the repository.
- Parameters
package (
BinaryPackage
) – The binary package to add to the repository
The parameters needed for the corresponding
BinaryPackageRepositoryEntry
should be in the keyword arguments.Returns the newly created
BinaryPackageRepositoryEntry
for the givenBinaryPackage
.- Return type
-
static
release_file_url
(base_url, suite)[source]¶ Returns the URL of the Release file for a repository with the given base URL and suite name.
- Parameters
base_url (string) – The base URL of the repository
suite (string) – The name of the repository suite
- Return type
string
-
clean
()[source]¶ A custom model
clean
method which enforces that only oneRepository
can be set as the default.
-
is_development_repository
()[source]¶ Returns a boolean indicating whether the repository is used for development.
A development repository is a repository where new versions of packages tend to be uploaded. The list of development repositories can be provided in the list DISTRO_TRACKER_DEVEL_REPOSITORIES (it should contain codenames and/or suite names). If that setting does not exist, then the default repository is assumed to be the only development repository.
- Return type
-
get_flags
()[source]¶ Returns a dict of existing flags and values. If no existing flag it returns the default value.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
binary_entries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
flags
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
relations
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
reverse_relations
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_entries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
sourcepackagedeps_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
RepositoryFlag
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Boolean options associated to repositories.
-
FLAG_NAMES
= (('hidden', 'Hidden repository'),)¶
-
FLAG_DEFAULT_VALUES
= {'hidden': False}¶
-
repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
value
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_name_display
(*, field=<django.db.models.fields.CharField: name>)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_id
¶
-
-
class
distro_tracker.core.models.
RepositoryRelation
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Relations between two repositories. The relations are to be interpreted like “<repository> is a <relation> of <target_repository>”.
-
RELATION_NAMES
= (('derivative', 'Derivative repository (target=parent)'), ('overlay', 'Overlay of target repository'))¶
-
repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
target_repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_name_display
(*, field=<django.db.models.fields.CharField: name>)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_id
¶
-
target_repository_id
¶
-
-
class
distro_tracker.core.models.
ContributorName
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a contributor.
A single contributor, identified by email address, may have different written names in different contexts.
-
contributor_email
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
email
¶
-
to_dict
()[source]¶ Returns a dictionary representing a
ContributorName
instance.- Return type
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
contributor_email_id
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
signed_news_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_package
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_packages_uploads_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
SourcePackage
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing a single Debian source package.
This means it holds any information regarding a (package_name, version) pair which is independent from the repository in which the package is found.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_package_name
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
version
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
standards_version
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
architectures
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
binary_packages
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
maintainer
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
uploaders
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
dsc_file_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
directory
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
homepage
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
vcs
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
name
¶ A convenience property returning the name of the package as a string.
- Return type
string
-
main_entry
¶ Returns the
SourcePackageRepositoryEntry
found in the instance’srepository_entries
which should be considered the main entry for this version.If the version is found in the default repository, the entry for the default repository is returned.
Otherwise, the entry for the repository with the highest
position
field is returned.If the source package version is not found in any repository,
None
is returned.
-
get_changelog_entry
()[source]¶ Retrieve the changelog entry which corresponds to this package version.
If there is no changelog associated with the version returns
None
- Return type
string
orNone
-
update
(**kwargs)[source]¶ The method updates all of the instance attributes based on the keyword arguments.
>>> src_pkg = SourcePackage() >>> src_pkg.update(version='1.0.0', homepage='http://example.com') >>> str(src_pkg.version) '1.0.0' >>> str(src_pkg.homepage) 'http://example.com'
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
binarypackage_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
extracted_source_files
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
maintainer_id
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_entries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
repository_set
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_package_name_id
¶
-
-
class
distro_tracker.core.models.
BinaryPackage
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
The method represents a particular binary package.
All information regarding a (binary-package-name, version) which is independent from the repository in which the package is found.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
binary_package_name
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
version
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
short_description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
long_description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
update
(**kwargs)[source]¶ The method updates all of the instance attributes based on the keyword arguments.
-
name
¶ Returns the name of the package
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
binary_package_name_id
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_entries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
source_package_id
¶
-
-
class
distro_tracker.core.models.
BinaryPackageRepositoryEntryManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
-
filter_by_package_name
(names)[source]¶ - Returns
A set of
BinaryPackageRepositoryEntry
instances which are associated to a binary package with one of the names given in thenames
parameter.- Return type
-
-
class
distro_tracker.core.models.
BinaryPackageRepositoryEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing repository specific information for a given binary package.
It links a
BinaryPackage
instance with theRepository
instance.-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
binary_package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
architecture
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
priority
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
section
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.BinaryPackageRepositoryEntryManager object>¶
-
property
name
¶ The name of the binary package
-
version
¶ The version of the binary package
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
architecture_id
¶
-
binary_package_id
¶
-
repository_id
¶
-
-
class
distro_tracker.core.models.
SourcePackageRepositoryEntryManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
-
filter_by_package_name
(names)[source]¶ - Returns
A set of
SourcePackageRepositoryEntry
instances which are associated to a source package with one of the names given in thenames
parameter.- Return type
-
-
class
distro_tracker.core.models.
SourcePackageRepositoryEntry
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing source package data that is repository specific.
It links a
SourcePackage
instance with theRepository
instance.-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
component
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.SourcePackageRepositoryEntryManager object>¶
-
property
dsc_file_url
¶ Returns the URL where the .dsc file of this entry can be found.
- Return type
string
-
property
directory_url
¶ Returns the URL of the package’s directory.
- Return type
string
-
property
name
¶ The name of the source package
-
version
¶ Returns the version of the associated source package.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
repository_id
¶
-
source_package_id
¶
-
-
class
distro_tracker.core.models.
ExtractedSourceFile
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model representing a single file extracted from a source package archive.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source_package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
extracted_file
¶ The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
date_extracted
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_next_by_date_extracted
(*, field=<django.db.models.fields.DateTimeField: date_extracted>, is_next=True, **kwargs)¶
-
get_previous_by_date_extracted
(*, field=<django.db.models.fields.DateTimeField: date_extracted>, is_next=False, **kwargs)¶
-
objects
= <django.db.models.manager.Manager object>¶
-
source_package_id
¶
-
-
class
distro_tracker.core.models.
PackageData
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model representing a quasi key-value store for package information extracted from other models in order to speed up its rendering on Web pages.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
key
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
value
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
package_id
¶
-
-
class
distro_tracker.core.models.
MailingListManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theMailingList
class.-
get_by_email
(email)[source]¶ Returns a
MailingList
instance which matches the given email. This means that the email’s domain matches exactly the MailingList’s domain field.
-
-
distro_tracker.core.models.
validate_archive_url_template
(value)[source]¶ Custom validator for
MailingList
’sarchive_url_template
field.- Raises
ValidationError – If there is no {user} parameter in the value.
-
class
distro_tracker.core.models.
MailingList
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Describes a known mailing list.
This provides Distro Tracker users to define the known mailing lists through the admin panel in order to support displaying their archives in the package pages without modifying any code.
Instances should have the
archive_url_template
field set to the template which archive URLs should follow where a mandatory parameter is {user}.-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
domain
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
archive_url_template
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.MailingListManager object>¶
-
archive_url
(user)[source]¶ Returns the archive URL for the given user.
- Parameters
user (string) – The user for whom the archive URL should be returned
- Return type
string
-
archive_url_for_email
(email)[source]¶ Returns the archive URL for the given email.
Similar to
archive_url()
, but extracts the user name from the email first.- Parameters
email – The email of the user for whom the archive URL should be returned
- Return type
string
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
distro_tracker.core.models.
NewsManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theNews
model.-
create
(**kwargs)[source]¶ Overrides the default create method to allow for easier creation of News with different content backing (DB or file).
If there is a
content
parameter in the kwargs, the news content is saved to the database.If there is a
file_content
parameter in the kwargs, the news content is saved to a file.If none of those parameters are given, the method works as expected.
-
-
distro_tracker.core.models.
news_upload_path
(instance, filename)[source]¶ Compute the path where to store a news.
-
class
distro_tracker.core.models.
News
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A model used to describe a news item regarding a package.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
title
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
content_type
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
news_file
¶ The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assign a file object on assignment so you can do:
>>> with open('/path/to/hello.world') as f: ... instance.file = File(f)
-
created_by
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
datetime_created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
signed_by
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <distro_tracker.core.models.NewsManager object>¶
-
content
¶ Returns either the content of the message saved in the database or retrieves it from the news file found in the filesystem.
The property is cached so that a single instance of
News
does not have to read a file every time its content is accessed.
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_next_by_datetime_created
(*, field=<django.db.models.fields.DateTimeField: datetime_created>, is_next=True, **kwargs)¶
-
get_previous_by_datetime_created
(*, field=<django.db.models.fields.DateTimeField: datetime_created>, is_next=False, **kwargs)¶
-
package_id
¶
-
-
class
distro_tracker.core.models.
EmailNewsManager
(*args, **kwargs)[source]¶ Bases:
distro_tracker.core.models.NewsManager
A custom
Manager
for theEmailNews
model.-
create_email_news
(message, package, **kwargs)[source]¶ The method creates a news item from the given email message.
If a title of the message is not given, it automatically generates it based on the sender of the email.
- Parameters
message (
Message
) – The message based on which a news item should be created.package – The package to which the news item refers
- Type
-
-
class
distro_tracker.core.models.
EmailNews
(id, package, title, content_type, _db_content, news_file, created_by, datetime_created)[source]¶ Bases:
distro_tracker.core.models.News
-
objects
= <distro_tracker.core.models.EmailNewsManager object>¶
-
static
get_from_email
(message)[source]¶ Analyzes the content of the message in order to get the name of the person that triggered the news event. The function returns the mail in “Changed-By” if possible.
-
static
get_email_news_parameters
(message)[source]¶ Returns a dict representing default values for some
EmailNews
fields based on the given email message.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
distro_tracker.core.models.News.MultipleObjectsReturned
-
-
class
distro_tracker.core.models.
NewsRenderer
(news)[source]¶ Bases:
object
Base class which is used to register subclasses to render a
News
instance’s contents into an HTML page.Each
News
instance has aNews.content_type
field which is used to select the correct renderer for its type.-
content_type
= None¶ Each
NewsRenderer
subclass sets a content type that it can render into HTML
-
template_name
= None¶ A renderer can define a template name which will be included when its output is required
-
property
context
¶
-
html_output
= None¶ Pure HTML which is included when the renderer’s output is required. Must be marked safe with
django.utils.safestring.mark_safe()
or else it will be HTML encoded!
-
classmethod
get_renderer_for_content_type
(content_type)[source]¶ Returns one of the
NewsRenderer
subclasses which implements rendering the given content type. If there is more than one such class, it is undefined which one is returned from this method. If there is not renderer for the given type,None
is returned.- Parameters
content_type (string) – The Content-Type for which a renderer class should be returned.
- Return type
NewsRenderer
subclass orNone
-
plugins
= [<class 'distro_tracker.core.models.PlainTextNewsRenderer'>, <class 'distro_tracker.core.models.HtmlNewsRenderer'>, <class 'distro_tracker.core.models.EmailNewsRenderer'>]¶
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.models.
PlainTextNewsRenderer
(news)[source]¶ Bases:
distro_tracker.core.models.NewsRenderer
Renders a text/plain content type by placing the text in a <pre> HTML block
-
content_type
= 'text/plain'¶
-
template_name
= 'core/news-plain.html'¶
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.models.
HtmlNewsRenderer
(news)[source]¶ Bases:
distro_tracker.core.models.NewsRenderer
Renders a text/html content type by simply emitting it to the output.
When creating news with a text/html type, you must be careful to properly santize any user-provided data or risk security vulnerabilities.
-
content_type
= 'text/html'¶
-
property
html_output
¶
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.models.
EmailNewsRenderer
(news)[source]¶ Bases:
distro_tracker.core.models.NewsRenderer
Renders news content as an email message.
-
content_type
= 'message/rfc822'¶
-
template_name
= 'core/news-email.html'¶
-
context
¶
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.models.
PackageBugStats
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model for bug statistics of source and pseudo packages (packages modelled by the
PackageName
model).-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
stats
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
package_id
¶
-
-
class
distro_tracker.core.models.
BinaryPackageBugStats
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model for bug statistics of binary packages (
BinaryPackageName
).-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
stats
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
package_id
¶
-
-
class
distro_tracker.core.models.
ActionItemTypeManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theActionItemType
model.-
create_or_update
(type_name, full_description_template)[source]¶ Method either creates the template with the given name and description template or makes sure to update an existing instance of that name to have the given template.
- Parameters
type_name (string) – The name of the
ActionItemType
instance to create.full_description_template (string) – The description template that the returned
ActionItemType
instance should have.
- Returns
ActionItemType
instance
-
-
class
distro_tracker.core.models.
ActionItemType
(id, type_name, full_description_template)[source]¶ Bases:
django.db.models.base.Model
-
type_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
full_description_template
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.ActionItemTypeManager object>¶
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
action_items
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
distro_tracker.core.models.
ActionItemManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom
Manager
for theActionItem
model.-
delete_obsolete_items
(item_types, non_obsolete_packages)[source]¶ The method removes
ActionItem
instances which have one of the given types and are not associated to one of the non obsolete packages.- Parameters
item_types (list of
ActionItemType
instances) – A list of action item types to be considered for removal.non_obsolete_packages (list of strings) – A list of package names whose items are not to be removed.
-
-
class
distro_tracker.core.models.
ActionItem
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Model for entries of the “action needed” panel.
-
SEVERITY_WISHLIST
= 0¶ All available severity levels
-
SEVERITY_LOW
= 1¶
-
SEVERITY_NORMAL
= 2¶
-
SEVERITY_HIGH
= 3¶
-
SEVERITY_CRITICAL
= 4¶
-
SEVERITIES
= ((0, 'wishlist'), (1, 'low'), (2, 'normal'), (3, 'high'), (4, 'critical'))¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
package
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
item_type
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
short_description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
severity
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
created_timestamp
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_updated_timestamp
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
extra_data
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <distro_tracker.core.models.ActionItemManager object>¶
-
property
type_name
¶
-
property
full_description_template
¶
-
full_description
¶
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_next_by_created_timestamp
(*, field=<django.db.models.fields.DateTimeField: created_timestamp>, is_next=True, **kwargs)¶
-
get_next_by_last_updated_timestamp
(*, field=<django.db.models.fields.DateTimeField: last_updated_timestamp>, is_next=True, **kwargs)¶
-
get_previous_by_created_timestamp
(*, field=<django.db.models.fields.DateTimeField: created_timestamp>, is_next=False, **kwargs)¶
-
get_previous_by_last_updated_timestamp
(*, field=<django.db.models.fields.DateTimeField: last_updated_timestamp>, is_next=False, **kwargs)¶
-
get_severity_display
(*, field=<django.db.models.fields.IntegerField: severity>)¶
-
item_type_id
¶
-
package_id
¶
-
-
exception
distro_tracker.core.models.
ConfirmationException
[source]¶ Bases:
Exception
An exception which is raised when the
ConfirmationManager
is unable to generate a unique key for a given identifier.
-
class
distro_tracker.core.models.
ConfirmationManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
A custom manager for the
Confirmation
model.-
generate_key
(identifier)[source]¶ Generates a random key for the given identifier.
- Parameters
identifier – A string representation of an identifier for the confirmation instance.
-
create_confirmation
(identifier='', **kwargs)[source]¶ Creates a
Confirmation
object with the given identifier and all the given keyword arguments passed.- Parameters
identifier – A string representation of an identifier for the confirmation instance.
- Raises
distro_tracker.mail.models.ConfirmationException – If it is unable to generate a unique key.
-
get
(*args, **kwargs)[source]¶ Overrides the default
django.db.models.Manager
method so that expiredConfirmation
instances are never returned.- Return type
Confirmation
orNone
-
-
class
distro_tracker.core.models.
Confirmation
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
An abstract model allowing its subclasses to store and create confirmation keys.
-
confirmation_key
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
date_created
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
¶
-
is_expired
()[source]¶ - Returns True
if the confirmation key has expired
- Returns False
if the confirmation key is still valid
-
get_next_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
-
get_previous_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
-
-
class
distro_tracker.core.models.
SourcePackageDeps
(id, source, dependency, repository, build_dep, binary_dep, details)[source]¶ Bases:
django.db.models.base.Model
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
source
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
dependency
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
repository
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
build_dep
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
binary_dep
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
details
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
dependency_id
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
repository_id
¶
-
source_id
¶
-
-
class
distro_tracker.core.models.
TeamManager
(*args, **kwargs)[source]¶ Bases:
django.db.models.manager.Manager
-
class
distro_tracker.core.models.
Team
(id, name, slug, maintainer_email, description, url, public, owner)[source]¶ Bases:
django.db.models.base.Model
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
maintainer_email
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
description
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
url
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
public
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
owner
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
packages
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
members
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <distro_tracker.core.models.TeamManager object>¶
-
add_members
(users, muted=False)[source]¶ Adds the given users to the team.
It automatically creates the intermediary
TeamMembership
models.- Parameters
users (an
iterable
ofUserEmail
instances) – The users to be added to the team.muted – If set to True, the membership will be muted before the user excplicitely unmutes it.
- Returns
TeamMembership
instances for each user added to the team- Return type
-
remove_members
(users)[source]¶ Removes the given users from the team.
- Parameters
users (an
iterable
ofUserEmail
instances) – The users to be removed from the team.
-
user_is_member
(user)[source]¶ Checks whether the given user is a member of the team. :param user: The user which should be checked for membership :type user:
distro_tracker.accounts.models.User
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
maintainer_email_id
¶
-
owner_id
¶
-
team_membership_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
distro_tracker.core.models.
TeamMembership
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents the intermediary model for the many-to-many association of team members to a
Team
.-
user_email
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
team
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
muted
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
default_keywords
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
has_membership_keywords
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
is_muted
(package_name)[source]¶ Checks if the given package is muted in the team membership. A package is muted if the team membership itself is muted as a whole or if
MembershipPackageSpecifics
for the package indicates that the package is muted.- Parameters
package_name (
PackageName
orstr
) – The name of the package.
-
set_mute_package
(package_name, mute)[source]¶ Sets whether the given package should be considered muted for the team membership.
-
mute_package
(package_name)[source]¶ The method mutes only the given package in the user’s team membership.
- Parameters
package_name (
PackageName
orstr
) – The name of the package.
-
unmute_package
(package_name)[source]¶ The method unmutes only the given package in the user’s team membership.
- Parameters
package_name (
PackageName
orstr
) – The name of the package.
-
set_keywords
(package_name, keywords)[source]¶ Sets the membership-specific keywords for the given package.
- Parameters
package_name (
PackageName
orstr
) – The name of the package for which the keywords should be setkeywords (an
iterable
of keyword names - as strings) – The keywords to be set for the membership-specific keywords for the given package.
-
set_membership_keywords
(keywords)[source]¶ Sets the membership default keywords.
- Parameters
keywords (an
iterable
of keyword names - as strings) – The keywords to be set for the membership
-
get_keywords
(package_name)[source]¶ Returns the keywords that are associated to a particular package of this team membership.
The first set of keywords that exists in the order given below is returned:
Membership package-specific keywords
Membership default keywords
UserEmail default keywords
- Parameters
package_name (
PackageName
orstr
) – The name of the package for which the keywords should be returned- Returns
The keywords which should be used when forwarding mail regarding the given package to the given user for the team membership.
- Return type
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
membership_package_specifics
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
membershipconfirmation_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager object>¶
-
team_id
¶
-
user_email_id
¶
-
-
class
distro_tracker.core.models.
MembershipPackageSpecifics
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents a model for keeping information regarding a pair of (membership, package) instances.
-
membership
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
package_name
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
keywords
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
muted
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
membership_id
¶
-
objects
= <django.db.models.manager.Manager object>¶
-
package_name_id
¶
-
-
class
distro_tracker.core.models.
MembershipConfirmation
(id, confirmation_key, date_created, membership)[source]¶ Bases:
distro_tracker.core.models.Confirmation
-
membership
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
get_next_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)¶
-
get_previous_by_date_created
(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
membership_id
¶
-
-
class
distro_tracker.core.models.
BugDisplayManager
[source]¶ Bases:
object
A class that aims at implementing the logic to handle the multiple ways of displaying bugs data. More specifically, it defines the logic for: * rendering
BugsPanel
* renderingBugStatsTableField
-
table_field_template_name
= 'core/package-table-fields/bugs.html'¶
-
panel_template_name
= 'core/panels/bugs.html'¶
-
table_field_context
(package)[source]¶ This function is used by the
BugStatsTableField
to display the bug information for packages in tables.It should return a dict with the following keys:
bugs
- a list of dicts where each element describes a single bug category for the given package. Each dict has to provide at minimum the following keys:category_name
- the name of the bug categorybug_count
- the number of known bugs for the given package and category
all
- the total number of bugs for that package
-
panel_context
(package)[source]¶ This function is used by the
BugsPanel
to display the bug information for a given package.It should return a list of dicts where each element describes a single bug category for the given package. Each dict has to provide at minimum the following keys:
category_name
: the name of the bug categorybug_count
: the number of known bugs for the given package and category
-
get_binary_bug_stats
(binary_name)[source]¶ This function is used by the
BinariesInformationPanel
to display the bug information next to the binary name.It should return a list of dicts where each element describes a single bug category for the given package.
Each dict has to provide at minimum the following keys:
category_name
- the name of the bug categorybug_count
- the number of known bugs for the given package and category
Optionally, the following keys can be provided:
display_name
- a name for the bug category. It is used by theBinariesInformationPanel
to display a tooltip when mousing over the bug count number.
-
-
class
distro_tracker.core.models.
BugDisplayManagerMixin
[source]¶ Bases:
object
Mixin to another class to provide access to an object of class
BugDisplayManager
.-
property
bug_manager
¶ This function returns the appropriate class for managing the presentation of bugs data.
-
property
-
class
distro_tracker.core.models.
TaskData
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Stores runtime data about tasks to help schedule them and store list of things to process once they have been identified.
-
task_name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
task_is_pending
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
run_lock
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_attempted_run
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
last_completed_run
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
data
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
data_checksum
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
version
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
save
(update_checksum=False, *args, **kwargs)[source]¶ Like the usual ‘save’ method except that you can pass a supplementary keyword parameter to update the ‘data_checksum’ field.
- Parameters
update_checksum (bool) – Computes the checksum of the ‘data’ field and stores it in the ‘data_checksum’ field.
-
versioned_update
(**kwargs)[source]¶ Update the fields as requested through the keyword parameters but do it in a way that avoids corruption through concurrent writes. We rely on the ‘version’ field to update the data only if the version in the database matches the version we loaded.
- Returns
True if the update worked, False otherwise
- Return type
-
get_run_lock
(timeout=1800)[source]¶ Try to grab the run lock associated to the task. Once acquired, the lock will be valid for the number of seconds specified in the ‘timeout’ parameter.
-
extend_run_lock
(delay=1800)[source]¶ Extend the duration of the lock for the given delay. Calling this method when the lock is not yet acquired will raise an exception.
Note that you should always run this outside of any transaction so that the new expiration time is immediately visible, otherwise it might only be committed much later when the transaction ends. The
- Parameters
delay (int) – the number of seconds to add to lock expiration date
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
distro_tracker.core.tasks¶
Implements a framework to run regular tasks.
distro_tracker.core.templatetags.distro_tracker_extras¶
Additional distro-tracker specific template tags.
Bases:
django.template.base.Node
A
Node
for implementing therepeat()
template tag.Renders the contents of the template tag
count
times.
Repeats the string enclosed in the tag the number of times given in the parameter of the tag.
Renders an octicon with alternate text.
Renders a chevron to toggle details.
A convenience template filter to
zip()
two sequences in the template.Using this filter it is possible to iterate through the values of two sequences in the same time in the template itself.
A filter to retrieve values from dictionaries.
The lookup filter can access dictionary entries by their key, where the key can be a variable and not only a literal value. It can be used like this “dictionary|lookup:key” where both “dictionary” and “key” are variables.
A filter that adds <wbr> (word breakpoints) to long words. Useful for very long versions strings that would otherwise cause text overflows in small cells. Returns an empty string when passed None.
distro_tracker.core.utils¶
- distro_tracker.core.utils
- distro_tracker.core.utils.compression
- distro_tracker.core.utils.email_messages
- distro_tracker.core.utils.http
- distro_tracker.core.utils.linkify
- distro_tracker.core.utils.misc
- distro_tracker.core.utils.packages
- distro_tracker.core.utils.plugins
- distro_tracker.core.utils.urls
- distro_tracker.core.utils.verp
Extendable parts of the web interface¶
The set of panels, package tables and package table fields can be extended with new class inheriting from specific classes.
distro_tracker.core.panels¶
Implements the core panels shown on package pages.
-
class
distro_tracker.core.panels.
BasePanel
(package, request)[source]¶ Bases:
object
A base class representing panels which are displayed on a package page.
To include a panel on the package page, users only need to create a subclass and implement the necessary properties and methods.
Note
To make sure the subclass is loaded, make sure to put it in a
tracker_panels
module at the top level of a Django app.-
POSITIONS
= ('left', 'center', 'right')¶
-
property
context
¶ Should return a dictionary representing context variables necessary for the panel. When the panel’s template is rendered, it will have access to the values in this dictionary.
-
property
position
¶ The property should be one of the available
POSITIONS
signalling where the panel should be positioned in the page.
-
property
title
¶ The title of the panel.
-
property
template_name
¶ If the panel has a corresponding template which is used to render its HTML output, this property should contain the name of this template.
-
property
html_output
¶ If the panel does not want to use a template, it can return rendered HTML in this property. The HTML needs to be marked safe or else it will be escaped in the final output.
-
property
panel_importance
¶ Returns and integer giving the importance of a package. The panels in a single column are always positioned in decreasing importance order.
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
plugins
= [<class 'distro_tracker.core.panels.GeneralInformationPanel'>, <class 'distro_tracker.core.panels.VersionsInformationPanel'>, <class 'distro_tracker.core.panels.VersionedLinks'>, <class 'distro_tracker.core.panels.BinariesInformationPanel'>, <class 'distro_tracker.core.panels.LinksPanel'>, <class 'distro_tracker.core.panels.NewsPanel'>, <class 'distro_tracker.core.panels.BugsPanel'>, <class 'distro_tracker.core.panels.ActionNeededPanel'>, <class 'distro_tracker.core.panels.DeadPackageWarningPanel'>]¶
-
classmethod
unregister_plugin
()¶
-
-
distro_tracker.core.panels.
get_panels_for_package
(package, request)[source]¶ A convenience method which accesses the
BasePanel
’s list of children and instantiates them for the given package.- Returns
A dict mapping the page position to a list of Panels which should be rendered in that position.
- Return type
-
class
distro_tracker.core.panels.
GeneralInformationPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
This panel displays general information regarding a package.
name
component
version (in the default repository)
maintainer
uploaders
architectures
standards version
VCS
Several vendor-specific functions can be implemented which augment this panel:
-
position
= 'left'¶
-
title
= 'general'¶
-
template_name
= 'core/panels/general.html'¶
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
class
distro_tracker.core.panels.
VersionsInformationPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
This panel displays the versions of the package in each of the repositories it is found in.
Several vendor-specific functions can be implemented which augment this panel:
-
position
= 'left'¶
-
title
= 'versions'¶
-
template_name
= 'core/panels/versions.html'¶
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
VersionedLinks
(*args, **kwargs)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
A panel displaying links specific for source package versions.
The panel exposes an endpoint which allows for extending the displayed content. This is achieved by implementing a
VersionedLinks.LinkProvider
subclass.-
position
= 'left'¶
-
title
= 'versioned links'¶
-
template_name
= 'core/panels/versioned-links.html'¶
-
class
LinkProvider
[source]¶ Bases:
object
A base class for classes which should provide a list of version specific links.
Subclasses need to define the
icons
property and implement theget_link_for_icon()
method.-
icons
= []¶ A list of strings representing icons for links that the class provides. Each string is an HTML representation of the icon. If the string should be considered safe and rendered in the resulting template without HTML encoding it, it should be marked with
django.utils.safestring.mark_safe()
. It requires each icon to be a string to discourage using complex markup for icons. Using a template is possible by makingicons
a property and rendering the template as string before returning it in the list.
-
get_link_for_icon
(package, icon_index)[source]¶ Return a URL for the given package version which should be used for the icon at the given index in the
icons
property. If no link can be given for the icon,None
should be returned instead.- Return type
string
orNone
-
get_links
(package)[source]¶ For each of the icons returned by the
icons
property, returns a URL specific for the given package.The order of the URLs must match the order of the icons (matching links and icons need to have the same index). Consequently, the length of the returned list is the same as the length of the
icons
property.If no link can be given for some icon,
None
should be put instead.This method has a default implementation which calls the
get_link_for_icon()
for each icon defined in theicons
property. This should be enough for all intents and purposes and the method should not need to be overridden by subclasses.- Parameters
package (
SourcePackage
) – The source package instance for which links should be provided- Returns
List of URLs for the package
- Return type
-
classmethod
get_providers
()[source]¶ Helper classmethod returning a list of instances of all registered
VersionedLinks.LinkProvider
subclasses.
-
plugins
= [<class 'distro_tracker.core.panels.DscLinkProvider'>]¶
-
classmethod
unregister_plugin
()¶
-
-
ALL_ICONS
¶ All icons that the panel displays for each version. Icons must be the same for each version.
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
DscLinkProvider
[source]¶ Bases:
distro_tracker.core.panels.VersionedLinks.LinkProvider
-
icons
= ['<span role="img" aria-label=".dsc, use dget on this link to retrieve source package" class="octicon octicon-desktop-download" title=".dsc, use dget on this link to retrieve source package"><span class="sr-only">[.dsc, use dget on this link to retrieve source package]</span></span>']¶
-
get_link_for_icon
(package, index)[source]¶ Return a URL for the given package version which should be used for the icon at the given index in the
icons
property. If no link can be given for the icon,None
should be returned instead.- Return type
string
orNone
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
BinariesInformationPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
,distro_tracker.core.models.BugDisplayManagerMixin
This panel displays a list of binary package names which a given source package produces.
If there are existing bug statistics for some of the binary packages, a list of bug counts is also displayed.
If implemented, the following functions can augment the information of this panel:
get_package_information_site_url
provides the link used for each binary package name.get_bug_display_manager_class
provides a custom class to handle which bug statistics for a given binary package must be displayed as a list of bug counts for different categories. This is useful if, for example, the vendor wants to display only a small set of categories rather than all stats found in the database. Refer to the function’s documentation for the format of the return value.
-
position
= 'left'¶
-
title
= 'binaries'¶
-
template_name
= 'core/panels/binaries.html'¶
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
class
distro_tracker.core.panels.
PanelItem
[source]¶ Bases:
object
The base class for all items embeddable in panels.
Lets the users define the panel item’s content in two ways:
A template and a context accessible to the template as item.context variable
Define the HTML output directly. This string needs to be marked safe, otherwise it will be HTML encoded in the output.
-
template_name
= None¶ The template to render when this item should be rendered
-
context
= None¶ Context to be available when the template is rendered
-
html_output
= None¶ HTML output to be placed in the page when the item should be rendered
-
class
distro_tracker.core.panels.
TemplatePanelItem
(template_name, context=None)[source]¶ Bases:
distro_tracker.core.panels.PanelItem
A subclass of
PanelItem
which gives a more convenient interface for defining items rendered by a template + context.
-
class
distro_tracker.core.panels.
HtmlPanelItem
(html)[source]¶ Bases:
distro_tracker.core.panels.PanelItem
A subclass of
PanelItem
which gives a more convenient interface for defining items which already provide HTML text. Takes care of marking the given text as safe.-
property
html_output
¶
-
property
-
class
distro_tracker.core.panels.
PanelItemProvider
(package)[source]¶ Bases:
object
A base class for classes which produce
PanelItem
instances.Each panel which wishes to allow clients to register item providers needs a separate subclass of this class.
-
classmethod
all_panel_item_providers
()[source]¶ Returns all subclasses of the given
PanelItemProvider
subclass.Makes it possible for each
ListPanel
to have its own separate set of providers derived from its base ItemProvider.
-
get_panel_items
()[source]¶ The main method which needs to return a list of
PanelItem
instances which the provider wants rendered in the panel.
-
plugins
= [<class 'distro_tracker.core.panels.ListPanelItemProvider'>, <class 'distro_tracker.core.panels.LinksPanelItemProvider'>, <class 'distro_tracker.core.panels.GeneralInfoLinkPanelItems'>]¶
-
classmethod
unregister_plugin
()¶
-
classmethod
-
class
distro_tracker.core.panels.
ListPanelMeta
(name, bases, attrs)[source]¶ Bases:
distro_tracker.core.utils.plugins.PluginRegistry
A meta class for the
ListPanel
. Makes sure that each subclass ofListPanel
has a newPanelItemProvider
subclass.
-
class
distro_tracker.core.panels.
ListPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
The base class for panels which would like to present an extensible list of items.
The subclasses only need to add the
position
andtitle
attributes, the rendering is handled automatically, based on the registered list of item providers for the panel.Clients can add items to the panel by implementing a subclass of the
ListPanel.ItemProvider
class.It is possible to change the
template_name
too, but making sure all the same context variable names are used in the custom template.-
template_name
= 'core/panels/list-panel.html'¶
-
get_items
()[source]¶ Returns a list of
PanelItem
instances for the current panel instance. This means the items are prepared for the package given to the panel instance.
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
ItemProvider
¶ alias of
distro_tracker.core.panels.ListPanelItemProvider
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
LinksPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.ListPanel
This panel displays a list of important links for a given source package.
Clients can add items to the panel by implementing a subclass of the
LinksPanel.ItemProvider
class.-
position
= 'right'¶
-
title
= 'links'¶
-
class
SimpleLinkItem
(text, url, title=None)[source]¶ Bases:
distro_tracker.core.panels.HtmlPanelItem
A convenience
PanelItem
which renders a simple link in the panel, by having the text, url and, optionally, the tooltip text given in the constructor.-
TEMPLATE
= '<a href="{url}">{text}</a>'¶
-
TEMPLATE_TOOLTIP
= '<a href="{url}" title="{title}">{text}</a>'¶
-
-
ItemProvider
¶ alias of
distro_tracker.core.panels.LinksPanelItemProvider
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
GeneralInfoLinkPanelItems
(package)[source]¶ Bases:
distro_tracker.core.panels.LinksPanelItemProvider
Provides the
LinksPanel
with links derived from general package information.For now, this is only the homepage of the package, if available.
-
get_panel_items
()[source]¶ The main method which needs to return a list of
PanelItem
instances which the provider wants rendered in the panel.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
NewsPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
-
panel_importance
= 1¶
-
NEWS_LIMIT
= 30¶
-
template_name
= 'core/panels/news.html'¶
-
title
= 'news'¶
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
BugsPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
,distro_tracker.core.models.BugDisplayManagerMixin
The panel displays bug statistics for the package.
This panel is highly customizable to make sure that Distro Tracker can be integrated with any bug tracker.
The default for the package is to display the bug count for all bug categories found in the
PackageBugStats
instance which corresponds to the package. The sum of all bugs from all categories is also displayed as the first row of the panel. Such behavior is defined byBugDisplayManager
class.A vendor may provide a custom way of displaying bugs data in bugs panel by implementing
get_bug_display_manager_class
function. This is useful if, for example, the vendor does not want to display the count of all bug categories. Refer to the function’s documentation for the format of the return value.This customization should be used only by vendors whose bug statistics have a significantly different format than the expected
category: count
format.-
position
= 'right'¶
-
title
= 'bugs'¶
-
panel_importance
= 1¶
-
property
template_name
¶ If the panel has a corresponding template which is used to render its HTML output, this property should contain the name of this template.
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
ActionNeededPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
The panel displays a list of
ActionItem
model instances which are associated with the package.This means that all other modules can create action items which are displayed for a package in this panel by creating instances of that class.
-
title
= 'action needed'¶
-
template_name
= 'core/panels/action-needed.html'¶
-
panel_importance
= 5¶
-
position
= 'center'¶
-
context
¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.panels.
DeadPackageWarningPanel
(package, request)[source]¶ Bases:
distro_tracker.core.panels.BasePanel
The panel displays a warning when the package has been dropped from development repositories, and another one when the package no longer exists in any repository.
-
title
= 'package is gone'¶
-
template_name
= 'core/panels/package-is-gone.html'¶
-
panel_importance
= 9¶
-
position
= 'center'¶
-
property
has_content
¶ Returns a bool indicating whether the panel actually has any content to display for the package.
-
context
¶
-
classmethod
unregister_plugin
()¶
-
distro_tracker.core.package_tables¶
Implements the core package tables shown on team pages.
-
class
distro_tracker.core.package_tables.
BaseTableField
[source]¶ Bases:
object
A base class representing fields to be displayed on package tables.
To create a new field for packages table, users only need to create a subclass and implement the necessary properties and methods.
Note
To make sure the subclass is loaded, make sure to put it in a
tracker_package_tables
module at the top level of a Django app.-
context
(package)[source]¶ Should return a dictionary representing context variables necessary for the package table field. When the field’s template is rendered, it will have access to the values in this dictionary.
-
property
column_name
¶ The column name for the field
-
property
template_name
¶ If the field has a corresponding template which is used to render its HTML output, this property should contain the name of this template.
-
render
(package, context=None, request=None)[source]¶ Render the field’s HTML output for the given package.
Returns a list of lookups to be prefetched along with Table’s QuerySet of packages. Elements may be either a String or Prefetch object
-
plugins
= [<class 'distro_tracker.core.package_tables.GeneralInformationTableField'>, <class 'distro_tracker.core.package_tables.VcsTableField'>, <class 'distro_tracker.core.package_tables.ArchiveTableField'>, <class 'distro_tracker.core.package_tables.BugStatsTableField'>]¶
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.package_tables.
GeneralInformationTableField
[source]¶ Bases:
distro_tracker.core.package_tables.BaseTableField
This table field displays general information to identify a package.
It displays the package’s name in the cell and the following information on details popup - name - short description - version (in the default repository) - maintainer - uploaders - architectures - standards version - binaries
-
column_name
= 'Package'¶
-
slug
= 'general'¶
-
template_name
= 'core/package-table-fields/general.html'¶
-
context
(package)[source]¶ Should return a dictionary representing context variables necessary for the package table field. When the field’s template is rendered, it will have access to the values in this dictionary.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.package_tables.
VcsTableField
[source]¶ Bases:
distro_tracker.core.package_tables.BaseTableField
This table field displays information regarding the package VCS repository. It is customizable to enable vendors to add specific data regarding the package’s vcs repository.
The default behavior is to display the package’s repository type with a (browser) link to it.
A vendor can provide a
DISTRO_TRACKER_VCS_TABLE_FIELD_TEMPLATE
settings value which gives the path to a template which should be used to render the field. It is recommended that this template extendscore/package-table-fields/vcs.html
, but not mandatory. If a customget_vcs_data
function in order to provide custom data to be displayed in the field. Refer to the function’s documentation for the format of the return value. If this function is defined then its return value is simply passed to the template and does not require any special format; the vendor’s template can access this value in thefield.context
context variable and can use it any way it wants.To avoid performance issues, if
get_vcs_data
function depends on data from other database tables than packages, the vendor app should also implement theadditional_prefetch_related_lookups
-
column_name
= 'VCS'¶
-
slug
= 'vcs'¶
-
property
template_name
¶ If the field has a corresponding template which is used to render its HTML output, this property should contain the name of this template.
-
context
(package)[source]¶ Should return a dictionary representing context variables necessary for the package table field. When the field’s template is rendered, it will have access to the values in this dictionary.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.package_tables.
ArchiveTableField
[source]¶ Bases:
distro_tracker.core.package_tables.BaseTableField
This table field displays information regarding the package version on archive.
It displays the package’s version on archive
-
column_name
= 'Archive'¶
-
slug
= 'archive'¶
-
template_name
= 'core/package-table-fields/archive.html'¶
-
context
(package)[source]¶ Should return a dictionary representing context variables necessary for the package table field. When the field’s template is rendered, it will have access to the values in this dictionary.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.package_tables.
BugStatsTableField
[source]¶ Bases:
distro_tracker.core.package_tables.BaseTableField
,distro_tracker.core.models.BugDisplayManagerMixin
This table field displays bug statistics for the package. It is customizable to enable vendors to add specific data.
The default behavior defined by
BugDisplayManager
is to display the number of bugs for a package. It also shows the bugs categories on popover content.A vendor may provide a custom way of displaying bugs data in packages tables by implementing
get_bug_display_manager_class
function in order to provide a custom class to handle the bugs data presentation. Refer to the function’s documentation for the format of the return value.To avoid performance issues, if additional database lookups are required to display custom bugs data, the vendor app should also implement the
additional_prefetch_related_lookups
-
column_name
= 'Bugs'¶
-
slug
= 'bugs'¶
-
property
template_name
¶ If the field has a corresponding template which is used to render its HTML output, this property should contain the name of this template.
-
context
(package)[source]¶ Should return a dictionary representing context variables necessary for the package table field. When the field’s template is rendered, it will have access to the values in this dictionary.
-
classmethod
unregister_plugin
()¶
-
-
class
distro_tracker.core.package_tables.
BasePackageTable
(scope, title=None, limit=None, tag=None)[source]¶ Bases:
object
A base class representing package tables which are displayed on a team page.
To include a package table on the team page, users only need to create a subclass and implement the necessary properties and methods.
Note
To make sure the subclass is loaded, make sure to put it in a
tracker_package_tables
module at the top level of a Django app.The following vendor-specific functions can be implemented to augment this table:
-
slug
= None¶ The slug of the table which is used to define its url. Must be overriden and set to a unique non-empty value.
-
context
()[source]¶ Should return a dictionary representing context variables necessary for the package table. When the table’s template is rendered, it will have access to the values in this dictionary.
-
property
default_title
¶ The default title of the table.
-
property
title
¶ The title of the table.
-
property
relative_url
¶ The relative url for the table.
Returns the list of packages with prefetched relationships defined by table fields
-
property
packages
¶ Returns the list of packages shown in the table. One may define this based on the scope
-
property
column_names
¶ Returns a list of column names that will compose the table in the proper order
-
property
default_fields
¶ Returns a list of default
BaseTableField
that will compose the table
-
property
table_fields
¶ Returns the tuple of
BaseTableField
that will compose the table
-
property
rows
¶ Returns the content of the table’s rows, where each row has the list of
BaseTableField
for each package
-
property
number_of_packages
¶ Returns the number of packages displayed in the table
-
plugins
= [<class 'distro_tracker.core.package_tables.GeneralTeamPackageTable'>]¶
-
classmethod
unregister_plugin
()¶
-
-
distro_tracker.core.package_tables.
create_table
(slug, scope, title=None, limit=None, tag=None)[source]¶ A helper function to create packages table. The table class is defined through the slug. If no children class of
BasePackageTable
exists with the given slug, the function returns None.- Returns
an instance of the table created with the informed params
- Return type
-
class
distro_tracker.core.package_tables.
GeneralTeamPackageTable
(scope, title=None, limit=None, tag=None)[source]¶ Bases:
distro_tracker.core.package_tables.BasePackageTable
This table displays the packages information of a team in a simple fashion. It must receive a
Team
as scope-
default_title
= 'All team packages'¶
-
slug
= 'general'¶
-
property
packages
¶ Returns the list of packages shown in the table of a team (scope)
-
classmethod
unregister_plugin
()¶
-
Web interface implementation¶
distro_tracker.core.admin¶
Settings for the admin panel for the models defined in the
distro_tracker.core
app.
-
distro_tracker.core.admin.
validate_sources_list_entry
(value)[source]¶ A custom validator for the sources.list entry form field.
Makes sure that it follows the correct syntax and that the specified Web resource is available.
- Parameters
value – The value of the sources.list entry which needs to be validated
- Raises
ValidationError – Giving the validation failure message.
-
class
distro_tracker.core.admin.
RepositoryAdminForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
A custom
ModelForm
used for creating and modifyingRepository
model instances.The class adds the ability to enter only a sources.list entry describing the repository and other properties of the repository are automatically filled in by using the
Release
file of the repository.-
sources_list_entry
¶ The additional form field which allows entring the sources.list entry
-
clean
(*args, **kwargs)[source]¶ Overrides the
clean
method of the parent class to allow validating the form based on the sources.list entry, not only the model fields.
-
base_fields
= {'architectures': <django.forms.models.ModelMultipleChoiceField object>, 'binary': <django.forms.fields.BooleanField object>, 'codename': <django.forms.fields.CharField object>, 'components': <django.forms.fields.CharField object>, 'default': <django.forms.fields.BooleanField object>, 'flags': <django.forms.fields.MultipleChoiceField object>, 'name': <django.forms.fields.CharField object>, 'optional': <django.forms.fields.BooleanField object>, 'public_uri': <django.forms.fields.URLField object>, 'shorthand': <django.forms.fields.CharField object>, 'source': <django.forms.fields.BooleanField object>, 'sources_list_entry': <django.forms.fields.CharField object>, 'suite': <django.forms.fields.CharField object>, 'uri': <django.forms.fields.CharField object>}¶
-
declared_fields
= {'flags': <django.forms.fields.MultipleChoiceField object>, 'sources_list_entry': <django.forms.fields.CharField object>}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
-
class
distro_tracker.core.admin.
RepositoryAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Actual configuration for the
Repository
admin panel.-
class
Media
[source]¶ Bases:
object
Add extra Javascript resources to the page in order to support drag-and-drop repository position modification.
-
js
= ('js/jquery.min.js', 'js/jquery-ui.min.js', 'js/admin-list-reorder.js')¶
-
-
form
¶
-
fieldsets
= [(None, {'fields': ['name', 'shorthand']}), ('sources.list entry', {'fields': ['sources_list_entry']}), ('Repository information', {'fields': ['uri', 'public_uri', 'codename', 'suite', 'components', 'architectures', 'default', 'optional', 'binary', 'source']}), ('Repository flags', {'fields': ['flags']})]¶
-
list_display
= ('name', 'shorthand', 'codename', 'uri', 'components_string', 'architectures_string', 'default', 'optional', 'binary', 'source', 'position', 'flags_string')¶ Gives a list of fields which should be displayed as columns in the list of existing
Repository
instances.
-
ordering
= ('position',)¶
-
list_editable
= ('position',)¶
-
components_string
(obj)[source]¶ Helper method for displaying Repository objects. Turns the components list into a display-friendly string.
- Parameters
obj (
Repository
) – The repository whose components are to be formatted
-
architectures_string
(obj)[source]¶ Helper method for displaying Repository objects. Turns the architectures list into a display-friendly string.
- Parameters
obj (
Repository
) – The repository whose architectures are to be formatted
-
property
media
¶
-
class
-
class
distro_tracker.core.admin.
RepositoryRelationAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin
Actual configuration for the
Repository
admin panel.-
list_display
= ('repository', 'name', 'target_repository')¶
-
property
media
¶
-
distro_tracker.core.context_processors¶
Implements Django context processors specific to Distro Tracker.
-
distro_tracker.core.context_processors.
DISTRO_TRACKER_EXTRAS
= {'DISTRO_TRACKER_CONTACT_EMAIL': 'owner@tracker.example.net', 'DISTRO_TRACKER_CONTROL_EMAIL': 'control@tracker.example.net', 'DISTRO_TRACKER_SITE_DOMAIN': 'tracker.example.net', 'DISTRO_TRACKER_VENDOR_NAME': 'Example', 'DISTRO_TRACKER_VENDOR_URL': 'http://www.example.net'}¶ Defines a dictionary of all Distro Tracker extra context key/value pairs that are to be included in the
RequestContext
.
-
distro_tracker.core.context_processors.
extras
(request)[source]¶ The context processor which includes the
DISTRO_TRACKER_EXTRAS
in theRequestContext
.
distro_tracker.core.forms¶
Forms for the distro_tracker.core
app.
-
class
distro_tracker.core.forms.
CreateTeamForm
(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm
-
class
Meta
[source]¶ Bases:
object
-
model
¶ alias of
distro_tracker.core.models.Team
-
fields
= ('name', 'slug', 'public', 'description', 'url')¶
-
labels
= {'public': 'Visible in the list of teams and free to join by anyone'}¶
-
help_texts
= {'slug': 'Used in the URL (/teams/<em>identifier</em>/) and in the associated email address team+<em>identifier</em>@tracker.example.net.'}¶
-
-
clean
()[source]¶ Provides a default value for the slug field based on the given team name, but only if the team is only just being created (not an update of an existing instance).
-
save
(*args, **kwargs)[source]¶ Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.
-
base_fields
= {'description': <django.forms.fields.CharField object>, 'maintainer_email': <django.forms.fields.EmailField object>, 'name': <django.forms.fields.CharField object>, 'public': <django.forms.fields.BooleanField object>, 'slug': <django.forms.fields.SlugField object>, 'url': <django.forms.fields.URLField object>}¶
-
declared_fields
= {'maintainer_email': <django.forms.fields.EmailField object>}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
class
-
class
distro_tracker.core.forms.
AddTeamMemberForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.forms.Form
-
base_fields
= {'email': <django.forms.fields.EmailField object>}¶
-
declared_fields
= {'email': <django.forms.fields.EmailField object>}¶
-
property
media
¶ Return all media required to render the widgets on this form.
-
distro_tracker.core.news_feed¶
Implements the RSS news feed.
-
distro_tracker.core.news_feed.
filter_control_chars
(method)[source]¶ Filter out undesirable control characters.
distro_tracker.core.views¶
Views for the distro_tracker.core
app.
-
distro_tracker.core.views.
package_page_redirect
(request, package_name)[source]¶ Catch-all view which tries to redirect the user to a package page
-
distro_tracker.core.views.
legacy_package_url_redirect
(request, package_hash, package_name)[source]¶ Redirects access to URLs in the form of the “old” PTS package URLs to the new package URLs.
Note
The “old” package URL is: /<hash>/<package_name>.html
-
class
distro_tracker.core.views.
PackageSearchView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
A view which responds to package search queries.
-
class
distro_tracker.core.views.
OpenSearchDescription
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
Return the open search description XML document allowing browsers to launch searches on the website.
-
class
distro_tracker.core.views.
PackageAutocompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
A view which responds to package auto-complete queries.
Renders a JSON list of package names matching the given query, meaning their name starts with the given query parameter.
-
distro_tracker.core.views.
news_page
(request, news_id, slug='')[source]¶ Displays a news item’s full content.
-
class
distro_tracker.core.views.
PackageNews
(**kwargs)[source]¶ Bases:
django.views.generic.list.ListView
A view which lists all the news of a package.
-
NEWS_LIMIT
= 30¶
-
paginate_by
= 30¶
-
template_name
= 'core/package_news.html'¶
-
context_object_name
= 'news'¶
-
-
class
distro_tracker.core.views.
ActionItemJsonView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
View renders a
distro_tracker.core.models.ActionItem
in a JSON response.
-
class
distro_tracker.core.views.
ActionItemView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
View renders a
distro_tracker.core.models.ActionItem
in an HTML response.
-
distro_tracker.core.views.
legacy_rss_redirect
(request, package_hash, package_name)[source]¶ Redirects old package RSS news feed URLs to the new ones.
-
class
distro_tracker.core.views.
CreateTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.edit.FormView
-
model
¶ alias of
distro_tracker.core.models.Team
-
template_name
= 'core/team-create.html'¶
-
form_class
¶
-
-
class
distro_tracker.core.views.
TeamDetailsView
(**kwargs)[source]¶ Bases:
django.views.generic.detail.DetailView
-
model
¶ alias of
distro_tracker.core.models.Team
-
template_name
= 'core/team.html'¶
-
table_limit
= 20¶
-
-
class
distro_tracker.core.views.
DeleteTeamView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.DeleteView
-
model
¶ alias of
distro_tracker.core.models.Team
-
success_url
= '/teams/+delete-success/'¶
-
template_name
= 'core/team-confirm-delete.html'¶
-
-
class
distro_tracker.core.views.
UpdateTeamView
(**kwargs)[source]¶ Bases:
django.views.generic.edit.UpdateView
-
model
¶ alias of
distro_tracker.core.models.Team
-
form_class
¶
-
template_name
= 'core/team-update.html'¶
-
-
class
distro_tracker.core.views.
AddPackageToTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
-
class
distro_tracker.core.views.
RemovePackageFromTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
-
class
distro_tracker.core.views.
JoinTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
Lets logged in users join a public team.
After a user has been added to the team, redirect them back to the team page.
-
template_name
= 'core/team-join-choose-email.html'¶
-
-
class
distro_tracker.core.views.
LeaveTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
Lets logged in users leave teams they are a part of.
-
class
distro_tracker.core.views.
ManageTeam
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.list.ListView
Provides the team owner a method to manually add/remove members of the team.
-
template_name
= 'core/team-manage.html'¶
-
paginate_by
= 20¶
-
context_object_name
= 'members_list'¶
-
-
class
distro_tracker.core.views.
RemoveTeamMember
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
-
class
distro_tracker.core.views.
AddTeamMember
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
-
class
distro_tracker.core.views.
TeamListView
(**kwargs)[source]¶ Bases:
django.views.generic.list.ListView
-
queryset
¶
-
paginate_by
= 20¶
-
template_name
= 'core/team-list.html'¶
-
context_object_name
= 'team_list'¶
-
-
class
distro_tracker.core.views.
SetMuteTeamView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
The view lets users mute or unmute a team membership or a particular package in the membership.
-
action
= 'mute'¶
-
-
class
distro_tracker.core.views.
SetMembershipKeywords
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.base.View
The view lets users set either default membership keywords or package-specific keywords.
-
class
distro_tracker.core.views.
EditMembershipView
(**kwargs)[source]¶ Bases:
django_email_accounts.views.LoginRequiredMixin
,django.views.generic.list.ListView
-
template_name
= 'core/edit-team-membership.html'¶
-
paginate_by
= 20¶
-
context_object_name
= 'package_list'¶
-
-
class
distro_tracker.core.views.
TeamAutocompleteView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
A view which responds to team auto-complete queries.
Renders a JSON list of team names matching the given query, meaning their name contains the given query parameter.
-
class
distro_tracker.core.views.
TeamSearchView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
A view which responds to team search queries.
-
class
distro_tracker.core.views.
TeamPackagesTableView
(**kwargs)[source]¶ Bases:
django.views.generic.base.View
View renders a
distro_tracker.core.package_tables.BasePackageTable
in an HTML response.-
template_name
= 'core/team-packages-table.html'¶
-