~cjwatson/lazr.restful/range-factory

« back to all changes in this revision

Viewing changes to src/lazr/restful/fields.py

  • Committer: Colin Watson
  • Date: 2015-04-09 19:53:24 UTC
  • Revision ID: cjwatson@canonical.com-20150409195324-z5rmzks7ofuouegn
Allow declaring a custom range factory for use with returned collections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    # semantics for this class.
26
26
    implements(ICollectionField)
27
27
 
28
 
    def __init__(self, *args, **kwargs):
 
28
    def __init__(self, range_factory_class=None, *args, **kwargs):
29
29
        """A generic collection field.
30
30
 
31
31
        The readonly property defaults to True since these fields are usually
34
34
        """
35
35
        kwargs.setdefault('readonly', True)
36
36
        super(CollectionField, self).__init__(*args, **kwargs)
 
37
        self.range_factory_class = range_factory_class
37
38
 
38
39
 
39
40
class Reference(Object):