Changeset 49

Show
Ignore:
Timestamp:
09/25/07 05:41:12 (1 year ago)
Author:
devja..@anarkystic.com
Message:

handle errors more

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • photobooth/photobooth.py

    r47 r49  
    7979            d.addCallback(lambda x: self.startCountdown()) 
    8080        self.bucket.append(evt.data) 
     81        d.addErrback(lambda _: None) 
    8182        return d 
    8283 
     
    100101        people = [self.people[tag] for tag in self.bucket if tag in self.people] 
    101102        return defer.succeed(people) 
    102         d = self._tagsToPeople() 
    103          
    104         def _addContacts(rv): 
    105             for p in rv: 
    106                 p['contacts'] = [{"id": "test", "name": p['name'] + "TEST"}, 
    107                                  {"id": "test2", "name": p['name'] + "TEST2"} 
    108                                     ] 
    109             return rv 
    110         #d.addCallback(_addContacts) 
    111         def _printError(e): 
    112             import traceback 
    113             traceback.print_exc() 
    114             return [] 
    115         d.addErrback(_printError) 
    116         return d 
    117103 
    118104    def _tagToPerson(self, tag): 
     
    125111                dict(uri='urn:rfid:%s'%(tag))) 
    126112        def _getId(rv): 
     113            if not rv: 
     114                raise NotFoundException("no user found for tag %s"%(tag)) 
    127115            return rv[0]['thg_id'] 
    128116 
     
    132120     
    133121    def _getPersonByThing(self, thing): 
     122        if not thing: 
     123            return None 
    134124        d = self.remote.call("picnic.persons.get", 
    135125                dict(id=thing)) 
     
    141131 
    142132    def _fillContacts(self, person): 
     133        if not person: 
     134            return None 
    143135        d = self.remote.call("picnic.relations.getList", 
    144136                dict(id=person['id']))