Compare commits
49 commits
Author | SHA1 | Date | |
---|---|---|---|
0e5270f8d5 | |||
fe632fbeab | |||
860d18cae8 | |||
569e197609 | |||
12978d2389 | |||
df1229d8fd | |||
93a2acf7db | |||
25277a0b65 | |||
aef9ad8cb5 | |||
814d7c0762 | |||
8a6277fbff | |||
2cbd4c11d3 | |||
968aeab42a | |||
f1080df88b | |||
33ab512b7f | |||
17fbeb2c2c | |||
52e3fc72c6 | |||
db31a73bc9 | |||
ee82ee7b32 | |||
71f36283b9 | |||
d66aa31058 | |||
5f3bd3c04f | |||
b22dbf879c | |||
9fbd97386e | |||
b8eba239ed | |||
61c78fe3e7 | |||
3ec90f4b66 | |||
f9a3326ec7 | |||
8037ac38be | |||
52990d1df6 | |||
8d260908a5 | |||
b60d6d3b10 | |||
e98dd2ed34 | |||
c9220d834d | |||
383b77edf1 | |||
b866ac4267 | |||
ee9d062833 | |||
4b84e816b4 | |||
80766f2279 | |||
87ca77df45 | |||
c5fe028756 | |||
ad632e23ee | |||
98ebc30bd5 | |||
bd631677d6 | |||
06682d2a5c | |||
6f86e74feb | |||
1fb58a7db3 | |||
fad566b354 | |||
43ea46e401 |
2
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.pyo
|
||||||
ajax/dojo/*
|
*/ajax/dojo/dojo*
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
*.swp
|
*.swp
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Transaction management.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from cybertools.brain.interfaces import ISession
|
|
||||||
|
|
||||||
|
|
||||||
class Session(object):
|
|
||||||
|
|
||||||
implements(ISession)
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.states = {}
|
|
||||||
|
|
||||||
def setState(self, neuron, state):
|
|
||||||
self.states[neuron] = state
|
|
||||||
|
|
||||||
def getState(self, neuron):
|
|
||||||
return self.states.get(neuron, neuron.state)
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Base classes for state and state manipulations using a float-based state.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
from cybertools.brain.interfaces import IState, ITransition
|
|
||||||
|
|
||||||
|
|
||||||
class State(object):
|
|
||||||
""" The state of a neuron.
|
|
||||||
"""
|
|
||||||
|
|
||||||
implements(IState)
|
|
||||||
|
|
||||||
def __init__(self, value=0.0):
|
|
||||||
self.value = value
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return '<State %0.1f>' % self.value
|
|
||||||
|
|
||||||
|
|
||||||
class Transition(object):
|
|
||||||
|
|
||||||
implements(ITransition)
|
|
||||||
|
|
||||||
def __init__(self, synapsis, factor=1.0):
|
|
||||||
self.synapsis = synapsis
|
|
||||||
self.factor = factor
|
|
||||||
|
|
||||||
def execute(self, session=None):
|
|
||||||
oldState = self.synapsis.receiver.getState(session)
|
|
||||||
senderState = self.synapsis.sender.getState(session)
|
|
||||||
return State(oldState.value + senderState.value * self.factor)
|
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""Form Controller stuff: form processing is the part of the
|
|
||||||
model/view/controller pattern that deals withform input.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import Interface, implements
|
|
||||||
|
|
||||||
|
|
||||||
class IFormController(Interface):
|
|
||||||
""" Used as a named adapter by GenericView for processing form input.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def update():
|
|
||||||
""" Processing form input...
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class FormController(object):
|
|
||||||
|
|
||||||
implements(IFormController)
|
|
||||||
|
|
||||||
def __init__(self, context, request):
|
|
||||||
self.view = self.__parent__ = view = context
|
|
||||||
self.context = view.context # the controller is adapted to a view
|
|
||||||
self.request = request
|
|
||||||
|
|
||||||
def update(self):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2017 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
""" URL manipulation utilities
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
from zope.app.container.traversal import ItemTraverser
|
|
||||||
from zope.interface import Interface, implements
|
|
||||||
|
|
||||||
|
|
||||||
class TraversalRedirector(ItemTraverser):
|
|
||||||
|
|
||||||
port = 9083
|
|
||||||
names = ('ctt', 'sona',)
|
|
||||||
loc_pattern = 'www.%s.de'
|
|
||||||
skip = (0, 4)
|
|
||||||
|
|
||||||
def publishTraverse(self, request, name):
|
|
||||||
return super(TraversalRedirector, self).publishTraverse(request, name)
|
|
|
@ -1,43 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""Keyword catalog index.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
import zope.index.keyword
|
|
||||||
import zope.interface
|
|
||||||
|
|
||||||
import zope.app.container.contained
|
|
||||||
import zope.app.catalog.attribute
|
|
||||||
import zope.app.catalog.interfaces
|
|
||||||
|
|
||||||
|
|
||||||
class IKeywordIndex(zope.app.catalog.interfaces.IAttributeIndex,
|
|
||||||
zope.app.catalog.interfaces.ICatalogIndex):
|
|
||||||
"""Interface-based catalog keyword index.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class KeywordIndex(zope.app.catalog.attribute.AttributeIndex,
|
|
||||||
zope.index.keyword.KeywordIndex,
|
|
||||||
zope.app.container.contained.Contained):
|
|
||||||
|
|
||||||
zope.interface.implements(IKeywordIndex)
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Customer classes.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements, Interface
|
|
||||||
|
|
||||||
from cybertools.commerce.common import RelationSet, BaseObject
|
|
||||||
from cybertools.commerce.interfaces import ICustomer, IAddress
|
|
||||||
|
|
||||||
|
|
||||||
class Customer(BaseObject):
|
|
||||||
|
|
||||||
implements(ICustomer)
|
|
||||||
|
|
||||||
def __init__(self, customerId, title=None, client=None):
|
|
||||||
self.name = self.customerId = customerId
|
|
||||||
self.title = title or u'unknown'
|
|
||||||
self.client = client
|
|
||||||
self.shops = self.collection(self, 'customers')
|
|
||||||
self.orders = self.collection(self, 'customer')
|
|
||||||
|
|
||||||
|
|
||||||
class Address(BaseObject):
|
|
||||||
|
|
||||||
implements(IAddress)
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Base classes.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from cybertools.commerce.common import RelationSet, BaseObject
|
|
||||||
from cybertools.commerce.interfaces import IShop
|
|
||||||
|
|
||||||
|
|
||||||
class Shop(BaseObject):
|
|
||||||
|
|
||||||
implements(IShop)
|
|
||||||
|
|
||||||
collection = RelationSet
|
|
||||||
|
|
||||||
def __init__(self, name, title=None):
|
|
||||||
self.name = name
|
|
||||||
self.title = title or u'Shop'
|
|
||||||
self.products = self.collection(self, 'shops')
|
|
||||||
self.customers = self.collection(self, 'shops')
|
|
||||||
self.orderNumber = 0
|
|
||||||
|
|
||||||
def getNewOrderId(self):
|
|
||||||
last = self.orderNumber or 0
|
|
||||||
num = last + 1
|
|
||||||
self.orderNumber = num
|
|
||||||
return '%05i' % num
|
|
|
@ -1,62 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Basic classes for complex template structures.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from cybertools.composer.interfaces import IComponent, IElement, ICompound
|
|
||||||
from cybertools.composer.interfaces import ITemplate
|
|
||||||
from cybertools.util.jeep import Jeep
|
|
||||||
|
|
||||||
|
|
||||||
class Component(object):
|
|
||||||
|
|
||||||
implements(IComponent)
|
|
||||||
|
|
||||||
|
|
||||||
class Element(Component):
|
|
||||||
|
|
||||||
implements(IElement)
|
|
||||||
|
|
||||||
|
|
||||||
class Compound(Component):
|
|
||||||
|
|
||||||
implements(ICompound)
|
|
||||||
|
|
||||||
componentStorage = Jeep
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.parts = self.componentStorage()
|
|
||||||
|
|
||||||
|
|
||||||
class Template(object):
|
|
||||||
|
|
||||||
implements(ITemplate)
|
|
||||||
|
|
||||||
componentStorage = Jeep
|
|
||||||
components = None
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
if self.componentStorage is not None:
|
|
||||||
self.components = self.componentStorage()
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Base classes to be used for client adapters.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from cybertools.composer.interfaces import IInstance
|
|
||||||
|
|
||||||
|
|
||||||
class Instance(object):
|
|
||||||
|
|
||||||
implements(IInstance)
|
|
||||||
|
|
||||||
templateFactory = dict
|
|
||||||
templateAttributeName = '__ctc_template__'
|
|
||||||
|
|
||||||
aspect = 'composer.default'
|
|
||||||
|
|
||||||
def __init__(self, context):
|
|
||||||
self.context = context
|
|
||||||
|
|
||||||
def setTemplate(self, temp):
|
|
||||||
template = getattr(self.context,
|
|
||||||
self.templateAttributeName,
|
|
||||||
self.templateFactory())
|
|
||||||
template.setdefault(self.aspect, temp)
|
|
||||||
setattr(self.context, self.templateAttributeName, template)
|
|
||||||
def getTemplate(self):
|
|
||||||
template = getattr(self.context, self.templateAttributeName, {})
|
|
||||||
return template.get(self.aspect, [])
|
|
||||||
template = property(getTemplate, setTemplate)
|
|
||||||
|
|
||||||
def applyTemplates(self, *args, **kw):
|
|
||||||
raise ValueError('To be implemented by subclass')
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Default layouts for the liquid skin.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
|
||||||
from zope.cachedescriptors.property import Lazy
|
|
||||||
from zope import component
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from cybertools.browser.liquid import Liquid
|
|
||||||
from cybertools.browser.renderer import RendererFactory
|
|
||||||
from cybertools.composer.layout.base import Layout
|
|
||||||
from cybertools.composer.layout.browser.standard import standardRenderers
|
|
||||||
|
|
||||||
defaultRenderers = RendererFactory(ViewPageTemplateFile('default.pt'))
|
|
||||||
|
|
||||||
|
|
||||||
Layout('css.liquid', 'page.css', renderer=standardRenderers['css'],
|
|
||||||
media='all', resource='liquid.css', skin=Liquid)
|
|
||||||
|
|
||||||
Layout('body.liquid', 'page.body', renderer=defaultRenderers.body,
|
|
||||||
skin=Liquid)
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Region implementation.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.interface import implements
|
|
||||||
|
|
||||||
from cybertools.composer.layout.interfaces import IRegion
|
|
||||||
from cybertools.util.jeep import Jeep
|
|
||||||
|
|
||||||
|
|
||||||
class Region(object):
|
|
||||||
|
|
||||||
implements(IRegion)
|
|
||||||
|
|
||||||
allowedLayoutCategories = None
|
|
||||||
|
|
||||||
def __init__(self, name):
|
|
||||||
self.name = name
|
|
||||||
self.layouts = Jeep()
|
|
|
@ -1,52 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2007 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Rule instance and related classes.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope import component
|
|
||||||
from zope.component import adapts
|
|
||||||
from zope.interface import Interface, implements
|
|
||||||
|
|
||||||
from cybertools.composer.instance import Instance
|
|
||||||
from cybertools.composer.rule.interfaces import IRuleInstance, IActionHandler
|
|
||||||
|
|
||||||
|
|
||||||
class RuleInstance(Instance):
|
|
||||||
|
|
||||||
implements(IRuleInstance)
|
|
||||||
adapts(Interface)
|
|
||||||
|
|
||||||
template = None
|
|
||||||
event = None
|
|
||||||
|
|
||||||
def applyTemplate(self, **kw):
|
|
||||||
for c in self.template.conditions:
|
|
||||||
cond = component.getAdapter(self, ICondition, name=c)
|
|
||||||
if not cond():
|
|
||||||
continue
|
|
||||||
data = dict(request=self.event.request)
|
|
||||||
for action in self.template.actions:
|
|
||||||
handler = component.getAdapter(self, IActionHandler,
|
|
||||||
name=action.handlerName)
|
|
||||||
data = handler(data, action.parameters)
|
|
||||||
return data
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
|
||||||
Ordered container implementation.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
|
||||||
|
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
|
||||||
from zope.app.container.browser.contents import JustContents
|
|
||||||
from zope.app.i18n import ZopeMessageFactory as _
|
|
||||||
from zope.cachedescriptors.property import Lazy
|
|
||||||
from zope.interface import Interface
|
|
||||||
|
|
||||||
|
|
||||||
contents_template = ViewPageTemplateFile('contents.pt')
|
|
||||||
|
|
||||||
|
|
||||||
class ContainerView(JustContents):
|
|
||||||
|
|
||||||
def checkMoveAction(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
orderable = False
|
|
||||||
|
|
||||||
# informations for the ajax.inner.html view (template):
|
|
||||||
|
|
||||||
template = contents_template
|
|
||||||
|
|
||||||
#@Lazy
|
|
||||||
#def template(self):
|
|
||||||
# basicView = zapi.getMultiAdapter((self.context, self.request),
|
|
||||||
# Interface, name=u'contents.html')
|
|
||||||
# return basicView.index
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
def macro(self):
|
|
||||||
return self.template.macros['contents']
|
|
||||||
|
|
|
@ -1,28 +1,10 @@
|
||||||
#
|
# cybertools.ajax.dojo.layout
|
||||||
# Copyright (c) 2008 Helmut Merz - helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
Embed Dojo using the cybertools.composer.layout procedure.
|
|
||||||
|
|
||||||
$Id$
|
""" Embed Dojo using the cybertools.composer.layout procedure.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from cStringIO import StringIO
|
from io import StringIO
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.browserpage import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.browser.renderer import RendererFactory
|
from cybertools.browser.renderer import RendererFactory
|
|
@ -1,38 +1,18 @@
|
||||||
#
|
# cybertools.brain.neuron
|
||||||
# Copyright (c) 2006 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" A simple basic implementation of Neuron and Synapsis.
|
||||||
A simple basic implementation of Neuron and Synapsis.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.interface import implements
|
from zope.interface import implementer
|
||||||
from cybertools.brain.interfaces import INeuron, ISynapsis
|
from cybertools.brain.interfaces import INeuron, ISynapsis
|
||||||
from cybertools.brain.state import State, Transition
|
from cybertools.brain.state import State, Transition
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(ISynapsis)
|
||||||
class Synapsis(object):
|
class Synapsis(object):
|
||||||
""" A synapsis connects two neurons.
|
""" A synapsis connects two neurons.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
implements(ISynapsis)
|
|
||||||
|
|
||||||
def __init__(self, sender, receiver):
|
def __init__(self, sender, receiver):
|
||||||
self.sender = sender
|
self.sender = sender
|
||||||
sender.receivers.append(self)
|
sender.receivers.append(self)
|
||||||
|
@ -46,10 +26,9 @@ class Synapsis(object):
|
||||||
receiver.notify(session)
|
receiver.notify(session)
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(INeuron)
|
||||||
class Neuron(object):
|
class Neuron(object):
|
||||||
|
|
||||||
implements(INeuron)
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.senders = []
|
self.senders = []
|
||||||
self.receivers = []
|
self.receivers = []
|
21
cybertools/brain/session.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# cybertools.brain.session
|
||||||
|
|
||||||
|
""" Transaction management.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.interface import implementer
|
||||||
|
from cybertools.brain.interfaces import ISession
|
||||||
|
|
||||||
|
|
||||||
|
implementer(ISession)
|
||||||
|
class Session(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.states = {}
|
||||||
|
|
||||||
|
def setState(self, neuron, state):
|
||||||
|
self.states[neuron] = state
|
||||||
|
|
||||||
|
def getState(self, neuron):
|
||||||
|
return self.states.get(neuron, neuron.state)
|
||||||
|
|
34
cybertools/brain/state.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# cybertools.brain.state
|
||||||
|
|
||||||
|
""" Base classes for state and state manipulations using a float-based state.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.interface import implementer
|
||||||
|
from cybertools.brain.interfaces import IState, ITransition
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IState)
|
||||||
|
class State(object):
|
||||||
|
""" The state of a neuron.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, value=0.0):
|
||||||
|
self.value = value
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<State %0.1f>' % self.value
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(ITransition)
|
||||||
|
class Transition(object):
|
||||||
|
|
||||||
|
def __init__(self, synapsis, factor=1.0):
|
||||||
|
self.synapsis = synapsis
|
||||||
|
self.factor = factor
|
||||||
|
|
||||||
|
def execute(self, session=None):
|
||||||
|
oldState = self.synapsis.receiver.getState(session)
|
||||||
|
senderState = self.synapsis.sender.getState(session)
|
||||||
|
return State(oldState.value + senderState.value * self.factor)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# cybertools.brain.tests
|
||||||
|
|
||||||
import unittest, doctest
|
import unittest, doctest
|
||||||
from zope.interface.verify import verifyClass
|
from zope.interface.verify import verifyClass
|
||||||
|
@ -18,10 +19,9 @@ class TestBrain(unittest.TestCase):
|
||||||
def test_suite():
|
def test_suite():
|
||||||
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
|
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
|
||||||
return unittest.TestSuite((
|
return unittest.TestSuite((
|
||||||
unittest.makeSuite(TestBrain),
|
unittest.TestLoader().loadTestsFromTestCase(TestBrain),
|
||||||
doctest.DocFileSuite('README.txt',
|
doctest.DocFileSuite('README.txt', optionflags=flags,),
|
||||||
optionflags=flags,),
|
))
|
||||||
))
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(defaultTest='test_suite')
|
unittest.main(defaultTest='test_suite')
|
|
@ -3,7 +3,7 @@ Browser View Tools
|
||||||
==================
|
==================
|
||||||
|
|
||||||
>>> from zope import component, interface
|
>>> from zope import component, interface
|
||||||
>>> from zope.interface import Interface, implements
|
>>> from zope.interface import Interface, implementer
|
||||||
>>> from zope.publisher.interfaces.browser import IBrowserRequest
|
>>> from zope.publisher.interfaces.browser import IBrowserRequest
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@ the common and node modules there.)
|
||||||
|
|
||||||
Let's start with a dummy content object and create a view on it:
|
Let's start with a dummy content object and create a view on it:
|
||||||
|
|
||||||
|
>>> #@implementer(Interface)
|
||||||
>>> class SomeObject(object):
|
>>> class SomeObject(object):
|
||||||
... implements(Interface)
|
... pass
|
||||||
|
>>> SomeObject = implementer(Interface)(SomeObject)
|
||||||
>>> obj = SomeObject()
|
>>> obj = SomeObject()
|
||||||
|
|
||||||
>>> from cybertools.browser.view import GenericView
|
>>> from cybertools.browser.view import GenericView
|
||||||
|
@ -122,7 +124,7 @@ ZPT macros:
|
||||||
>>> len(cssMacros)
|
>>> len(cssMacros)
|
||||||
4
|
4
|
||||||
>>> m1 = cssMacros[0]
|
>>> m1 = cssMacros[0]
|
||||||
>>> print m1.name, m1.media, m1.resourceName
|
>>> print(m1.name, m1.media, m1.resourceName)
|
||||||
css all zope3_tablelayout.css
|
css all zope3_tablelayout.css
|
||||||
|
|
||||||
Calling a macro provided by Controller.macros[] returns the real ZPT macro:
|
Calling a macro provided by Controller.macros[] returns the real ZPT macro:
|
||||||
|
@ -138,7 +140,7 @@ The pre-set collection of macros for a certain slot may be extended
|
||||||
>>> len(controller.macros['css'])
|
>>> len(controller.macros['css'])
|
||||||
5
|
5
|
||||||
>>> m5 = controller.macros['css'][4]
|
>>> m5 = controller.macros['css'][4]
|
||||||
>>> print m5.name, m5.media, m5.resourceName
|
>>> print(m5.name, m5.media, m5.resourceName)
|
||||||
css all node.css
|
css all node.css
|
||||||
|
|
||||||
If an identifier is given (the second parameter) a certain macro is only
|
If an identifier is given (the second parameter) a certain macro is only
|
||||||
|
@ -221,7 +223,7 @@ controller issues a redirect.
|
||||||
>>> from cybertools.browser.form import IFormController, FormController
|
>>> from cybertools.browser.form import IFormController, FormController
|
||||||
>>> class MyController(FormController):
|
>>> class MyController(FormController):
|
||||||
... def update(self):
|
... def update(self):
|
||||||
... print 'updating...'
|
... print('updating...')
|
||||||
... return True
|
... return True
|
||||||
|
|
||||||
>>> component.provideAdapter(MyController, (View, IBrowserRequest),
|
>>> component.provideAdapter(MyController, (View, IBrowserRequest),
|
|
@ -1,31 +1,12 @@
|
||||||
#
|
# cybertools.browser.action
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Base classes (sort of views) for action portlet items.
|
||||||
Base classes (sort of views) for action portlet items.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from urllib import urlencode
|
from urllib.parse import urlencode
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.browserpage import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
action_macros = ViewPageTemplateFile('action_macros.pt')
|
action_macros = ViewPageTemplateFile('action_macros.pt')
|
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
Before Width: | Height: | Size: 537 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 777 B |
Before Width: | Height: | Size: 641 B After Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 741 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 663 B After Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 103 B After Width: | Height: | Size: 103 B |
|
@ -1,32 +1,13 @@
|
||||||
#
|
# cybertools.browser.configurator
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" A view configurator provides configuration data for a view controller.
|
||||||
A view configurator provides configuration data for a view controller.
|
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations
|
from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations
|
||||||
from zope.annotation.attribute import AttributeAnnotations
|
from zope.annotation.attribute import AttributeAnnotations
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
from zope.interface import Interface, Attribute, implements
|
from zope.interface import Interface, Attribute, implementer
|
||||||
|
|
||||||
|
|
||||||
# interfaces
|
# interfaces
|
||||||
|
@ -63,12 +44,11 @@ class IMacroViewProperty(IViewProperty):
|
||||||
|
|
||||||
#default implementations
|
#default implementations
|
||||||
|
|
||||||
|
@implementer(IViewConfigurator)
|
||||||
class ViewConfigurator(object):
|
class ViewConfigurator(object):
|
||||||
""" An base class for adapters that allow the registration of view properties.
|
""" An base class for adapters that allow the registration of view properties.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
implements(IViewConfigurator)
|
|
||||||
|
|
||||||
def __init__(self, context, request):
|
def __init__(self, context, request):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.request = request
|
self.request = request
|
||||||
|
@ -109,10 +89,9 @@ class AnnotationViewConfigurator(ViewConfigurator):
|
||||||
return vp
|
return vp
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IViewProperty)
|
||||||
class ViewProperty(object):
|
class ViewProperty(object):
|
||||||
|
|
||||||
implements(IViewProperty)
|
|
||||||
|
|
||||||
def __init__(self, context, request):
|
def __init__(self, context, request):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.request = request
|
self.request = request
|
||||||
|
@ -128,10 +107,9 @@ class ViewProperty(object):
|
||||||
self.params = params
|
self.params = params
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IMacroViewProperty)
|
||||||
class MacroViewProperty(ViewProperty):
|
class MacroViewProperty(ViewProperty):
|
||||||
|
|
||||||
implements(IMacroViewProperty)
|
|
||||||
|
|
||||||
template = None
|
template = None
|
||||||
|
|
||||||
def setParams(self, params):
|
def setParams(self, params):
|
|
@ -1,27 +1,10 @@
|
||||||
#
|
# cybertools.browser.controller
|
||||||
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Controller for views, templates, macros.
|
||||||
Controller for views, templates, macros.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
from zope.browserpage import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.browser.configurator import IViewConfigurator, IMacroViewProperty
|
from cybertools.browser.configurator import IViewConfigurator, IMacroViewProperty
|
29
cybertools/browser/form.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# cybertools.browser.form
|
||||||
|
|
||||||
|
"""Form Controller stuff: form processing is the part of the
|
||||||
|
model/view/controller pattern that deals withform input.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.interface import Interface, implementer
|
||||||
|
|
||||||
|
|
||||||
|
class IFormController(Interface):
|
||||||
|
""" Used as a named adapter by GenericView for processing form input.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def update():
|
||||||
|
""" Processing form input...
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@implementer(IFormController)
|
||||||
|
class FormController(object):
|
||||||
|
|
||||||
|
def __init__(self, context, request):
|
||||||
|
self.view = self.__parent__ = view = context
|
||||||
|
self.context = view.context # the controller is adapted to a view
|
||||||
|
self.request = request
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
pass
|
||||||
|
|
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 703 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 372 B |
Before Width: | Height: | Size: 52 B After Width: | Height: | Size: 52 B |
Before Width: | Height: | Size: 52 B After Width: | Height: | Size: 52 B |
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 792 B |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 641 B After Width: | Height: | Size: 641 B |
Before Width: | Height: | Size: 756 B After Width: | Height: | Size: 756 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 817 B |