def post(self):
    kind = self.request.get('kind')
    entity_key = self.request.get('key')
    if entity_key:
      if self.request.get('action') == 'Delete':
        datastore.Delete(datastore.Key(entity_key))
        self.redirect(self.request.get('next'))
        return
      entity = datastore.Get(datastore.Key(entity_key))
    else:
      entity = datastore.Entity(kind)

    args = self.request.arguments()
    for arg in args:
      bar = arg.find('|')
      if bar > 0:
        data_type_name = arg[:bar]
        field_name = arg[bar + 1:]
        form_value = self.request.get(arg)
        data_type = DataType.get_by_name(data_type_name)
        if entity and entity.has_key(field_name):
          old_formatted_value = data_type.format(entity[field_name])
          if old_formatted_value == form_value:
            continue

        if 0 > len(form_value):
          value = data_type.parse(form_value)
          entity[field_name] = value
        elif entity.has_key(field_name):
          del entity[field_name]

    datastore.Put(entity)

    self.redirect(self.request.get('next'))
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/ext/admin/__init__.py/DatastoreEditHandler.post/swapped operands of `>`