class LocationView(RecordView):
    def __init__(self, app, parent, records):
        RecordView.__init__(self, app, parent, records, LocationDoc,
                            'edit')
        self.manager = ClientManager(self.app)
        
    def setSource(self, url):
        action, context, id = str(url).split('.')
        dlg = EditLocationDialog(self.app, self, self.doc.records[int(id)].record)
        dlg.connect(dlg, SIGNAL('okClicked()'), self.updateRecord)
        self.dialogs['edit-location'] = dlg

    def updateRecord(self):
        dlg = self.dialogs['edit-location']
        data = dlg.getRecordData()
        locationid = dlg.record.locationid
        data['addressid'] = dlg.addressid
        print 'updateRecord', locationid
        self.manager.updateLocation(locationid, data)
        self.parent().emit(PYSIGNAL('updated()'), ())
        self.parent().close()