#############################################################################
#
#	Pyro 'dummy' file to make Pyro a package.
#
#	This is part of "Pyro" - Python Remote Objects
#	Which is (c)1999 Irmen de Jong - irmen@bigfoot.com.
#
#############################################################################

# Initialization can be put here...


# Initialize Pyro Configuration.
#
# This is put here because it could actually initialize config stuff needed
# even before the code calls core.initClient or core.initServer.
#
# Pyro.config should be a class, which has a __getattr__ member, so all
# pyro code can use Pyro.config.XXX to look up a value.
# This allows for tweaking the configuration lookups by writing
# a custom __getattr__ and/or __init__ for the class.


#### Pyro Version String ####

PYRO_VERSION = '0.6'


class _Cnfg:

	import os, errno

	# ---------------------- CONFIGURATION VARIABLES -----------

	try:
		PYRO_STORAGE = os.environ['PYRO_STORAGE']
	except KeyError:
		PYRO_STORAGE = os.curdir
	
	PYRO_PORT       = 7766    # Default Pyro Server Port
	PYRO_NS_PORT    = 9090    # the default Pyro Naming Server port
	PYRO_NS_BC_PORT = 9091    # the default Pyro Naming Server Broadcast port
	PYRO_NS_NAME	= 'Pyro.NameServer'    # Pyro Naming Service registered name
	PYRO_BC_RETRIES = 2       # number of broadcast retries
	PYRO_BC_TIMEOUT = 2       # timeout for broadcasts (seconds)

	# ---------------------- END OF CONFIGURATION VARIABLES -----

	# Create the storage directory if it doesn't exist yet
	try:
		if PYRO_STORAGE != os.curdir:
			os.mkdir(PYRO_STORAGE)
	except OSError,x:
		if x.errno!=errno.EEXIST:
			raise OSError(x)

	def __init__(self):
		# Some magic to make "dir(Pyro.config)" useful.
		# (This will make all static class members available)
		self.__dict__ = _Cnfg.__dict__
	
#	def __getattr__(self,name):
#		# add smart code here to deal with other requested config items!
				

config = _Cnfg()				# make Pyro.config

