def default_settings( cls ):
     """:meth:`pluggdapps.plugin.ISettings.default_settings` interface 
     method."""
     ds = h.ConfigDict()
     ds.__doc__ = (
         "Base class for all Tayra template plugins. This class does not "
         "provide any configurable parameters, instead refer to "
         "corresponding TTL-Plugin configuration." )
     return ds
def DEFAULT():
    """Global default settings that are applicable to all plugins and
    sections, and can be overriden by base configuration file's 'DEFAULT'
    section. Semantic meaning of [DEFAULT] section is same as described by
    ``configparser`` module from stdlib."""
    sett = h.ConfigDict()
    sett.__doc__ = (
        "Configuration settings under this section are global and applicable "
        "every other sections.")
    sett['debug'] = {
        'default':
        False,
        'types': (bool, ),
        'help':
        "Set this to True while developing with pluggdapps. This "
        "will enable useful logging and other features like "
        "module reloading. Can be modified only in the .ini "
        "file.",
        'webconfig':
        False,
    }
    return sett
Example #3
0
    @classmethod
    def default_settings(cls):
        """:meth:`pluggdapps.plugin.ISettings.default_settings` interface
        method.
        """
        return _default_settings

    @classmethod
    def normalize_settings(cls, sett):
        """:meth:`pluggdapps.plugin.ISettings.normalize_settings` interface
        method.
        """
        return sett


_default_settings = h.ConfigDict()
_default_settings.__doc__ = ConfigSqlite3DB.__doc__

_default_settings['url'] = {
    'default':
    '',
    'types': (str, ),
    'help':
    "Location of sqlite3 backend file. Will be passed to "
    "sqlite3.connect() API. Can be modified only in the .ini "
    "file.",
    'webconfig':
    False,
}
def mountloc_defaultsett():
    sett = h.ConfigDict()
    sett.__doc__ = "Mount application settings"
    return sett
def pluggdapps_defaultsett():
    """Default settings for [pluggdapps] section in ini file."""
    sett = h.ConfigDict()
    sett.__doc__ = "Platform settings."
    sett['configdb'] = {
        'default':
        'pluggdapps.ConfigSqlite3DB',
        'types': (str, ),
        'help':
        "Backend plugin to persist configurations done via "
        "webadmin application. Can be modified only in the .ini "
        "file.",
        'webconfig':
        False,
    }
    sett['host'] = {
        'default':
        'localhost',
        'types': (str, ),
        'help':
        "Top level domain name of host, web server, which "
        "receives the request. Can be modified only in the .ini "
        "file.",
        'webconfig':
        False,
    }
    sett['logging.file'] = {
        'default':
        '',
        'types': (str, ),
        'help':
        "File name to log messages. Make sure to add `file` in "
        "`logging.output` parameter."
    }
    sett['logging.output'] = {
        'default': 'console',
        'types': (str, ),
        'help': "Comma separated value of names to log messages. "
        "Supported names are `console`, `file`.",
        'options': ['console', 'file'],
    }
    sett['port'] = {
        'default':
        8080,
        'types': (int, ),
        'help':
        "Port addres to bind the http server. This "
        "configuration will be used when using pluggdapps' "
        "native HTTP server. Can be modified only in the .ini "
        "file.",
        'webconfig':
        False,
    }
    sett['scheme'] = {
        'default':
        'http',
        'types': (str, ),
        'help':
        "HTTP Scheme to use, either `http` or `https`. This "
        "configuration will be used when using pluggdapps' "
        "native HTTP server. Can be modified only in the .ini "
        "file.",
        'webconfig':
        False,
    }
    return sett
import datetime as dt
from http.cookies import SimpleCookie
from os.path import splitext, isfile

from pluggdapps.plugin import implements, Plugin
from pluggdapps.web.interfaces import IHTTPResponse, IHTTPOutBound
from pluggdapps.interfaces import ITemplate
import pluggdapps.utils as h

# TODO :
#   1. user locale (server side).
#   2. Browser locale.
#   3. clear_cookie() method doesn't seem to use expires field to remove the
#      cookie from browser. Should we try that implementation instead ?

_ds1 = h.ConfigDict()
_ds1.__doc__ = (
    "Configuration settings for HTTPResponse implementing IHTTPResponse "
    "interface.")


class HTTPResponse(Plugin):
    """Plugin to encapsulate HTTP response."""

    implements(IHTTPResponse)

    start_response = False
    """Response headers are already sent on the connection."""

    write_buffer = []
    """Either a list of byte-string buffered by write() method. Or a generator
Example #7
0
 def default_settings(cls):
     return h.ConfigDict()