Metadata-Version: 1.1
Name: slc.zopescript
Version: 1.0.4
Summary: Base classes for running code as Zope console scripts
Home-page: http://pypi.python.org/pypi/slc.zopescript
Author: Syslab.com GmbH
Author-email: info@syslab.com
License: BSD
Description: .. image:: https://secure.travis-ci.org/plone/plone.api.png
            :target: http://travis-ci.org/#!/plone/plone.api
        
        ====================
        slc.zopescript
        ====================
        
        Base classes for running code as Zope console scripts
        
        * `Source code @ GitHub <https://github.com/syslabcom/slc.zopescript>`_
        * `Releases @ PyPI <http://pypi.python.org/pypi/slc.zopescript>`_
        * `Documentation @ ReadTheDocs <http://slczopescript.readthedocs.org>`_
        * `Continuous Integration @ Travis-CI <http://travis-ci.org/syslabcom/slc.zopescript>`_
        
        Installation
        ============
        
        To install `slc.zopescript` you add ``slc.zopescript``
        to the dependencies of your own egg.
        
        Usage
        =====
        
        slc.zopescript allows running code from the command line with a full Zope
        instance and request available.
        
        To create a console script you can derive a class from
        `slc.zopescript.script.ConsoleScript` and implement the `run()` method. The
        Zope app will be available as self.app and the first Plone Site as self.portal. 
        If you pass a context_path then self.context will be the object represented by
        this path; otherwise self.context will be the portal as well.
        A request will be set up so that you can e.g. call browser views.
        Example::
        
            from my.egg import MailHandler
            from slc.zopescript.script import ConsoleScript
        
        
            class MailHandlerScript(ConsoleScript):
                def run(self):
                    mailhandler_view = MailHandler(self.context, self.context.REQUEST)
                    mailhandler_view()
        
            mail_handler = MailHandlerScript()
        
        
        In your buildout you can generate the console script e.g. with zc.recipe.egg::
        
            [mail_handler]
            recipe = zc.recipe.egg
            eggs = ${instance:eggs}
            scripts = mail_handler
            arguments = '${instance:location}/etc/zope.conf','admin',server_url='http://localhost:8081/Plone',context_path='/Plone/news'
        
        The first argument must be the path to a valid zope.conf file. The second
        argument is the user to run the script as. The optional server_url should be
        the URL under which your site is externally reachable and allows you to use
        meaningful absolute_url() calls. The optional context_path is the path to
        an object that will be available as self.context in your script class.
        :orphan:
        
        Changelog
        =========
        
        
        1.0.4 (2017-08-29)
        ------------------
        
        - Improve log handling:
        
          * only log errors during startup
          * log INFO to stdout
          * log ERROR to stderr
          * log to instance's event.log too
        
          This makes it possible to only escalate errors in cronjobs, send
          normal logging to /dev/null and protocol what has been done in
          the instance.log
        
          [frisi]
        
        
        1.0.3 (2016-05-19)
        ------------------
        
        - traverse to context as run_as user [reinhardt]
        - Allow selecting a portal by id [reinhardt]
        
        
        1.0.2 (2016-03-18)
        ------------------
        
        - better manifest [reinhardt]
        
        
        1.0.1 (2016-03-18)
        ------------------
        
        - Allow passing a context_path [reinhardt]
        - Updated README [reinhardt]
        
        
        1.0 (2015-12-11)
        ----------------
        
        - Initial release.
          [reinhardt]
        
        :orphan:
        
        License (3-clause BSD)
        ======================
        
        Copyright (c) 2013, Syslab.com GmbH. All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
         * Redistributions of source code must retain the above copyright notice,
           this list of conditions and the following disclaimer.
        
         * Redistributions in binary form must reproduce the above copyright
           notice, this list of conditions and the following disclaimer in the
           documentation and/or other materials provided with the distribution.
        
         * Neither the name of Syslab.com GmbH. nor the names of its contributors may
           be used to endorse or promote products derived from this software
           without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL SYSLAB.COM GMBH BE LIABLE FOR ANY
        DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
        (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
        ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
        
Keywords: Zope console script
Platform: UNKNOWN
Classifier: Framework :: Zope2
Classifier: Programming Language :: Python
