Esempio n. 1
0
File: LM.py Progetto: MarkTang/erp5
 def __init__(self, id, title, connection_id, basedn, arguments, ldif, **kw):
   """ init method """
   self.id = id
   self.title = title
   self.connection_id = connection_id
   self.basedn = basedn
   self.arguments_src=self.arguments=arguments
   self._arg=parse(arguments)
   self.ldif = str(ldif)
Esempio n. 2
0
 def __init__(self, id, title, connection_id, basedn, arguments, ldif,
              **kw):
     """ init method """
     self.id = id
     self.title = title
     self.connection_id = connection_id
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.ldif = str(ldif)
Esempio n. 3
0
 def __init__(self, id, title, connection_id, scope, basedn, arguments, filters):
     """ init method """
     self.id = id
     self.title = title
     self.connection_id = connection_id
     self._scope = _ldapScopes[scope]
     self.scope = scope
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.filters = filters
Esempio n. 4
0
 def __init__(self, id, title, connection_id, scope, basedn, arguments,
              filters):
     """ init method """
     self.id = id
     self.title = title
     self.connection_id = connection_id
     self._scope = _ldapScopes[scope]
     self.scope = scope
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.filters = filters
Esempio n. 5
0
File: LM.py Progetto: MarkTang/erp5
 def manage_edit(self, title, connection_id, basedn, arguments, ldif, REQUEST=None, **kw):
   """ commit changes """
   self.title = title
   self.connection_id = connection_id
   self.basedn = basedn
   self.arguments_src = self.arguments = arguments
   self._arg = parse(arguments)
   self.ldif = str(ldif)
   if REQUEST is not None:
     return MessageDialog(
       title = 'Edited',
       message = '<strong>%s</strong> has been changed.' % self.id,
       action = './manage_main', )
Esempio n. 6
0
 def manage_edit(self, title, connection_id, scope, basedn, arguments, filters, REQUEST=None):
     """ commit changes """
     self.title = title
     self.connection_id = connection_id
     self._scope = _ldapScopes[scope]
     self.scope = scope
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.filters = filters
     if REQUEST is not None:
         return MessageDialog(
             title="Edited", message="<strong>%s</strong> has been changed." % self.id, action="./manage_main"
         )
Esempio n. 7
0
 def deserialize(self, event, state):
     obj = event.obj
     assert isinstance(state, StringType)
     assert isinstance(obj, SQL)
     body = state
     m = self.params_re.match(body)
     if m:
         obj.arguments_src = m.group(1)
         body = body[m.end():]
     else:
         obj.arguments_src = ''
     obj._arg = parse(obj.arguments_src)
     obj.src = body
     obj.template = obj.template_class(body)
     obj.template.cook()
     obj._v_cache = ({}, Bucket())
     if not hasattr(obj, 'connection_id'):
         obj.connection_id = ''
Esempio n. 8
0
File: DA.py Progetto: Elbagoury/erp5
def DA_PUT(self, REQUEST, RESPONSE):
    """Handle put requests"""
    if RESPONSE is not None: self.dav__init(REQUEST, RESPONSE)
    if RESPONSE is not None:
        self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
    body = REQUEST.get('BODY', '')
    m = re.match('\s*<dtml-comment>(.*?)</dtml-comment>\s*\n', body,
                 re.I | re.S)
    if m:
        property_src = m.group(1)
        parameters = {}
        for line in property_src.split('\n'):
            pair = line.split(':', 1)
            if len(pair) != 2:
                continue
            parameters[pair[0].strip().lower()] = pair[1].strip()
        # check for required and optional parameters
        max_rows = parameters.get('max_rows', 1000)
        max_cache = parameters.get('max_cache', 100)
        cache_time = parameters.get('cache_time', 0)
        class_name = parameters.get('class_name', '')
        class_file = parameters.get('class_file', '')
        title = parameters.get('title', '')
        connection_id = parameters.get('connection_id', '')
        self.manage_advanced(max_rows, max_cache, cache_time, class_name,
                             class_file)
        self.title = str(title)
        self.connection_id = str(connection_id)
        body = body[m.end():]
    m = re.match('\s*<params>(.*)</params>\s*\n', body, re.I | re.S)
    if m:
        self.arguments_src = m.group(1)
        self._arg = parse(self.arguments_src)
        body = body[m.end():]
    template = body
    self.src = template
    self.template = t = self.template_class(template)
    t.cook()
    self._v_cache = {}, Bucket()
    if RESPONSE is not None: RESPONSE.setStatus(204)
    return RESPONSE
Esempio n. 9
0
 def manage_edit(self,
                 title,
                 connection_id,
                 basedn,
                 arguments,
                 ldif,
                 REQUEST=None,
                 **kw):
     """ commit changes """
     self.title = title
     self.connection_id = connection_id
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.ldif = str(ldif)
     if REQUEST is not None:
         return MessageDialog(
             title='Edited',
             message='<strong>%s</strong> has been changed.' % self.id,
             action='./manage_main',
         )
Esempio n. 10
0
def DA_PUT(self, REQUEST, RESPONSE):
    """Handle put requests"""
    if RESPONSE is not None: self.dav__init(REQUEST, RESPONSE)
    if RESPONSE is not None: self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
    body = REQUEST.get('BODY', '')
    m = re.match('\s*<dtml-comment>(.*?)</dtml-comment>\s*\n', body, re.I | re.S)
    if m:
        property_src = m.group(1)
        parameters = {}
        for line in property_src.split('\n'):
          pair = line.split(':',1)
          if len(pair)!=2:
            continue
          parameters[pair[0].strip().lower()]=pair[1].strip()
        # check for required and optional parameters
        max_rows = parameters.get('max_rows',1000)
        max_cache = parameters.get('max_cache',100)
        cache_time = parameters.get('cache_time',0)
        class_name = parameters.get('class_name','')
        class_file = parameters.get('class_file','')
        title = parameters.get('title','')
        connection_id = parameters.get('connection_id','')
        self.manage_advanced(max_rows, max_cache, cache_time, class_name, class_file)
        self.title = str(title)
        self.connection_id = str(connection_id)
        body = body[m.end():]
    m = re.match('\s*<params>(.*)</params>\s*\n', body, re.I | re.S)
    if m:
        self.arguments_src = m.group(1)
        self._arg=parse(self.arguments_src)
        body = body[m.end():]
    template = body
    self.src = template
    self.template=t=self.template_class(template)
    t.cook()
    self._v_cache={}, Bucket()
    if RESPONSE is not None: RESPONSE.setStatus(204)
    return RESPONSE
Esempio n. 11
0
 def manage_edit(self,
                 title,
                 connection_id,
                 scope,
                 basedn,
                 arguments,
                 filters,
                 REQUEST=None):
     """ commit changes """
     self.title = title
     self.connection_id = connection_id
     self._scope = _ldapScopes[scope]
     self.scope = scope
     self.basedn = basedn
     self.arguments_src = self.arguments = arguments
     self._arg = parse(arguments)
     self.filters = filters
     if REQUEST is not None:
         return MessageDialog(
             title='Edited',
             message='<strong>%s</strong> has been changed.' % self.id,
             action='./manage_main',
         )