[Zope3-checkins]
CVS: Zope3/src/zope/products/codecontent/interfaces
- __init__.py:1.1.2.1 dtmlpage.py:1.1.2.1 sql.py:1.1.2.1
zpt.py:1.1.2.1
Philipp von Weitershausen
philikon at philikon.de
Sun Feb 8 09:03:44 EST 2004
Update of /cvs-repository/Zope3/src/zope/products/codecontent/interfaces
In directory cvs.zope.org:/tmp/cvs-serv10229/products/codecontent/interfaces
Added Files:
Tag: philikon-movecontent-branch
__init__.py dtmlpage.py sql.py zpt.py
Log Message:
Move zope.app.content,
zope.app.interfaces.content,
and zope.app.browser.content
to zope.products.content and zope.products.codecontent, respectively.
=== Added File Zope3/src/zope/products/codecontent/interfaces/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/products/codecontent/interfaces/dtmlpage.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: dtmlpage.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
import zope.schema
from zope.interface import Interface, Attribute
from zope.app.i18n import ZopeMessageIDFactory as _
class IDTMLPage(Interface):
"""DTML Pages are a persistent implementation of DTML."""
def setSource(text, content_type='text/html'):
"""Save the source of the page template."""
def getSource():
"""Get the source of the page template."""
source = zope.schema.Text(
title=_(u"Source"),
description=_(u"""The source of the dtml page."""),
required=True)
class IRenderDTMLPage(Interface):
content_type = Attribute('Content type of generated output')
def render(request, *args, **kw):
"""Render the page template.
The first argument is bound to the top-level 'request'
variable. The positional arguments are bound to the 'args'
variable and the keyword arguments are bound to the 'options'
variable.
"""
=== Added File Zope3/src/zope/products/codecontent/interfaces/sql.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: sql.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
import zope.schema
from zope.app import zapi
from zope.app.interfaces.rdb import IZopeDatabaseAdapter, ISQLCommand
from zope.component import getService, ComponentLookupError
from zope.app.i18n import ZopeMessageIDFactory as _
class MissingInput(Exception):
pass
class SQLConnectionName(zope.schema.TextLine):
"""SQL Connection Name"""
def __allowed(self):
"""Note that this method works only if the Field is context wrapped."""
try:
connections = zapi.getUtilitiesFor(self.context,
IZopeDatabaseAdapter)
except ComponentLookupError:
return []
return [c[0] for c in connections]
allowed_values = property(__allowed)
class ISQLScript(ISQLCommand):
"""A persistent script that can execute SQL."""
connectionName = SQLConnectionName(
title=_(u"Connection Name"),
description=_(u"The Connection Name for the connection to be used."),
required=False)
arguments = zope.schema.BytesLine(
title=_(u"Arguments"),
description=_(
u"A set of attributes that can be used during the SQL command "
u"rendering process to provide dynamic data."),
required=False,
default='',
missing_value='')
source = zope.schema.ASCII(
title=_(u"Source"),
description=_(u"The SQL command to be run."),
required=False,
default='',
missing_value='')
def getArguments():
"""Returns a set of arguments. Note that this is not a string!"""
def getTemplate():
"""Get the SQL DTML Template object."""
=== Added File Zope3/src/zope/products/codecontent/interfaces/zpt.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Templated Page Content Component Interfaces
$Id: zpt.py,v 1.1.2.1 2004/02/08 14:03:42 philikon Exp $
"""
from zope.schema import SourceText, Bool
from zope.interface import Interface, Attribute
from zope.app.i18n import ZopeMessageIDFactory as _
class IZPTPage(Interface):
"""ZPT Pages are a persistent implementation of Page Templates."""
def setSource(text, content_type='text/html'):
"""Save the source of the page template.
'text' must be Unicode.
"""
def getSource():
"""Get the source of the page template."""
source = SourceText(
title=_("Source"),
description=_("The source of the page template."),
required=True)
expand = Bool(
title=_("Expand macros"),
description=_("Expand Macros so that they all are shown in the "
"code."),
default=False,
required=True)
evaluateInlineCode = Bool(
title=_("Evaluate Inline Code"),
description=_("Evaluate code snippets in TAL. We usually discourage "
"people from using this feature."),
default=False,
required=True)
class IRenderZPTPage(Interface):
content_type = Attribute('Content type of generated output')
def render(request, *args, **kw):
"""Render the page template.
The first argument is bound to the top-level 'request'
variable. The positional arguments are bound to the 'args'
variable and the keyword arguments are bound to the 'options'
variable.
"""
More information about the Zope3-Checkins
mailing list