Compare commits

..

93 commits

Author SHA1 Message Date
0e5270f8d5 fix remaining 'implements'... 2025-02-22 11:31:19 +01:00
fe632fbeab more Python3 fixes (unicode, basestring) 2025-01-11 11:35:21 +01:00
860d18cae8 Python3 fix for schema.grid 2025-01-07 08:46:31 +01:00
569e197609 more minor Python3 fixes 2024-11-24 10:18:21 +01:00
12978d2389 tracks: determine indexAttributes dynamically, allowing later change 2024-11-24 10:11:25 +01:00
df1229d8fd minor fixes for avoiding errors with Python3 / up-to-date libraries 2024-10-26 19:22:59 +02:00
93a2acf7db some more Python3 fixes 2024-10-03 17:00:16 +02:00
25277a0b65 avoid testing deprecation errors with Python3.12 2024-10-02 10:14:22 +02:00
aef9ad8cb5 make Python3.12 happy 2024-10-02 09:45:57 +02:00
814d7c0762 changes to allow zodbupdate to migrate old data 2024-10-02 09:08:16 +02:00
8a6277fbff some more Python3 fixes 2024-10-01 16:09:46 +02:00
2cbd4c11d3 fix UID handling in commerce 2024-10-01 15:40:38 +02:00
968aeab42a one more Python3 fix in ajax 2024-09-29 12:04:56 +02:00
f1080df88b use zope-testrunner for running all relevant tests => more Python3 fixes 2024-09-28 11:42:20 +02:00
33ab512b7f some more Python3 fixes (composer.report, tracking) 2024-09-26 16:24:24 +02:00
17fbeb2c2c browser.loops.auth: Python3 fix 2024-09-25 17:05:19 +02:00
52e3fc72c6 more Python3 fixes in composer, knowledge 2024-09-25 10:57:30 +02:00
db31a73bc9 container: Python3 fix 2024-09-25 09:31:49 +02:00
ee82ee7b32 composer: some more Python3 fixes 2024-09-24 19:24:25 +02:00
71f36283b9 Merge branch '2master' into 3master 2024-09-24 17:15:06 +02:00
d66aa31058 more Python3 fixes (browser.action, composer...field) 2024-09-24 17:11:06 +02:00
5f3bd3c04f composer: more Python3 fixes 2024-09-24 11:14:22 +02:00
b22dbf879c remove deprecated zope.app.container references 2024-09-23 22:50:46 +02:00
9fbd97386e some more Python3 fixes... 2024-09-23 15:35:14 +02:00
b8eba239ed typology: Python3 fixes; + update of example data 2024-09-23 15:05:10 +02:00
61c78fe3e7 reporter: Python3 fixes 2024-09-23 13:12:33 +02:00
3ec90f4b66 relation: Python3 fixes 2024-09-23 12:17:52 +02:00
f9a3326ec7 process: Python3 fixes 2024-09-23 11:14:21 +02:00
8037ac38be organize: Python3 fixes 2024-09-23 11:00:35 +02:00
52990d1df6 work in progress: organize: Python3 fixes 2024-09-22 18:10:02 +02:00
8d260908a5 meta: Python3 fixes 2024-09-22 17:16:33 +02:00
b60d6d3b10 external: some Python3 fixes 2024-09-22 16:12:36 +02:00
e98dd2ed34 media: Python3 fixes 2024-09-22 15:24:24 +02:00
c9220d834d linK: Python3 fixes 2024-09-22 14:46:28 +02:00
383b77edf1 knowledge: Python3 fixes 2024-09-22 13:31:58 +02:00
b866ac4267 integrator.filesystem: Python3 fixes 2024-09-22 13:25:46 +02:00
ee9d062833 docgen: Python3 fixes 2024-09-22 11:16:47 +02:00
4b84e816b4 container: Python3 fixes 2024-09-22 10:41:30 +02:00
80766f2279 composer, util: Python3 fixes 2024-09-22 10:24:02 +02:00
87ca77df45 commerce: Python3 fixes, + composer (.base, .schema) 2024-09-21 22:36:59 +02:00
c5fe028756 catalog: Python3 fixes (+ some fixes in relation) 2024-09-21 17:04:16 +02:00
ad632e23ee browser: Python3 fixes 2024-09-21 16:12:03 +02:00
98ebc30bd5 tracking: tests OK, including some fixes in container 2024-09-21 15:04:57 +02:00
bd631677d6 brain: fixes (zope.interface.implementer); + text: improvements 2024-09-21 14:27:15 +02:00
06682d2a5c define project via pyproject.toml, removing setup.py; + fixes => cybertools.text tests OK 2024-09-21 09:06:42 +02:00
35ab24a78a tracking: add updateIndex() method 2024-05-03 13:08:35 +02:00
a6fb663192 minor additions for compatibility with new cco.storage implementation 2024-01-03 11:07:55 +01:00
94ce64ef00 add RecordsTable field - context-based, i.e. the columns are defined in the object or type 2023-12-28 09:09:00 +01:00
e5f1be9f91 provide method for automatic conversion from KeyTable to Records field 2023-12-25 10:52:45 +01:00
abfd75a782 date2TimeStamp(): accept also int and float as input 2023-12-21 08:18:49 +01:00
6a52601060 move tracking migration to loops 2023-12-15 14:03:35 +01:00
d6666c166f first migration (with favorites) basically working 2023-12-11 09:46:27 +01:00
382ffe2e28 add MIT license file as default for new or changed modules 2023-12-11 08:24:54 +01:00
6f86e74feb work in progress: migration of records (tracking) - main development in python2 (2master) branch 2023-12-11 08:19:49 +01:00
1fb58a7db3 remove copyright comments - see LICENSE file 2023-11-29 13:19:47 +01:00
fad566b354 make package cybertools.tracking Python3-ready 2023-11-29 11:48:36 +01:00
43ea46e401 cybertools.text: OK on py3 2023-11-27 18:49:05 +01:00
Hannes Plattner
f5c80948c0 refix 2023-06-28 13:54:51 +02:00
Hannes Plattner
88f8b968e6 fix method call 2023-06-28 13:50:28 +02:00
zope
674cd62ae6 avoid error when timestamp is already a date 2021-11-24 09:32:41 +01:00
zope
1629defe3d add parameter usePredicateIndex to getRelations() 2021-08-07 11:44:01 +02:00
Hannes Plattner
bd1aa11beb Merge branch '2master' of ssh://git.cy55.de/home/git/cybertools into 2master 2020-10-13 13:22:40 +02:00
Hannes Plattner
46582b51fe fix instance default value getter 2020-10-13 13:22:21 +02:00
59cd18cc63 fix import: stop deprecation warning 2020-05-04 16:30:01 +02:00
ab72a31bf0 merge field methods correctly 2020-04-15 11:56:56 +02:00
a8565f58c3 don't suppress 'hidden' fields 2020-04-08 14:52:51 +02:00
51be7dbcbb avoid deprecation warnings, fix doctests 2020-03-07 13:44:10 +01:00
f2eae818db set version number to 2.3.0 2020-03-07 12:51:33 +01:00
3c8edc3e90 merge bbmaster + bbmaster2 to new branch 2master 2020-03-03 15:22:13 +01:00
83e18e10c1 avoid error caused by missing table columns 2019-11-25 19:20:07 +01:00
df15344db5 fix tests/doctests according to current ZTK and BlueBream versions 2019-04-26 17:42:10 +02:00
6ee25a78a4 avoid template compilation error with new ZPT version 2019-04-26 11:25:39 +02:00
69513bdd9f avoid years before 1900 that cannot be formatted 2019-04-26 11:08:02 +02:00
hplattner
c5715c322d subtotals fixes 2017-10-11 14:21:13 +02:00
hplattner
0208aa5595 add getExportValue method for report fields 2017-02-09 13:44:53 +01:00
hplattner
aab06b0cc9 use subtotals row id instead of class concat 2016-12-28 11:40:09 +01:00
hplattner
e26d61c38b use cssClass from row property 2016-12-12 11:50:17 +01:00
4d493dda45 second fix: call normalizeName only for strings 2016-11-30 18:10:16 +01:00
173e0d4140 now the real fix: call normalizeName only for strings 2016-11-30 13:48:57 +01:00
hplattner
64d7f4e701 fix 2016-11-30 13:42:00 +01:00
519140aa6d use 'suppress' property name instead of 'hidden' (which is used already) 2016-11-30 10:10:00 +01:00
b6833af5f9 allow simple hiding of a field from a schema 2016-11-29 13:08:29 +01:00
hplattner
78748051e2 add report row properties for js calculating totals and subtotals 2016-11-25 16:38:27 +01:00
78969355b6 backport from bbmaster2: add field property 'visible'; add FieldGroup 2016-10-08 14:13:33 +02:00
473dd10029 allow schema processor plugin adapter 2016-10-04 07:56:26 +02:00
b988ec0f32 try to avoid ValueError because of erroneous date 2016-04-05 08:57:32 +02:00
c7059e4f52 try to avoid ValueError because of erroneous date 2016-04-05 08:52:35 +02:00
hplattner
8190d56286 wrap relation field totals description display value 2016-03-04 13:32:26 +01:00
hplattner
a68eddd928 fix merge conflict 2016-03-01 15:01:19 +01:00
hplattner
66526863ca use Pillow instead of PIL; Fix Image import 2016-03-01 15:00:45 +01:00
0507cc7a15 remove PIL from requirements list 2016-02-27 19:06:50 +01:00
861f340b81 backport changes from bbmaster2: avoid creation of new controller via view/@@controller 2016-02-05 12:37:52 +01:00
3721e5caf7 backport changes from bbmaster2 2016-02-04 18:08:40 +01:00
669 changed files with 2212 additions and 7239 deletions

3
.gitignore vendored
View file

@ -1,8 +1,9 @@
*.pyc
*.pyo
ajax/dojo/*
*/ajax/dojo/dojo*
build/
dist/
*.swp
*.egg-info
*.project
*.pydevproject

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (C) 2023 cyberconcepts.org team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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()

View file

@ -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')

View file

@ -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)

View file

@ -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()

View file

@ -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

View file

@ -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']

View file

@ -1,28 +1,10 @@
#
# 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.
# cybertools.ajax.dojo.layout
$Id$
""" Embed Dojo using the cybertools.composer.layout procedure.
"""
from cStringIO import StringIO
from zope.app.pagetemplate import ViewPageTemplateFile
from io import StringIO
from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from cybertools.browser.renderer import RendererFactory

View file

@ -1,38 +1,18 @@
#
# 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
#
# cybertools.brain.neuron
"""
A simple basic implementation of Neuron and Synapsis.
$Id$
""" A simple basic implementation of Neuron and Synapsis.
"""
from zope.interface import implements
from zope.interface import implementer
from cybertools.brain.interfaces import INeuron, ISynapsis
from cybertools.brain.state import State, Transition
@implementer(ISynapsis)
class Synapsis(object):
""" A synapsis connects two neurons.
"""
implements(ISynapsis)
def __init__(self, sender, receiver):
self.sender = sender
sender.receivers.append(self)
@ -46,10 +26,9 @@ class Synapsis(object):
receiver.notify(session)
@implementer(INeuron)
class Neuron(object):
implements(INeuron)
def __init__(self):
self.senders = []
self.receivers = []

View 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
View 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)

View file

@ -1,7 +1,6 @@
# $Id$
# cybertools.brain.tests
import unittest, doctest
from zope.testing.doctestunit import DocFileSuite
from zope.interface.verify import verifyClass
from cybertools.brain.interfaces import INeuron, ISynapsis
@ -20,9 +19,8 @@ class TestBrain(unittest.TestCase):
def test_suite():
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
return unittest.TestSuite((
unittest.makeSuite(TestBrain),
DocFileSuite('README.txt',
optionflags=flags,),
unittest.TestLoader().loadTestsFromTestCase(TestBrain),
doctest.DocFileSuite('README.txt', optionflags=flags,),
))
if __name__ == '__main__':

View file

@ -3,7 +3,7 @@ Browser View Tools
==================
>>> from zope import component, interface
>>> from zope.interface import Interface, implements
>>> from zope.interface import Interface, implementer
>>> 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:
>>> #@implementer(Interface)
>>> class SomeObject(object):
... implements(Interface)
... pass
>>> SomeObject = implementer(Interface)(SomeObject)
>>> obj = SomeObject()
>>> from cybertools.browser.view import GenericView
@ -122,7 +124,7 @@ ZPT macros:
>>> len(cssMacros)
4
>>> m1 = cssMacros[0]
>>> print m1.name, m1.media, m1.resourceName
>>> print(m1.name, m1.media, m1.resourceName)
css all zope3_tablelayout.css
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'])
5
>>> m5 = controller.macros['css'][4]
>>> print m5.name, m5.media, m5.resourceName
>>> print(m5.name, m5.media, m5.resourceName)
css all node.css
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
>>> class MyController(FormController):
... def update(self):
... print 'updating...'
... print('updating...')
... return True
>>> component.provideAdapter(MyController, (View, IBrowserRequest),

View file

@ -1,31 +1,12 @@
#
# 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
#
# cybertools.browser.action
"""
Base classes (sort of views) for action portlet items.
$Id$
""" Base classes (sort of views) for action portlet items.
"""
from copy import copy
from urllib import urlencode
from urllib.parse import urlencode
from zope import component
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
action_macros = ViewPageTemplateFile('action_macros.pt')

View file

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View file

Before

Width:  |  Height:  |  Size: 455 B

After

Width:  |  Height:  |  Size: 455 B

View file

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View file

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 777 B

View file

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View file

Before

Width:  |  Height:  |  Size: 741 B

After

Width:  |  Height:  |  Size: 741 B

View file

Before

Width:  |  Height:  |  Size: 591 B

After

Width:  |  Height:  |  Size: 591 B

View file

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View file

Before

Width:  |  Height:  |  Size: 663 B

After

Width:  |  Height:  |  Size: 663 B

View file

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View file

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 103 B

View file

@ -1,32 +1,13 @@
#
# 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
#
# cybertools.browser.configurator
"""
A view configurator provides configuration data for a view controller.
$Id$
""" A view configurator provides configuration data for a view controller.
"""
from zope import component
from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations
from zope.annotation.attribute import AttributeAnnotations
from zope.cachedescriptors.property import Lazy
from zope.interface import Interface, Attribute, implements
from zope.interface import Interface, Attribute, implementer
# interfaces
@ -63,12 +44,11 @@ class IMacroViewProperty(IViewProperty):
#default implementations
@implementer(IViewConfigurator)
class ViewConfigurator(object):
""" An base class for adapters that allow the registration of view properties.
"""
implements(IViewConfigurator)
def __init__(self, context, request):
self.context = context
self.request = request
@ -109,10 +89,9 @@ class AnnotationViewConfigurator(ViewConfigurator):
return vp
@implementer(IViewProperty)
class ViewProperty(object):
implements(IViewProperty)
def __init__(self, context, request):
self.context = context
self.request = request
@ -128,10 +107,9 @@ class ViewProperty(object):
self.params = params
@implementer(IMacroViewProperty)
class MacroViewProperty(ViewProperty):
implements(IMacroViewProperty)
template = None
def setParams(self, params):

View file

@ -1,27 +1,10 @@
#
# 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
#
# cybertools.browser.controller
"""
Controller for views, templates, macros.
""" Controller for views, templates, macros.
"""
from zope import component
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.browserpage import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from cybertools.browser.configurator import IViewConfigurator, IMacroViewProperty

View 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

View file

@ -1,7 +1,6 @@
# $Id$
import unittest, doctest
from zope.testing.doctestunit import DocFileSuite
from zope.app.testing.functional import FunctionalDocFileSuite

View file

Before

Width:  |  Height:  |  Size: 703 B

After

Width:  |  Height:  |  Size: 703 B

View file

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 345 B

View file

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 349 B

View file

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View file

Before

Width:  |  Height:  |  Size: 52 B

After

Width:  |  Height:  |  Size: 52 B

View file

Before

Width:  |  Height:  |  Size: 52 B

After

Width:  |  Height:  |  Size: 52 B

View file

Before

Width:  |  Height:  |  Size: 702 B

After

Width:  |  Height:  |  Size: 702 B

View file

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 680 B

View file

Before

Width:  |  Height:  |  Size: 792 B

After

Width:  |  Height:  |  Size: 792 B

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View file

Before

Width:  |  Height:  |  Size: 756 B

After

Width:  |  Height:  |  Size: 756 B

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Some files were not shown because too many files have changed in this diff Show more