From d39b7a59a8e4a2a897e8a95333f94372017e2f36 Mon Sep 17 00:00:00 2001
From: Tony Mack <tmack@cs.princeton.edu>
Date: Mon, 4 Jan 2010 16:59:26 +0000
Subject: [PATCH] The hrn argument can be a hrn or urn string. Renamed 'hrn'
 argument to 'hrn_or_urn' and use sfa.util.namespace.urn_to_hrn() to convert
 this field to an hrn

---
 sfa/methods/create_gid.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sfa/methods/create_gid.py b/sfa/methods/create_gid.py
index f5eaeda2..594d09e7 100644
--- a/sfa/methods/create_gid.py
+++ b/sfa/methods/create_gid.py
@@ -4,9 +4,9 @@
 from sfa.trust.certificate import Keypair 
 
 from sfa.util.faults import *
+from sfa.util.namespace import *
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
-
 from sfa.trust.gid import create_uuid
 from sfa.trust.auth import Auth
 
@@ -28,7 +28,7 @@ class create_gid(Method):
     
     accepts = [
         Parameter(str, "Credential string"),
-        Parameter(str, "Human readable name (hrn)"),
+        Parameter(str, "Human readable name (hrn) or (urn)"),
         Mixed(Parameter(str, "Unique identifier for new GID (uuid)"),
               Parameter(None, "Unique identifier (uuid) not specified")),   
         Parameter(str, "public-key string")
@@ -36,7 +36,11 @@ class create_gid(Method):
 
     returns = Parameter(str, "String represeneation of a GID object")
     
-    def call(self, cred, hrn, uuid, pubkey_str):
+    def call(self, cred, hrn_or_urn, uuid, pubkey_str):
+        
+        # convert urn to hrn     
+        hrn, type = hrn_to_urn(hrn_or_urn) 
+
         # validate the credential
         self.api.auth.check(cred, "getcredential")
         self.api.auth.verify_object_belongs_to_me(hrn)
-- 
2.47.0