minimal hacks so that the PHP bindings can be built under FC2
authorMark Huang <mlhuang@cs.princeton.edu>
Thu, 4 Jan 2007 16:01:28 +0000 (16:01 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Thu, 4 Jan 2007 16:01:28 +0000 (16:01 +0000)
PLC/Auth.py
PLC/Filter.py
PLC/Peers.py
php/methods.py

index be54b12..ca8a72e 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Auth.py,v 1.8 2006/11/09 19:43:55 mlhuang Exp $
+# $Id: Auth.py,v 1.9 2006/12/15 18:35:38 mlhuang Exp $
 #
 
 import crypt
@@ -18,7 +18,6 @@ from PLC.Persons import Persons
 from PLC.Nodes import Node, Nodes
 from PLC.Sessions import Session, Sessions
 from PLC.Peers import Peer, Peers
-from PLC.GPG import gpg_verify
 
 class Auth(Parameter):
     """
@@ -72,6 +71,7 @@ class GPGAuth(Auth):
 
             for key in keys:
                 try:
+                    from PLC.GPG import gpg_verify
                     gpg_verify(method.name, args, auth['signature'], key)
                     return
                 except PLCAuthenticationFailure, fault:
index 458e14c..9f5fb42 100644 (file)
@@ -1,4 +1,9 @@
 from types import StringTypes
+try:
+    set
+except NameError:
+    from sets import Set
+    set = Set
 
 from PLC.Faults import *
 from PLC.Parameter import Parameter, Mixed, python_type
index 393be62..866b41b 100644 (file)
@@ -20,10 +20,6 @@ from PLC.SliceAttributeTypes import SliceAttributeType, SliceAttributeTypes
 from PLC.SliceAttributes import SliceAttribute, SliceAttributes
 from PLC.Slices import Slice, Slices
 
-import xmlrpclib
-from PLC.PyCurl import PyCurlTransport
-from PLC.GPG import gpg_sign
-
 class Peer(Row):
     """
     Stores the list of peering PLCs in the peers table. 
@@ -87,6 +83,8 @@ class Peer(Row):
         Connect to this peer via XML-RPC.
         """
 
+        import xmlrpclib
+        from PLC.PyCurl import PyCurlTransport
         self.server = xmlrpclib.ServerProxy(self['peer_url'],
                                             PyCurlTransport(self['peer_url'], self['cacert']),
                                             allow_none = 1, **kwds)
@@ -98,6 +96,7 @@ class Peer(Row):
         """
 
         def wrapper(*args, **kwds):
+            from PLC.GPG import gpg_sign
             signature = gpg_sign(methodname, args,
                                  self.api.config.PLC_ROOT_GPG_KEY,
                                  self.api.config.PLC_ROOT_GPG_KEY_PUB)
index 27761a0..b41b1ba 100755 (executable)
@@ -5,7 +5,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2005 The Trustess of Princeton University
 #
-# $Id: methods.py,v 1.3 2006/11/21 20:00:53 mlhuang Exp $
+# $Id: methods.py,v 1.4 2006/11/29 19:43:17 mlhuang Exp $
 #
 
 import os, sys
@@ -15,6 +15,12 @@ from PLC.API import PLCAPI
 from PLC.Method import *
 from PLC.Auth import Auth
 
+try:
+    set
+except NameError:
+    from sets import Set
+    set = Set
+
 def php_cast(value):
     """
     Casts Python values to PHP values.