src/ztfy/utils/tal/interfaces.py
branchZTK-1.1
changeset 148 d3668ecd9137
parent 136 aab380e3c821
equal deleted inserted replaced
147:044dc196ec8a 148:d3668ecd9137
       
     1 ### -*- coding: utf-8 -*- ####################################################
       
     2 ##############################################################################
       
     3 #
       
     4 # Copyright (c) 2008-2010 Thierry Florac <tflorac AT ulthar.net>
       
     5 # All Rights Reserved.
       
     6 #
       
     7 # This software is subject to the provisions of the Zope Public License,
       
     8 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     9 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
    10 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
    11 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    12 # FOR A PARTICULAR PURPOSE.
       
    13 #
       
    14 ##############################################################################
       
    15 
       
    16 __docformat__ = "restructuredtext"
       
    17 
       
    18 # import standard packages
       
    19 
       
    20 # import Zope3 interfaces
       
    21 
       
    22 # import local interfaces
       
    23 
       
    24 # import Zope3 packages
       
    25 from zope.interface import Interface
       
    26 
       
    27 # import local packages
       
    28 
       
    29 
       
    30 class ITextStartTalesAPI(Interface):
       
    31     """'start' TALES namespace interface"""
       
    32 
       
    33     def __getattr__(attr):
       
    34         """Get first characters of adapted text, without cutting words"""
       
    35 
       
    36 
       
    37 class ITextOutputTalesAPI(Interface):
       
    38     """'text' TALES namespace interface"""
       
    39 
       
    40     def js():
       
    41         """Convert adapted text to a JavaScript compatible output"""
       
    42 
       
    43     def noquotes():
       
    44         """Remove double quotes from adapted text"""
       
    45 
       
    46     def breaks():
       
    47         """Replace '|' by newlines in adapted text"""
       
    48 
       
    49     def translate():
       
    50         """Use I18n translation of given text"""
       
    51 
       
    52 
       
    53 class IHTMLTalesAPI(Interface):
       
    54     """'html' TALES namespace interface"""
       
    55 
       
    56     def renderer():
       
    57         """Get text to HTML renderer"""
       
    58 
       
    59     def totext():
       
    60         """Convert adapted HTML content to text"""
       
    61 
       
    62     def text():
       
    63         """Convert adapted text to HTML"""
       
    64 
       
    65     def stx():
       
    66         """Convert adapted StructuredText to HTML"""
       
    67 
       
    68     def rest():
       
    69         """Convert adapted reStructuredText to HTML"""
       
    70 
       
    71 
       
    72 class IRequestDataTalesAPI(Interface):
       
    73     """Request 'data' TALES namespace interface"""
       
    74 
       
    75     def __getattr__(attr):
       
    76         """Get request data for given attribute"""
       
    77 
       
    78 
       
    79 class ISessionDataTalesAPI(Interface):
       
    80     """Session data TALES namespace interface"""
       
    81 
       
    82     def __getattr__(attr):
       
    83         """Get session data for given app and key"""