Skip to content

Permit transformation of common symbols to their names. #3

@amcgregor

Description

@amcgregor

Certain common symbols may occur and be desirable to process within an object dispatch endpoint hierarchy. For example, to handle application delivery of certain static assets such as a favicon.ico or programmatic generation of a sitemap.xml. Currently, "filename extensions" aren't matchable to attributes.

Example transformations:

  • ._dot_
  • -_hyphen_
  • ~_tilde_
  • :_colon_

It may be sensible to… abbreviate some of these. With the downside that it becomes impossible to differentiate between an actual _ and a hyphen, and ambiguity between . and -.

  • ._
  • -_
  • :__

Where replacements occurring at the end will have trailing underscores elided, and if any replacements are made, the attribute name evaluated will always begin with a single underscore, to prevent access from multiple URI. (E.g. requesting /favicon.ico serving the same content as /favicon_dot_ico.)

Thus, under WebCore, to "statically" serve a favicon.ico:

class Root:
	_favicon_dot_ico = open('favicon.ico', 'rb')

To handle a "home folder" reference:

class Root:
	_tilde_amcgregor = "Hi there."

To handle class-based sub-resources:

class Root:
	def _action_colon_create(self): ...
	def _view_colon_thumbnails(self): ...

Or, with abbreviation:

class Root:
	def _action__create(self): ...
	def _view__thumbnails(self): ...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions