summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2010-01-20 12:56:56 -0500
committerBill Peck <bpeck@redhat.com>2010-01-20 12:56:56 -0500
commitfcaec3faeaeffe96ae96eb2c8482678c1e672bae (patch)
tree8c4c5d83a4ecd62b0da034f5a4b625faf31ad02c
parent6a28a31b7d1b30f9e5de58ef19e9508fb062ca93 (diff)
-rw-r--r--[-rwxr-xr-x]Server/beaker/server/needpropertyxml.py38
-rw-r--r--beaker.spec4
2 files changed, 25 insertions, 17 deletions
diff --git a/Server/beaker/server/needpropertyxml.py b/Server/beaker/server/needpropertyxml.py
index 5c09ad4..6cf1a82 100755..100644
--- a/Server/beaker/server/needpropertyxml.py
+++ b/Server/beaker/server/needpropertyxml.py
@@ -41,12 +41,6 @@ class ElementWrapper(object):
'<' : '__lt__',
'<=' : '__le__'}
- # Alias counter for each sub table
- alias = { 'key_value' : 0,
- 'arch' : 0,
- 'distro_tag' : 0,
- }
-
@classmethod
def get_subclass(cls, element):
name = element._name
@@ -55,8 +49,17 @@ class ElementWrapper(object):
return subclassDict[name]
return UnknownElement
- def __init__(self, wrappedEl):
+ def __init__(self, wrappedEl, alias=None):
self.wrappedEl = wrappedEl
+ if alias:
+ self.alias = alias
+ else:
+ ## Alias counter for each sub table
+ self.alias = { 'key_value' : 0,
+ 'arch' : {},
+ 'distro_tag' : 0,
+ }
+
def __repr__(self):
return '%s("%s")' % (self.__class__, repr(self.wrappedEl))
@@ -64,14 +67,14 @@ class ElementWrapper(object):
def __iter__(self):
for child in self.wrappedEl:
if isinstance(child, xmltramp.Element):
- yield ElementWrapper.get_subclass(child)(child)
+ yield ElementWrapper.get_subclass(child)(child,self.alias)
else:
yield child
def __getitem__(self, n):
child = self.wrappedEl[n]
if isinstance(child, xmltramp.Element):
- return ElementWrapper.get_subclass(child)(child)
+ return ElementWrapper.get_subclass(child)(child,self.alias)
else:
return child
@@ -376,13 +379,16 @@ class XmlArch(ElementWrapper):
value = self.get_xml_attr('value', unicode, None)
joins = []
query = None
- arch_alias = arch_table.alias('arch%i' % self.alias['arch'])
- system_arch_alias = system_arch_map.alias('system_arch%i' % self.alias['arch'])
- self.alias['arch'] += 1
- if value:
- query = and_(system_table.c.id == system_arch_alias.c.system_id,
- arch_alias.c.id == system_arch_alias.c.arch_id,
- getattr(arch_alias.c.arch, op)(value))
+ # Only do one combination of Arch+Op
+ arch_op = 'arch%s%s' % (value,op)
+ if not self.alias['arch'].get(arch_op):
+ arch_alias = arch_table.alias(arch_op)
+ system_arch_alias = system_arch_map.alias('system_%s' % arch_op)
+ self.alias['arch'][arch_op] = True
+ if value:
+ query = and_(system_table.c.id == system_arch_alias.c.system_id,
+ arch_alias.c.id == system_arch_alias.c.arch_id,
+ getattr(arch_alias.c.arch, op)(value))
return (joins, query)
subclassDict = {
diff --git a/beaker.spec b/beaker.spec
index 995702b..959992d 100644
--- a/beaker.spec
+++ b/beaker.spec
@@ -6,7 +6,7 @@
%endif
Name: beaker
-Version: 0.4.77
+Version: 0.4.78
Release: 0%{?timestamp}%{?branch}%{?dist}
Summary: Filesystem layout for Beaker
Group: Applications/Internet
@@ -145,6 +145,8 @@ ln -s Fedora.ks $RPM_BUILD_ROOT/var/lib/cobbler/kickstarts/Fedoradevelopment.ks
/usr/share/man/man1/beakerlib*
%changelog
+* Wed Jan 20 2010 Bill Peck <bpeck@redhat.com> - 0.4.78-0
+- Remove redundant arch aliases
* Wed Jan 13 2010 Bill Peck <bpeck@redhat.com> - 0.4.77-0
- fix ISE 500 when adding new system
* Tue Jan 12 2010 Bill Peck <bpeck@redhat.com> - 0.4.76-1