X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=432ddf8a0cad7c84cf08cb78d467544b4c415845;hb=fdbef587c29814f97c192de5a8b7e9f09cc45fa4;hp=c2621e36d150a38b042fd25182e15ff7374cbb87;hpb=206fb80997ed8e3aa8ee317d454a3fb9470b7ffc;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index c2621e36..432ddf8a 100644 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1232,15 +1232,9 @@ class Keyring(object): l = ldap.open(LDAPServer) if ca_cert_file: - # TODO: This should request a new context and use - # connection-specific options (i.e. "l.set_option(...)") - - # Request a new TLS context. If there was already one, libldap - # would not change the TLS options (like which CAs to trust). - #l.set_option(ldap.OPT_X_TLS_NEWCTX, True) - ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_HARD) - #ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, None) - ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_cert_file) + l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_HARD) + l.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_cert_file) + l.set_option(ldap.OPT_X_TLS_NEWCTX, True) l.start_tls_s() l.simple_bind_s("","") @@ -2274,6 +2268,12 @@ class Suite(ORMObject): def path(self): return os.path.join(self.archive.path, 'dists', self.suite_name) + @property + def release_suite_output(self): + if self.release_suite is not None: + return self.release_suite + return self.suite_name + __all__.append('Suite') @session_wrapper @@ -2292,8 +2292,22 @@ def get_suite(suite, session=None): @return: Suite object for the requested suite name (None if not present) """ + # Start by looking for the dak internal name q = session.query(Suite).filter_by(suite_name=suite) + try: + return q.one() + except NoResultFound: + pass + + # Now try codename + q = session.query(Suite).filter_by(codename=suite) + try: + return q.one() + except NoResultFound: + pass + # Finally give release_suite a try + q = session.query(Suite).filter_by(release_suite=suite) try: return q.one() except NoResultFound: @@ -2631,6 +2645,7 @@ class DBConn(object): 'obsolete_any_associations', 'obsolete_any_by_all_associations', 'obsolete_src_associations', + 'package_list', 'source_suite', 'src_associations_bin', 'src_associations_src',