Changeset 127

Show
Ignore:
Timestamp:
12/27/05 05:23:32
Author:
fenix
Message:

add docstrings to all classes and functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ShortMessage/trunk/Extensions/Install.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 13:10:10 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6""" 
     7This module is created for installing ShortMessage product to Plone site. 
     8 It has such functions: 
     9 
     10     - `install`: this function sets all types in ShortMessage product, also install skin directory and other 
     11     - `install_workflow`: this function create new workflow and sets it to ShortMessage type 
     12     - `setPortalFactoryType`: sets ShortMessage type to PortalFactory 
     13""" 
     14__docformat__ = 'restructuredtext' 
     15 
    116from Products.Archetypes.public import listTypes 
    217from Products.Archetypes.Extensions.utils import installTypes, install_subskin 
     
    924 
    1025def setPortalFactoryType(self, out,): 
     26    """sets ShortMessage type to PortalFactory""" 
    1127    pf=getToolByName(self, 'portal_factory') 
    1228    ftypes=list(pf.getFactoryTypes()) 
     
    2036 
    2137def install_workflow(self, out): 
    22  
     38    """this function create new workflow and sets it to ShortMessage type""" 
    2339    setupWorkflow(self) 
    2440    print >> out, "Installed workflow..." 
    2541 
    2642def install(self): 
    27  
     43    """this function sets all types in ShortMessage product, also install skin directory and other""" 
    2844    out=StringIO(); 
    2945 
  • ShortMessage/trunk/Extensions/Sm_Workflow.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 13:33:15 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6""" 
     7This is workflow for ShortMessage type that sends SMS upon object publishing. 
     8This module define the following functions: 
     9 
     10    - `createWorkflow`: create new workflow. 
     11    - `fillWorkflow`: takes created workflow and add to it state, transitions, permissions and etc. 
     12    - `addWorkflowScripts`: add ExternalMethod named send_publishedMessage to the workflow 
     13    - `setupWorkflow`: setup created workflow to portal and set it to ShortMessage type 
     14    - `send_publishedMessage`: Send message if it is published 
     15""" 
     16__docformat__ = 'restructuredtext' 
     17 
    118from Products.DCWorkflow.DCWorkflow import DCWorkflowDefinition 
    219from Products.CMFCore.CMFCorePermissions import ModifyPortalContent 
     
    926from Products import ShortMessage 
    1027 
    11 #add ExternalMethod named 'send_publishedMessage' 
    1228def addWorkflowScripts(wf): 
     29    """add ExternalMethod named send_publishedMessage to the workflow""" 
    1330    if 'send_publishedMessage' not in wf.scripts.objectIds(): 
    1431        wf.scripts.manage_addProduct['ExternalMethod'].manage_addExternalMethod('send_publishedMessage', 'Send Message', 'ShortMessage.Sm_Workflow', 'send_publishedMessage') 
    1532 
    1633def fillWorkflow(wf): 
     34    """takes created workflow and add to it state, transitions, permissions and etc""" 
    1735    for state in  ('pending', 'visible', 'published',): 
    1836        wf.states.addState(state) 
     
    3553    wf_visible.setPermission(p_modify, 0, (r_manager, r_owner)) 
    3654 
    37 #    wf.permissions+=(CMFCorePermissions.ListFolderContents, ) 
    38 #    wf.states.private.permission_roles[CMFCorePermissions.ListFolderContents]=['Authenticated', r_manager] 
    3955 
    4056    wf_visible = wf.states['pending'] 
     
    5470    wf_published.setPermission(p_modify, 0, (r_manager, )) 
    5571 
    56 #    wf.states.published.permission_roles[CMFCorePermissions.ListFolderContents]=[r_anon,] 
    5772 
    5873    tdef = wf.transitions['submit'] 
     
    102117 
    103118def send_publishedMessage(self, state_change): 
    104     """Sending message if it is published""" 
     119    """Send message if it is published""" 
    105120    message_obj = state_change.object 
    106121    #send message to user(s) 
    107122    state_change.getPortal().portal_smsCommunicator.send_Request(message_obj.getSender(), message_obj.getRecipient(), message_obj.getBody()) 
    108123 
    109 #create workflow 
    110124def createWorkflow(id): 
     125    """create new workflow""" 
    111126    wf = DCWorkflowDefinition(id) 
    112127    fillWorkflow(wf) 
  • ShortMessage/trunk/HISTORY.txt

    r126 r127  
     10.1.4 2005-12-27 
     2================ 
     3 
     4 - add docstring to all classes and functions 
     5  
    160.1.3 2005-11-14 
    27================ 
  • ShortMessage/trunk/INSTALL.txt

    r126 r127  
     1 
     2   Product installation 
     3   ==================== 
     4 
     5   For installation you must first off all copy ShortMessage 
     6   to your Products directory, second restart your instance  
     7   then go to plone setup->Add/Remove Products and install ShortMessage. 
  • ShortMessage/trunk/README.txt

    r126 r127  
     1Quintagroup ShortMessage 
     2 
     3    This product lets you create your own short message in Plone websites. 
     4    It consists of sender, recipient or recipients, and body(message text). 
     5    But if you want to send this short message you also need to install 
     6    PloneSMSCommunicator on your Plone site. If you installed PloneSMSCommunicator 
     7    then you can send your message to somebody. For that you must do three things: 
     8        - you must create new short message or select old one 
     9        - change state from visible to submit 
     10        - and the last step that is sending message to recipient is: 
     11          you have to publish your message and for that you must have manager rights 
  • ShortMessage/trunk/ShortMessage.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 12:57:23 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6"""ShortMessage is Archetypes-based content type. It has Workflow that sends Short message upon object publishing. 
     7   This module defines the following classes: 
     8 
     9    - `ShortMessage`, a ShortMessage type that allows you to create your own short message 
     10   Methods: 
     11    - `ShortMessage.setDefaultSender`: sets none to Sender field if policy is free and enforceOriginator in other case""" 
     12 
     13__docformat__ = 'restructuredtext' 
     14 
    115from Products.CMFCore.utils import getToolByName 
    216from Products.Archetypes.public import * 
     
    3650 
    3751class ShortMessage(BaseContent): 
    38  
     52    """ShortMessage type allows you to create your own short message""" 
    3953    schema = schema 
    4054    archetype_name=ARCHETYPE_NAME 
    4155 
    4256    def setDefaultSender(self): 
     57        """ sets none to Sender field if policy is free and enforceOriginator in other case""" 
    4358        communicator = getToolByName(self, 'portal_smsCommunicator') 
    4459        policy = communicator.getProperty('policy') 
  • ShortMessage/trunk/__init__.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 13:10:22 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6""" 
     7This is the init module for ShortMessage product that will initialize all 
     8types in product. 
     9""" 
     10__docformat__ = 'restructuredtext' 
     11 
    112from Products.Archetypes.public import * 
    213from Products.CMFCore import utils 
     
    415from config import * 
    516 
    6 #registerDirectory(SKINS_DIR, GLOBALS) 
    717 
    818def initialize(context): 
  • ShortMessage/trunk/tests/testSm.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 13:47:40 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6"""This module contains class that tests short message """ 
     7 
    18from Testing import ZopeTestCase 
    29from Products.Archetypes.tests import ArchetypesTestCase 
  • ShortMessage/trunk/validators.py

    r126 r127  
     1# Author: Melnychuk Taras 
     2# Contact: fenix@quintagroup.com 
     3# Date: $Date: 2005-11-23 13:15:21 +0200 (Thu, 23 Nov 2005) $ 
     4# Copyright: quintagroup.com 
     5 
     6"""In this module define MaxSmValidator class that validate text block not more then 160 symbols""" 
     7 
     8__docformat__ = 'restructuredtext' 
     9 
    110from Products.validation.interfaces.IValidator import IValidator 
    211 
    312class MaxSmValidator: 
    4     """validator for short message""" 
    513 
    614    __implements__ = IValidator 
  • ShortMessage/trunk/version.txt

    r126 r127  
    1 0.1.3 
     10.1.4