#824: Number validator not working
------------------------+---------------------------------------------------
 Reporter:  anonymous   |        Owner:  anonymous
     Type:  defect      |       Status:  new      
 Priority:  normal      |    Milestone:           
Component:  TurboGears  |      Version:  0.9a5    
 Severity:  normal      |   Resolution:           
 Keywords:              |  
------------------------+---------------------------------------------------
Comment (by anonymous):

 In answer to your first question: No, I have other validators as well. I
 didn't include them to keep things simple. In my controller file I have a
 class:

 {{{
 class GroupAPIController(GroupController):

     validators = {
         "group_id": validators.Int(),
         "member_id": validators.Int(),
         "group_name": validators.String(),
         "owner_name": validators.String(),
         "joining": validators.Int(),
         "abcard_id": validators.Int(),
         "change": validators.String(),
         "last_sync_date": validators.Number(),
         "date": validators.Number()
         }

     <snip>

     @turbogears.expose(format='json', allow_json=True)
     @JSON_INPUT(validators = validators)
     def changedContactIDs(self, last_sync_date):
         """
         returns list of changed contact ids for all the groups to which
 the owner belongs
         """
         theChangedContactIDs = []
         theUser = self.CurrentUser()
         theGroups = theUser.groups
         for theGroup in theGroups:
             theContacts = theGroup.abCards
             for theContact in theContacts:
                 print "group ", theGroup.name, " has abcard with id: ",
 theContact.id
                 theModDate = theContact.changeDate
                 print "mod date: ", theModDate, " last sync date: ",
 last_sync_date
                 if theModDate > last_sync_date:
                     print "sending abcard id: ", theContact.id
                     theChangedContactIDs.append(theContact.id)
         return dict(contact_ids=theChangedContactIDs)

     <other stuff>

 }}}

 Basically, I am using a Cocoa client app to interact with the server using
 JSON. The other validators seem to work as they did before with no
 problems.

 As to your second question: I entered the same sequence into an
 interactive interpreter and got the same results as shown in your
 response.

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/824>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to