예제 #1
0
def test_split_select_field_options():
    assert_equals(h.split_select_field_options('"test message" test2'),
                  ['test message', 'test2'])
    assert_equals(h.split_select_field_options('"test message test2'),
                  ['test', 'message', 'test2'])
    assert_equals(h.split_select_field_options('abc ƒå∂ ººº'),
                  ['abc', 'ƒå∂', 'ººº'])
예제 #2
0
 def check_custom_field(self, field, value, ticket_status):
     field = c.app.globals.get_custom_field(field)
     if (field['type'] == 'select') and value:
         field_options = h.split_select_field_options(
             h.really_unicode(field['options']))
         if value not in field_options:
             field['options'] = ' '.join([field['options'], value])
     elif (field['type'] == 'milestone') and value:
         milestones = field['milestones']
         for milestone in milestones:
             if milestone['name'] == value:
                 if ticket_status in c.app.globals.open_status_names:
                     milestone['complete'] = False
                 break
         else:
             milestone = {
                 'due_date': '',
                 'complete':
                 not ticket_status in c.app.globals.open_status_names,
                 'description': '',
                 'name': value,
                 'old_name': value
             }
             field['milestones'].append(milestone)
     ThreadLocalORMSession.flush_all()
예제 #3
0
    def _select(field):
        options = []
        field_options = h.split_select_field_options(h.really_unicode(field.options))

        for opt in field_options:
            selected = False
            if opt.startswith('*'):
                opt = opt[1:]
                selected = True
            options.append(ew.Option(label=opt,html_value=opt,py_value=opt,selected=selected))
        return ew.SingleSelectField(label=field.label, name=str(field.name), options=options)
예제 #4
0
    def _select(field):
        options = []
        field_options = h.split_select_field_options(h.really_unicode(field.options))

        for opt in field_options:
            selected = False
            if opt.startswith('*'):
                opt = opt[1:]
                selected = True
            options.append(ew.Option(label=opt,html_value=opt,py_value=opt,selected=selected))
        return ew.SingleSelectField(label=field.label, name=str(field.name), options=options)
예제 #5
0
 def check_custom_field(self, field, value):
     field = c.app.globals.get_custom_field(field)
     if (field['type'] == 'select') and value:
         field_options = h.split_select_field_options(h.really_unicode(field['options']))
         if value not in field_options:
             field['options'] = ' '.join([field['options'], value])
     elif (field['type'] == 'milestone') and value:
         milestones = field['milestones']
         is_exists = False
         for milestone in milestones:
             if milestone['name'] == value:
                 is_exists = True
         if not is_exists:
             milestone = {'due_date': '',
                          'complete': False,
                          'description': '',
                          'name': value,
                          'old_name': value}
             field['milestones'].append(milestone)
     ThreadLocalORMSession.flush_all()
 def check_custom_field(self, field, value, ticket_status):
     field = c.app.globals.get_custom_field(field)
     if (field['type'] == 'select') and value:
         field_options = h.split_select_field_options(h.really_unicode(field['options']))
         if value not in field_options:
             field['options'] = ' '.join([field['options'], value])
     elif (field['type'] == 'milestone') and value:
         milestones = field['milestones']
         for milestone in milestones:
             if milestone['name'] == value:
                 if ticket_status in c.app.globals.open_status_names:
                     milestone['complete'] = False
                 break
         else:
             milestone = {'due_date': '',
                          'complete': not ticket_status in c.app.globals.open_status_names,
                          'description': '',
                          'name': value,
                          'old_name': value}
             field['milestones'].append(milestone)
     ThreadLocalORMSession.flush_all()
예제 #7
0
def test_split_select_field_options():
    assert_equals(h.split_select_field_options('"test message" test2'),
                  ['test message', 'test2'])
    assert_equals(h.split_select_field_options('"test message test2'),
                  ['test', 'message', 'test2'])
예제 #8
0
def test_split_select_field_options():
    assert_equals(h.split_select_field_options('"test message" test2'), ["test message", "test2"])
    assert_equals(h.split_select_field_options('"test message test2'), ["test", "message", "test2"])