diff --git a/loops/config/README.txt b/loops/config/README.txt index b0da9ae..2dfe9b5 100644 --- a/loops/config/README.txt +++ b/loops/config/README.txt @@ -52,9 +52,9 @@ some options. >>> opt.useVersioning True - >>> print opt - organize(tracking=['changes', 'access']) + >>> print(opt) useVersioning=True + organize(tracking=['changes', 'access']) If we query an option that is not defined on the site level we get a dummy element that corresponds to False. diff --git a/loops/i18n/README.txt b/loops/i18n/README.txt index 7aedcd3..f633197 100644 --- a/loops/i18n/README.txt +++ b/loops/i18n/README.txt @@ -2,8 +2,6 @@ loops - Linked Objects for Organization and Processing Services =============================================================== - ($Id$) - Let's do some basic set up >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown @@ -33,7 +31,7 @@ ZCML setup): For testing and demonstration purposes let's create a topic. >>> topic = concepts['topic'] - >>> topic01 = concepts['topic01'] = Concept(u'loops for Zope 3') + >>> topic01 = concepts['topic01'] = Concept('loops for Zope 3') >>> topic01.conceptType = topic @@ -43,7 +41,7 @@ Content Internationalization Let's look at a certain concept that should contain i18n-alized data. >>> topic01.title - u'loops for Zope 3' + 'loops for Zope 3' We can query the available languages, the current language setting and the default language using a LanguageInfo object that is similar to a view. @@ -115,7 +113,7 @@ Now we are ready to enter a language-specific title. >>> form.update() >>> topic01.title - I18NValue({'en': u'loops for Zope 3', 'it': u'loops per Zope 3'}) + I18NValue({'it': 'loops per Zope 3', 'en': 'loops for Zope 3'}) If we access an i18n attribute via a view that is i18n-aware we get the value corresponding to the language preferences that appear in the request. @@ -123,7 +121,7 @@ value corresponding to the language preferences that appear in the request. >>> input = {'loops.language': 'it'} >>> view = ConceptView(topic01, TestRequest(form=input)) >>> view.title - u'loops per Zope 3' + 'loops per Zope 3' If there is no entry for the language given we get back the entry for the default language. @@ -131,24 +129,24 @@ the default language. >>> input = {'loops.language': 'de'} >>> view = ConceptView(topic01, TestRequest(form=input)) >>> view.title - u'loops for Zope 3' + 'loops for Zope 3' There are also fallbacks - mainly for being able to access the title attribute in not i18n-aware contexts - that retrieve the value corresponding to the default language at the time of the attribute creation. >>> topic01.title.getDefault() - u'loops for Zope 3' + 'loops for Zope 3' >>> str(topic01.title) 'loops for Zope 3' >>> topic01.title.lower() - u'loops for zope 3' + 'loops for zope 3' Viewing translations -------------------- >>> view.adapted.translations() - {'en': u'loops for Zope 3', 'it': u'loops per Zope 3'} + {'it': 'loops per Zope 3', 'en': 'loops for Zope 3'} Fin de partie diff --git a/loops/rest/README.txt b/loops/rest/README.txt index 2a65ba3..fee6a04 100755 --- a/loops/rest/README.txt +++ b/loops/rest/README.txt @@ -2,8 +2,6 @@ loops.xmlrpc =============================================================== - ($Id$) - Let's do some basic set up >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown @@ -35,8 +33,8 @@ ZCML setup): Let's look what setup has provided us with: >>> sorted(concepts) - [u'domain', u'file', u'hasType', u'note', u'predicate', - u'standard', u'textdocument', u'type'] + ['domain', 'file', 'hasType', 'note', 'predicate', + 'standard', 'textdocument', 'type'] loops Traversal @@ -62,7 +60,7 @@ domain type concept (or the top-level type concept, if there is no domain type): >>> obj >>> obj.context.title - u'Domain' + 'Domain' The traversal adapter returns a view that when called renders the representation of its context object: diff --git a/loops/rest/common.py b/loops/rest/common.py index b02f51d..a9c28d8 100644 --- a/loops/rest/common.py +++ b/loops/rest/common.py @@ -1,28 +1,9 @@ -# -# 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 -# +# loops.rest.common -""" -Common stuff for REST (REpresentational State Transfer) views. - -$Id$ +""" Common stuff for REST (REpresentational State Transfer) views. """ -from zope.interface import implements +from zope.interface import implementer from zope.component import adapts from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserPublisher @@ -39,11 +20,11 @@ class IRESTView(IBrowserPublisher): """ +@implementer(IRESTView) class ConceptView(object): """ A REST view for a concept. """ - implements(IRESTView) adapts(IConcept, IBrowserRequest) def __init__(self, context, request):