[sysadmin-bin] ftpadmin: lazily init moduleinfo, prevversion so data is correct when many tarball versions are inst
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] ftpadmin: lazily init moduleinfo, prevversion so data is correct when many tarball versions are inst
- Date: Thu, 26 May 2011 09:46:20 +0000 (UTC)
commit 4fd2cf385c690f4635fbc20ae449cf67e007c515
Author: Olav Vitters <olav vitters nl>
Date: Thu May 26 11:46:15 2011 +0200
ftpadmin: lazily init moduleinfo, prevversion so data is correct when many tarball versions are installed at once
ftpadmin | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 83f9501..e45b0dc 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -799,13 +799,24 @@ class InstallModule(BasicInfo):
self.destination = os.path.join(self.FTPROOT, self.section, self.fileinfo.module, self.majmin)
if DEBUG:
self.destination = os.path.join(self.FTPROOT_DEBUG, self.section, self.fileinfo.module, self.majmin)
-
- self.moduleinfo = ModuleInfo(self.fileinfo.module, section=self.section)
- self.prevversion = get_latest_version(self.moduleinfo.versions, self.version)
else:
- self.moduleinfo = None
+ self._moduleinfo = None
self.module = None
+ @property
+ def moduleinfo(self):
+ if not hasattr(self, '_moduleinfo'):
+ self._moduleinfo = ModuleInfo(self.fileinfo.module, section=self.section)
+
+ return self._moduleinfo
+
+ @property
+ def prevversion(self):
+ if not hasattr(self, '_prevversion'):
+ self._prevversion = get_latest_version(self.moduleinfo.versions, self.version)
+
+ return self._prevversion
+
def confirm_install(self):
print """
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]