def create_user_profile(self, args):
    self.log.debug(('create_user_profile: %r' % args))
    try:
        exist = self.get_user_profile(g.user.id)
        if (not exist):
            return self.db.add_object_kwargs(UserProfile, **args).dic()
        else:
            return self.update_user_profile(args)
    except Exception as e:
        self.log.debug(e)
        return internal_server_error('failed to create user profile')
def create_user_profile(self, args):
    self.log.debug(('create_user_profile: %r' % args))
    try:
        exist = self.get_user_profile(g.user.id)
        if (not exist):
            return self.db.add_object_kwargs(UserProfile, **args).dic()
        else:
            return self.update_user_profile(args)
    except Exception as e:
        self.log.debug(e)
        return internal_server_error('failed to create user profile')