예제 #1
0
파일: VarList.py 프로젝트: SmartTeleMax/ppa
 def __call__(
     self, field_type, field_name, event, context, filter, actions, params, template_selector, global_namespace
 ):
     if event.id == field_name.inForm + "-insert":
         AcceptEventHandler.actions(
             self, field_type, field_name, event, context, filter, params, template_selector, global_namespace
         )
         value = context.value[field_name]
         try:
             index = int(event.form.getString(field_name.inForm + "-index", ""))
         except ValueError:
             index = len(value)
         item_field_name = field_type.itemFieldName(field_name, index)
         item_value = field_type.itemField.getDefault(item_field_name, context, params)
         value.insert(index, item_value[item_field_name])
         actions.extend(
             RenderEventHandler.actions(
                 self, field_type, field_name, event, context, filter, params, template_selector, global_namespace
             )
         )
예제 #2
0
파일: VarList.py 프로젝트: SmartTeleMax/ppa
 def __call__(
     self, field_type, field_name, event, context, filter, actions, params, template_selector, global_namespace
 ):
     if event.id.startswith(field_name.inForm + "-delete"):
         AcceptEventHandler.actions(
             self, field_type, field_name, event, context, filter, params, template_selector, global_namespace
         )
         value = context.value[field_name]
         try:
             index = int(event.form.getString(field_name.inForm + "-index", ""))
         except ValueError:
             # clear all
             del value[:]
         else:
             try:
                 del context.value[field_name][index]
             except IndexError:
                 return
         actions.extend(
             RenderEventHandler.actions(
                 self, field_type, field_name, event, context, filter, params, template_selector, global_namespace
             )
         )