from pyamf.remoting.gateway.wsgi import WSGIGateway
from wsgiref import simple_server
from pyamf.amf3 import ByteArray
import glob
import psyco

class Test(object):
	def getStringImages( self ):
		l = glob.glob(r"E:\Immagini\2003 - Vasto\*.jpg")
		return l
		
	def getDataImages( self ):
		l = glob.glob(r"E:\Immagini\2003 - Vasto\*.jpg")
		arr = []
		
		for line in l:
			f = open(line, 'rb')
			byte = ByteArray( f.read( ) )
			arr.append( byte )
		return arr		
		

services = { "test" : Test( ) }

if __name__ == '__main__':
	psyco.full()
	gateway = WSGIGateway( services, debug = True )
	httpd = simple_server.WSGIServer( ("localhost", 8000 ), simple_server.WSGIRequestHandler, )
	httpd.set_app( gateway )
	print "Running http://localhost:8000"
	httpd.serve_forever( ) 