def get_weibo_user(self): weibo_user = None try: weibo_user = getattr(WeiboUser, 'objects').get(uid=self.uid) except DoesNotExist: weibo_user = WeiboUser(uid=self.uid) weibo_user.save() return weibo_user
def get_weibo_user(self,uid): try: weibo_user = getattr(WeiboUser, 'objects').get(uid=uid) except DoesNotExist: weibo_user = WeiboUser(uid=uid) return weibo_user
def get_weibo_user(self): if self.bundle.weibo_user is not None: return self.bundle.weibo_user try: self.bundle.weibo_user = getattr(WeiboUser, 'objects').get(uid=self.uid) except DoesNotExist: self.bundle.weibo_user = WeiboUser(uid=self.uid) self.bundle.weibo_user.save() return self.bundle.weibo_user