From 5a7fc7f433837c0fec1d26568d42710d1f1e9bd5 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Tue, 17 Mar 2009 20:45:56 -0400 Subject: [PATCH] Add a mechanism for converting an identifier to a PTS ID. Signed-off-by: Evan Broder --- afs/_pts.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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. -- 1.7.9.5