diff --git a/composer/README.txt b/composer/README.txt index 475ee63..6073211 100644 --- a/composer/README.txt +++ b/composer/README.txt @@ -5,7 +5,7 @@ Composer - Building Complex Structures with Templates or Schemas ($Id$) >>> from cybertools.composer.base import Element, Compound, Template - >>> from cybertools.composer.client import Client + >>> from cybertools.composer.instance import Instance We set up a very simple demonstration system using a PC configurator. We start with two classes denoting a configuration and a simple @@ -40,16 +40,16 @@ We need another class denoting the product that will be created. >>> c001 = Product('c001') -The real stuff will be done by a client adpater that connects the product +The real stuff will be done by an instance adpater that connects the product with the template. - >>> class ConfigurationAdapter(Client): + >>> class ConfigurationAdapter(Instance): ... def applyTemplate(self): ... for c in self.template.components: ... print c, self.context.parts.get(c.name, '-') - >>> client = ConfigurationAdapter(c001, desktop) - >>> client.applyTemplate() + >>> inst = ConfigurationAdapter(c001, desktop) + >>> inst.applyTemplate() case - mainboard - cpu - @@ -58,7 +58,7 @@ with the template. If we have configured a CPU for our configuration this will be listed. >>> c001.parts['cpu'] = Product('z80') - >>> client.applyTemplate() + >>> inst.applyTemplate() case - mainboard - cpu z80 diff --git a/composer/client.py b/composer/instance.py similarity index 91% rename from composer/client.py rename to composer/instance.py index d6273c3..76f98c4 100644 --- a/composer/client.py +++ b/composer/instance.py @@ -24,12 +24,12 @@ $Id$ from zope.interface import implements -from cybertools.composer.interfaces import IClient +from cybertools.composer.interfaces import IInstance -class Client(object): +class Instance(object): - implements(IClient) + implements(IInstance) def __init__(self, context, template): self.context = context diff --git a/composer/interfaces.py b/composer/interfaces.py index 7c26020..b9842d0 100644 --- a/composer/interfaces.py +++ b/composer/interfaces.py @@ -55,18 +55,18 @@ class ITemplate(Interface): 'object is built upon') -# client side +# instances -class IClient(Interface): - """ Represents an object that uses a set of templates via its instances. +class IInstance(Interface): + """ Represents (adapts) an object that uses a template. """ - context = Attribute('Object this client adapter has been created for') + context = Attribute('Object this instance adapter has been created for') template = Attribute('The template to be used for this client') def applyTemplate(*args, **kw): - """ Apply the template using the client's context. Note that this - method is just an example - client classes may define + """ Apply the template using the instance's context. Note that this + method is just an example - instance classes may define other methods that provide more specific actions. """ diff --git a/composer/schema/client.py b/composer/schema/instance.py similarity index 94% rename from composer/schema/client.py rename to composer/schema/instance.py index 1a910a6..dd8d801 100644 --- a/composer/schema/client.py +++ b/composer/schema/instance.py @@ -24,10 +24,10 @@ $Id$ from zope.interface import implements -from cybertools.composer.client import Client +from cybertools.composer.instance import Instance -class Editor(Client): +class Editor(Instance): def applyTemplate(self, data={}, *args, **kw): for c in self.template.components: