summaryrefslogtreecommitdiff
path: root/devel/management/commands/reporead.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-23 19:50:46 -0500
committerDan McGee <dan@archlinux.org>2011-06-23 19:50:46 -0500
commit9156003d2d93de57c663901c39ac66316a3d969e (patch)
treea11c64cdc867e03f113f84e55152d15ad114b469 /devel/management/commands/reporead.py
parent26c54d017185b1c409dbd6ed4c09fb14986df0b3 (diff)
Turn find_user into UserFinder class
This moves the cache inside an instance. Also add a few more tests. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/management/commands/reporead.py')
-rw-r--r--devel/management/commands/reporead.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index 138931ff..470b785d 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -27,7 +27,7 @@ import logging
from datetime import datetime
from optparse import make_option
-from devel.utils import find_user
+from devel.utils import UserFinder
from main.models import Arch, Package, PackageDepend, PackageFile, Repo
from packages.models import Conflict, Provision, Replacement
@@ -182,6 +182,8 @@ def create_multivalued(dbpkg, repopkg, db_attr, repo_attr):
for name in getattr(repopkg, repo_attr):
collection.create(name=name)
+finder = UserFinder()
+
def populate_pkg(dbpkg, repopkg, force=False, timestamp=None):
db_score = 1
@@ -200,7 +202,7 @@ def populate_pkg(dbpkg, repopkg, force=False, timestamp=None):
dbpkg.build_date = repopkg.builddate
dbpkg.packager_str = repopkg.packager
# attempt to find the corresponding django user for this string
- dbpkg.packager = find_user(repopkg.packager)
+ dbpkg.packager = finder.find(repopkg.packager)
if timestamp:
dbpkg.flag_date = None