from sfa.generic import Generic
from sfa.util.xrn import Xrn
from sfa.storage.record import Record
-from sfa.client.sfi import save_records_to_file
+
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.gid import GID
from sfa.trust.certificate import convert_public_key
-from sfa.client.candidates import Candidates
-
from sfa.client.common import optparse_listvalue_callback, optparse_dictvalue_callback, terminal_render, filter_records
+from sfa.client.candidates import Candidates
+from sfa.client.sfi import save_records_to_file
pprinter = PrettyPrinter(indent=4)
"""Check the correspondance between the GID and the PubKey"""
# db records
- from sfa.storage.alchemy import dbsession
from sfa.storage.model import RegRecord
- db_query = dbsession.query(RegRecord).filter_by(type=type)
+ db_query = self.api.dbsession().query(RegRecord).filter_by(type=type)
if xrn and not all:
hrn = Xrn(xrn).get_hrn()
db_query = db_query.filter_by(hrn=hrn)
class CertCommands(Commands):
+
+ def __init__(self, *args, **kwds):
+ self.api= Generic.the_flavour().make_api(interface='registry')
def import_gid(self, xrn):
pass
@args('-o', '--outfile', dest='outfile', metavar='<outfile>', help='output file', default=None)
def export(self, xrn, type=None, outfile=None):
"""Fetch an object's GID from the Registry"""
- from sfa.storage.alchemy import dbsession
from sfa.storage.model import RegRecord
hrn = Xrn(xrn).get_hrn()
- request=dbsession.query(RegRecord).filter_by(hrn=hrn)
+ request=self.api.dbsession().query(RegRecord).filter_by(hrn=hrn)
if type: request = request.filter_by(type=type)
record=request.first()
if record: