Package bscw :: Package api :: Module ap_create_addr
[hide private]

Module ap_create_addr

Creates new address or changes existing address. See create_addr() for a description.

API definition:

API = (('aname_or_id', 'ASCII string', 1),
       ('options', 'struct', 0, [('o_pending', 'boolean', 0),
       ('o_lang', 'ASCII string', 0),
       ('o_allocate', 'ASCII string', 0),
       ('o_primary', 'boolean', 0),
       ('o_bounced', 'boolean', 0),
       ('o_raise', 'boolean', 0),
       ('o_attrs', 'array', 0, [('attr', 'ASCII string', 1)])]))

(c) OrbiTeam Software, 2007-2010, www.bscw.de/copyright.html


Version: $Rev: 20112 $

Functions [hide private]
 
param_def()
return the parameter definition
 
return_def()
return the result definition
 
do_it(request, aname_or_id, options={})
see above
 
create_addr(request, aname_or_id, options={})
from ap_get_attributes import _attributes return ( ('addrattrs', STRUCT, 0, _attributes),
Variables [hide private]
  log_api = logging.getLogger('api')
  __package__ = 'bscw.api'
Function Details [hide private]

create_addr(request, aname_or_id, options={})

 
from ap_get_attributes import _attributes
return (
    ('addrattrs',    STRUCT, 0, _attributes),

Creates new address or changes existing address. The C{options}
dictionary may contain the following key/value parameter(s).

Examples:

>>> a_attrs = s.create_addr(aname_or_id='new1@bscw.de',
                        options={'o_allocate': 'newuser1'})
>>> a_attrs = s.create_addr(aname_or_id='new2@bscw.de',
                        options={
                            'o_allocate': 'newuser2',
                            'o_attrs': ['name', '__id__']})
>>> a_attrs = s.create_addr(aname_or_id='new3@bscw.de',
                        options={'o_allocate': '1234'})
>>> a_attrs = s.create_addr(aname_or_id='4567',
                        options={'o_pending': True, 'o_lang': 'de'})

@type  aname_or_id: str
@param aname_or_id:
    address name or ID of address object to be created/changed

@type  options: dict
@param options:
    dictionary with the following key/value parameter(s):

        - C{B{o_pending}} (bool) - create pending address (default)

        - C{B{o_lang}} (str) - language for pending addresses
          (optional)

        - C{B{o_allocate}} (str) - allocate address to user name or
          ID of user object

        - C{B{o_primary}} (bool) - use address as primary address
          (optional)

        - C{B{o_bounced}} (bool) - create bounced address

        - C{B{o_raise}} (bool) - raise fault if address already exists

        - C{B{ o_attrs}} (list) - list of address attributes to be
          returned, e.g. C{['__id__', 'ctime', 'atime', 'user' ...]} (see
          L{get_attributes()<ap_get_attributes.get_attributes>} for
          details)

@rtype: dict
@return:
    - dictionary of created address object attributes
    - raises fault C{(10104, 'Bad parameter')}