l.s.l.i.ILibraryFileAlias(Interface) : interface documentation

Part of lp.services.librarian.interfaces View In Hierarchy

Known subclasses: lp.services.librarian.interfaces.ILibraryFileAliasWithParent

No interface docstring
Int id Undocumented
Datetime date_created Undocumented
Attribute content Library file content
TextLine filename Undocumented
TextLine mimetype Undocumented
Datetime expires When file can be removed. Set to None if the file
Int hits Undocumented
Datetime last_downloaded Undocumented
Bool restricted If the file is restricted, it can only be retrieved through the restricted librarian.
Attribute deleted Is this file deleted.
Attribute http_url The http URL to this file
Attribute https_url The https URL to this file
Attribute private_url The secure URL to this file (private files)
Method getURL Return this file's http or https URL.
Method open Open this file for reading.
Method read Read up to chunksize bytes from the file.
Method close Close this file.
Method updateDownloadCount Update this file's download count for the given country and day.
id =
Undocumented
date_created =
Undocumented
content =
Library file content
filename =
Undocumented
mimetype =
Undocumented
expires =
When file can be removed. Set to None if the file should only be removed when it is no longer referenced in the database. Set it to NEVER_EXPIRES to keep it in the Librarian permanently.
hits =
Undocumented
last_downloaded =
Undocumented
restricted =
If the file is restricted, it can only be retrieved through the restricted librarian.
deleted =
Is this file deleted.
http_url =
The http URL to this file
https_url =
The https URL to this file
private_url =
The secure URL to this file (private files)
def getURL(secure=True, include_token=False):
Return this file's http or https URL.

If the file is a restricted file, the private_url will be returned, which is on https and uses unique domains per file alias.

Parameterssecuregenerate HTTPS URLs if the use_https config variable is set, in order to prevent warnings about insecure objects from happening in some browsers (this is used for, e.g., branding).
include_tokencreate a time-limited token and include it in the URL to authorise access to restricted files.
def open(timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT):
Open this file for reading.
ParameterstimeoutThe number of seconds the method retries to open a connection to the Librarian server. If the connection cannot be established in the given time, a LibrarianServerError is raised.
ReturnsNone
def read(chunksize=None, timeout=LIBRARIAN_SERVER_DEFAULT_TIMEOUT):
Read up to chunksize bytes from the file.
ParameterschunksizeThe maximum number of bytes to be read. Defaults to the entire file.
timeoutThe number of seconds the method retries to open a connection to the Librarian server. If the connection cannot be established in the given time, a LibrarianServerError is raised.
Returnsthe data read from the Librarian file.
def close():
Close this file.
def updateDownloadCount(day, country, count):
Update this file's download count for the given country and day.

If there's no ILibraryFileDownloadCount entry for this file, and the given day/country, we create one with the given count. Otherwise we just increase the count of the existing one by the given count.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.