def __init__(self): configfile=resource_filename("portal","config_prod.ini") self.config = safeConfigParser(configfile) logging.info("Loaded portal config %s " % configfile) self.control = Control(self.config) logging.info("Control loaded") handlers = [ (r"/lib/(.*)", StaticFileHandler, {"path": resource_filename("illiquids","www/lib")}), (r"/local/(.*)", StaticFileHandler, {"path": resource_filename("illiquids","www/static")}), (r"/accounts/(.*)/(.*)", AccountsHandler, {"control": self.control}), (r"/accounts/(.*)", AccountsHandler, {"control": self.control}), (r"/balances/(.*)/(.*)", BalancesHandler, {"control": self.control}), (r"/balances/(.*)", BalancesHandler, {"control": self.control}), (r"/", LayoutHandler, {"control": self.control}), (r"/(.*)", StaticFileHandler, {"path": resource_filename("illiquids","www"), "default_filename":"index.html"}), ] settings = { 'cookie_secret' : "whare_are_the_bank_accounts", 'debug' : options.debug, 'enabled_protocols' : ['websocket', 'flashsocket', 'xhr-multipart', 'xhr-polling'], 'flash_policy_port' : 843, 'flash_policy_file' : resource_filename("illiquids",'flashpolicy.xml'), 'socket_io_port' : 8001, } tornado.web.Application.__init__(self, handlers, **settings)
balance_info = self._control.getBalance(balance_data.get('id')) elif action == 'del': self._control.delBalance(balance_data.get('id')) else: raise Exception("Un supported operation %s" % action) if action != 'del': balance_id = balance_info.get('id') self._control.update_balance(balance_id, balance_data.get('date'), balance_data.get('amount'), balance_data.get('username'), datetime.datetime.now() ) logging.info("UPDATE BAL: (%s) Completed" % action) if __name__== "__main__": logging.basicConfig(level=logging.DEBUG) logging.info("DEBUG starting") configfile='..\\config_dev1.ini' config = safeConfigParser(configfile) control = Control(config) company_ref = "047E81E2-1FE0-DE11-9C61-005056832E57" a = control.getAccounts(company_ref) print a