From: Evan Broder Date: Wed, 18 Mar 2009 00:45:56 +0000 (-0400) Subject: Add a mechanism for converting an identifier to a PTS ID. X-Git-Tag: 0.1.0~42 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/commitdiff_plain/5a7fc7f433837c0fec1d26568d42710d1f1e9bd5 Add a mechanism for converting an identifier to a PTS ID. Signed-off-by: Evan Broder --- diff --git a/afs/_pts.pyx b/afs/_pts.pyx index 83fa010..8a8937c 100644 --- a/afs/_pts.pyx +++ b/afs/_pts.pyx @@ -212,6 +212,17 @@ cdef class PTS: ubik_ClientDestroy(self.client) rx_Finalize() + def NameOrId(self, ident): + """ + Given an identifier, convert it to a PTS ID by looking up the + name if it's a string, or otherwise just converting it to an + integer. + """ + if isinstance(ident, (str, unicode)): + return self.NameToId(ident) + else: + return int(ident) + def NameToId(self, name): """ Converts a user or group to an AFS ID.