From 575e975930269645002d5aa57678069ad3403fb6 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 29 Jul 2011 02:44:04 -0400 Subject: [PATCH] Bugfix in user.name() and user.exists(). --- wiki/tools/user.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wiki/tools/user.py b/wiki/tools/user.py index b406b97..94a46d4 100644 --- a/wiki/tools/user.py +++ b/wiki/tools/user.py @@ -30,13 +30,13 @@ class User(object): self._emailable = None self._gender = None - def _get_attribute(self, attr, force): + def _get_attribute(self, attr, force, raise_exception=True): """ Docstring needed """ if self._exists is None or force: self._load_attributes() - if self._exists is False: + if self._exists is False and raise_exception: e = "User '{0}' does not exist.".format(self._name) raise UserNotFoundError(e) return getattr(self, attr) @@ -84,13 +84,13 @@ class User(object): """ Docstring needed """ - return self._get_attribute("_name", force) + return self._get_attribute("_name", force, raise_exception=False) def exists(self, force=False): """ Docstring needed """ - return self._get_attribute("_exists", force) + return self._get_attribute("_exists", force, raise_exception=False) def userid(self, force=False): """