Changeset 962ea25 for fedd


Ignore:
Timestamp:
Sep 23, 2010 5:49:51 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
add53ea
Parents:
835cf55
Message:

Move that gross fedid generation code into the fedid class

Location:
fedd/federation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/experiment_control.py

    r835cf55 r962ea25  
    15671567        if 'experimentAccess' in req and 'X509' in req['experimentAccess']:
    15681568            expcert = req['experimentAccess']['X509']
    1569             tf = tempfile.NamedTemporaryFile()
    1570             tf.write(expcert)
    1571             tf.flush()
    1572             expid = fedid(file=tf.name)
    1573             tf.close()
     1569            expid = fedid(certstr=expcert)
    15741570            self.state_lock.acquire()
    15751571            if expid in self.state:
  • fedd/federation/fedid.py

    r835cf55 r962ea25  
    2323    """
    2424    HASHSIZE=20
    25     def __init__(self, bits=None, hexstr=None, cert=None, file=None):
     25    def __init__(self, bits=None, hexstr=None, cert=None, file=None,
     26            certstr=None):
    2627        if bits != None:
    2728            self.set_bits(bits)
     
    3233        elif file != None:
    3334            self.set_file(file)
     35        elif certstr:
     36            self.set_certstr(certstr)
    3437        else:
    3538            self.buf = None
     
    8588        """Get the 160 bit buffer from the fedid"""
    8689        return self.buf
     90
     91    def set_certstr(self, certstr):
     92        """
     93        Certstr is the contents of a certificate file.  Unfortunately we
     94        basically have to stuff it back into a temp file to read it.
     95        """
     96        tf = tempfile.NamedTemporaryFile()
     97        tf.write(certstr)
     98        tf.flush()
     99        self.set_file(tf.name)
     100        tf.close()
    87101
    88102    def set_file(self, file):
Note: See TracChangeset for help on using the changeset viewer.