def clean_autoupdate(self): if self.cleaned_data['autoupdate']: self.ext_data = utils.read_hcard(self.instance.openid) if not self.ext_data: raise forms.ValidationError(_('No readable profile data found on %s') % self.instance.openid) else: self.ext_data = None return self.cleaned_data['autoupdate']
def update_profile(self): ''' Reads profile info from HTTP page and updates profile. Currently just reads hCard. ''' data = utils.read_hcard(self.openid) changes = {} if data: for key, value in data.items(): old_value = getattr(self, key) if old_value != value: setattr(self, key, value) changes[key] = (old_value, value) return changes