nti.externalization.factory: Object factories
Implementations of object factories.
Added in version 1.0.
- class AnonymousObjectFactory(callable=None, title='', description='', interfaces=None)[source]
Bases:
ObjectFactoryDefault implementation of
IAnonymousObjectFactory.Added in version 1.0a3.
- class ClassObjectFactory(callable=None, title='', description='', interfaces=None)[source]
Bases:
ObjectFactoryDefault implementation of
IClassObjectFactory.
- class MimeObjectFactory(callable=None, title='', description='', interfaces=None)[source]
Bases:
ObjectFactoryDefault implementation of
IMimeObjectFactory.
- class ObjectFactory(callable=None, title='', description='', interfaces=None)[source]
Bases:
FactoryA convenient
zope.component.interfaces.IFactorymeant to be registered as a named utility.The callable object SHOULD be a type/class object, because that’s the only thing we base equality off of (class identity).
This class can be subclassed and trivially instantiated by setting class properties
default_factoryand (optionally)default_titleanddefault_description. Constructor arguments will override these, but if not given, the class values will be used.For example:
>>> class MyObjectFactory(ObjectFactory): ... default_factory = object ... default_title = 'A Title' ... default_description = 'A Description' >>> factory = MyObjectFactory() >>> factory <MyObjectFactory titled 'A Title' using <... 'object'> producing []> >>> print(factory.title) A Title >>> print(factory.description) A Description
- default_description = ''
The default description, if none is given to the constructor.
- default_factory: Callable[[Any], Any] | None = None
The default callable argument, if none is given to the constructor.
- default_title = ''
The default title, if none is given to the constructor.