pyroxy.controllers.simple

pyroxy.controllers.simple.asbool(val)[source]

Attempts to coerce val to a boolean value. This is largely based off of paste.deploy.converters.asbool() with a few stylistic tweaks added.

Raises a ValueError if the specified value cannot be coerced to a True or False value.

pyroxy.controllers.simple.filter_index(index_path)[source]

Path to an index page (index.html, typically). This function will parse the results into an lxml tree, call remove_links() on the resulting tree, and then convert it back to an HTML page.

Parameters:index_path – Absolute path to the index file. This MUST already be created, and must be a file.
Returns:An lxml formatted HTML page as a string, containing the final, filtered version of the page. If the file could not be opened, a 404 exception will be raised.
pyroxy.controllers.simple.package_list(package_name)[source]

Controller used to serve up a package listing.

Parameters:package_name – Name of the Python package to retrieve and filter the simple page for. Capitalization matters, depending on your operating system–i.e., on Linux, pylons != Pylons.
Returns:The raw simple page if the package was whitelisted, or a filtered page if it was not.

Predicate used to filter external download links. Currently, the only config value is allowed_extensions.

Parameters:
  • href – Absolute URL pointing to a downloadable file on a third-party web site.
  • title – Text component of the link from the simple page. This can include suffixes such as download_url and home_page, which can be used as part of the filter.
Returns:

True if the external download link should be included in the output, False otherwise.

pyroxy.controllers.simple.pred_filter_home_pages(href, title)[source]

Predicate used to filter home pages.

Parameters:
  • href – Absolute URL to a home page (i.e., a third party site)
  • title – Text component of the link from the simple page. This can include suffixes such as download_url and home_page, which can be used as part of the filter.
Returns:

True if the home page link should be included in the output, False otherwise.

Predicate used to filter internal download links. Currently, the only config value is allowed_extensions.

Parameters:
  • href – Relative URL generated from the simple page (i.e., ../../packages/a/b/c/pyroxy-0.1.tar.gz)
  • title – Text component of the link from the simple page. This can include suffixes such as download_url and home_page, which can be used as part of the filter.
Returns:

True if the internal download link should be included in the output, False otherwise.

Filters out links based on the various predicates. Unfortunately, right now, the predicates aren’t configurable.

Parameters:html_treelxml.tree representing the simple page.

Returns a modified lxml.tree with specific links filtered out.

Project Versions

Previous topic

pyroxy.config

Next topic

pyroxy.controllers.static

This Page