def insert_profiles(self): path = os.path.join(self.main_path, 'profiles') print 'path is in insert_profiles', path xmlfiles = [os.path.join(path, x) for x in os.listdir(path) if x[-4:] == '.xml'] profiles = PaellaProfiles(self.conn) for xmlfile in xmlfiles: xml = parse_file(xmlfile) elements = xml.getElementsByTagName('profile') if len(elements) != 1: raise Error, 'bad profile number %s' % len(elements) element = elements[0] parsed = ProfileParser(element) profiles.insert_profile(parsed)
def __init__(self, conn, path='/'): Element.__init__(self, 'paelladatabase') self.conn = conn self.stmt = StatementCursor(self.conn) self._profile_traits_ = ProfileTrait(self.conn) self.path = path self.suites = SuitesElement() self.appendChild(self.suites) for row in self._suite_rows(): args = map( str, [row.suite, row.nonus, row.updates, row.local, row.common]) element = SuiteElement(*args) self.suites.appendChild(element) self.profiles = PaellaProfiles(self.conn) self.family = Family(self.conn) suites = [x.suite for x in self._suite_rows()] for suite in suites: self.appendChild(TraitsElement(self.conn, suite))