I am attempting to modify some plugin code, despite my lack of python
knowledge. I wanted to add type checking to the validator plugin, and so
I added the modified  the function. With a trac.ini entry of

 

[fieldscheck]

int_fields=Hours

 

and running this code :

 

    def validate_ticket(self, req, ticket):

        """Make sure required fields for the next state have been

        the ticket will be in have been entered."""

 

        state = self._get_state(req, ticket)

 

        editcheck_fields =
self.config.getlist('fieldscheck','int_fields')

 

        errors = [(field_name, '%s must be an integer' % field_name)

                  for field_name in editcheck_fields

                  if self._is_not_integer(ticket[field_name])]

 

        required_fields = self.config.getlist('ticketvalidator',

                                              state + '.required')

 

        errors = errors + [(field_name, '%s is required' % field_name)

                  for field_name in required_fields

                  if self._is_empty(ticket[field_name])]

 

        return errors

 

 

I get :

TypeError: cannot concatenate 'str' and 'list' objects

 

On the line :

 

if self._is_not_integer(ticket[field_name])]

 

I get the feeling this is just a python problem of mine and not
something intrinsic to TRAC, but I thought I'd ask you guys anyways.

 

Thanks in advance.

 

Dan Winslow
Director of Information Technology, AIM INSTITUTE
1905 Harney Street, Suite 700
Omaha, NE 68102
402-345-5025 x156
[email protected]
www.aiminstitute.org

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to