Exemplo n.º 1
0
 def handle_post(self, params, path_info, host, post_data, request_method, format_obj = None):
     """Read data from the request and turn it into an UPDATE/DELETE action."""
     
     if format_obj:
         actions = []
         
         id = self.get_id_from_path_info(path_info)
         if id is not False:
             action = Action()
             action.method = "update"
             action.id = id
             
             features = format_obj.decode(post_data)
             
             action.feature = features[0]
             actions.append(action)
         
         else:
             if hasattr(format_obj, 'decode'):
                 features = format_obj.decode(post_data)
                 
                 for feature in features:
                     action = Action()
                     action.method = "insert"
                     action.feature = feature
                     actions.append(action)
         
             elif hasattr(format_obj, 'parse'):
                 format_obj.parse(post_data)
                 
                 transactions = format_obj.getActions()
                 if transactions is not None:
                     for transaction in transactions:
                         action = Action()
                         action.method = transaction.__class__.__name__.lower()
                         action.wfsrequest = transaction
                         actions.append(action)
         
         return actions
     else:
         raise Exception("Service type does not support adding features.")