Part of canonical.launchpad.interfaces.librarian View In Hierarchy
Known subclasses: canonical.launchpad.interfaces.librarian.ILibraryFileAliasWithParent
Known implementations: canonical.launchpad.database.librarian.LibraryFileAlias, lp.code.browser.codereviewcomment.DiffAttachment
| Int | id | Undocumented |
| Datetime | date_created | Undocumented |
| Attribute | content | Library file content |
| TextLine | filename | Undocumented |
| TextLine | mimetype | Undocumented |
| Datetime | last_accessed | 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. |
If the file is a restricted file, the private_url will be returned, which is on https and uses unique domains per file alias.
The generated URL will be https 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).
If config.launchpad.virtual_host.use_https is set, then return the https URL. Otherwise return the http URL.
| Parameters | timeout | The 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. |
| Returns | None | |
chunksize bytes from the file.| Parameters | chunksize | The maximum number of bytes to be read. Defaults to the entire file. |
| timeout | The 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. | |
| Returns | the data read from the Librarian file. | |
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.