Fix Domain Model code example.
Tried running the code in the Domain Model examples in Glance docs and realized it didn't work out of the box due to some minor errors. Change-Id: Id4be33184e1729293b9cd9c91b8d0ab10ee41280
This commit is contained in:
parent
aa42287992
commit
5b9482af94
@ -228,7 +228,7 @@ previous example. It specifies a ``BaseFactory`` class with a
|
||||
|
||||
class LoggerFactory(object):
|
||||
"""Proxy class to add logging functionality."""
|
||||
def __init__(self, base, proxy_class=None, proxy_kwargs=None):
|
||||
def __init__(self, base, logg, proxy_class=None, proxy_kwargs=None):
|
||||
self.helper = Helper(proxy_class, proxy_kwargs)
|
||||
self.base = base
|
||||
self.logg = logg
|
||||
@ -256,7 +256,7 @@ together:
|
||||
|
||||
def create_factory(logg, only_positive=True):
|
||||
base_factory = BaseFactory()
|
||||
logger_factory = LoggerFactory(base_factory,
|
||||
logger_factory = LoggerFactory(base_factory, logg,
|
||||
proxy_class=LoggerProxy,
|
||||
proxy_kwargs=dict(logg=logg))
|
||||
validator_factory = ValidatorFactory(logger_factory, only_positive,
|
||||
@ -270,7 +270,7 @@ class.
|
||||
|
||||
::
|
||||
|
||||
factory = create_factory(logg, only_positive=False)
|
||||
factory = create_factory(sys.stdout, only_positive=False)
|
||||
domain_object = factory.generate()
|
||||
|
||||
Why do you need a domain if you can use decorators?
|
||||
|
Loading…
Reference in New Issue
Block a user