Package gavo :: Package protocols :: Module products :: Class RAccref
[frames] | no frames]

Class RAccref

source code

object --+
         |
        RAccref

A product key including possible modifiers.

The product key is in the accref attribute.

The modifiers come in the params dictionary. It contains (typed) values, the possible keys of which are given in _buildKeys. The values in passed in the inputDict constructor argument are parsed, anything not in _buildKeys is discarded.

In principle, these modifiers are just the query part of a URL, and they generally come from the arguments of a web request. However, we don't want to carry around all request args, just those meant for product generation.

One major reason for having this class is serialization into URL-parts. Basically, stringifying a RAccref yields something that can be pasted to <server root>/getproduct to yield the product URL. For the path part, this means just percent-escaping blanks, plusses and percents in the file name. The parameters are urlencoded and appended with a question mark. This representation is be parsed by the fromString function.

RAccrefs have a (read only) property productsRow attribute -- that's a dictionary containing the row for accres from //products#products if that exists. If it doesn't, accessing the property will raise an NotFoundError.

Instance Methods
 
__init__(self, accref, inputDict={})
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code
 
__eq__(self, other) source code
 
__ne__(self, other) source code
 
previewIsCacheable(self)
returns True if the a preview generated for this rAccref is representative for all representative rAccrefs.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods
 
fromPathAndArgs(cls, path, args)
returns a rich accref from a path and a parse_qs-dictionary args.
source code
 
fromRequest(cls, path, request)
returns a rich accref from a nevow request.
source code
 
fromString(cls, keyString)
returns a fat product key from a string representation.
source code
Properties
  productsRow
returns the row in dc.products corresponding to this RAccref's accref, or raises a NotFoundError.
  localpath

Inherited from object: __class__

Method Details

__init__(self, accref, inputDict={})
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

fromPathAndArgs(cls, path, args)
Class Method

source code 

returns a rich accref from a path and a parse_qs-dictionary args.

(it's mainly a helper for fromRequest and fromString).

fromRequest(cls, path, request)
Class Method

source code 

returns a rich accref from a nevow request.

Basically, it raises an error if there's no key at all, it will return a (string) accref if no processing is desired, and it will return a RAccref if any processing is requested.

fromString(cls, keyString)
Class Method

source code 

returns a fat product key from a string representation.

As a convenience, if keyString already is a RAccref, it is returned unchanged.

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

previewIsCacheable(self)

source code 

returns True if the a preview generated for this rAccref is representative for all representative rAccrefs.

Basically, scaled versions all have the same preview, cutouts do not.


Property Details

productsRow

returns the row in dc.products corresponding to this RAccref's accref, or raises a NotFoundError.

Get Method:
unreachable.productsRow(self) - returns the row in dc.products corresponding to this RAccref's accref, or raises a NotFoundError.

localpath

Get Method:
unreachable.localpath(self)