- self.url = config.SFA_PLC_URL
- # xxx attempt to use the 'capability' auth mechanism for higher performance
- # when the PLC db is local
- # xxx todo
- is_local = False
+ url = config.SFA_PLC_URL
+ # try to figure if the url is local
+ hostname=urlparse(url).hostname
+ is_local=False
+ if hostname == 'localhost': is_local=True
+ # otherwise compare IP addresses
+ url_ip=socket.gethostbyname(hostname)
+ local_ip=socket.gethostbyname(socket.gethostname())
+ if url_ip==local_ip: is_local=True
+