def select_query(self, query): core.Common().add_to_log("4", "Application", query) cursor = self.db.cursor() cursor.execute(query) results = self._get_dict(cursor.fetchall(), cursor.description) core.Common().add_to_log("5", "Application", results) return results
def __init__(self): self.name = 'PostgreSQL Data Source' self.description = 'Store and manipulate PostgreSQL data sources.' self.type = 'Data Source' self.subtype = 'Database' self.short_desc = 'PostgreSQL' core.Common().add_to_log("2", "PostgreSQL Data Source", "Loading")
def get_user_by_session(self, session): # current time - the timeout (in minutes) timeout = time.ctime(core.Common().now() - (int(core.config['user']['timeout']) * 60)) query = "SELECT * FROM %s WHERE session='%s' AND session_time > '%s'" % ( self.table, session, timeout) results = core.Connection().select_query(query) if results == []: return None else: return results[0]
def request(self, message): # This is for testing purposes core.Common().add_to_log("5", "Application", message) # Parse the XML in a dictionary self.doc = requestHandler().parse(message) core.Common().add_to_log("5", "Application", self.doc) # Begin user checks. Any response assumes a problem. # And no other requests will be run. self.response = users.UserHome().check_session(self.doc) core.Common().add_to_log("5", "User", users.currentUser) # Only if the user is authenticated if (users.currentUser != None): """Parse any control parameters""" self.response += core.Control().parse_control( self.doc.get('control', '')) self.response += self._process_modules() # Wrap the content in the correct XML headers and footers self.response = display.Display().wrap_content(self.response) core.Common().add_to_log("5", "Application", self.response) return self.response
def _process_modules(self): response = '' for k, v in self.doc['module'].iteritems(): if k == 'core': response += core.Core().process_core(v) else: status = mod.ModuleHome().module_status(k) core.Common().add_to_log("2", "Application", "Module: " + k + " Status: " + status) if status == "active": modx = __import__(k) response += modx.Main().process_request(v) return response
def _set_session(self, user): user['session'] = random.randint(1, 1000000000) user['session_time'] = datetime.datetime.fromtimestamp( core.Common().now()).ctime() return user
def __init__(self): self.name = 'Data Source Catalogue' self.description = 'Store and manipulate the available data sources.' self.type = 'Core' self.subtype = None core.Common().add_to_log("2", "Catalogue", "Loading")
def __init__(self): self.name = 'Create Data Warehouse' self.description = 'Design and create a new data warehouse or data mart.' self.type = 'Core' self.subtype = None core.Common().output("2", "Warehouse", "Loading")
def __init__(self): self.name = 'IronData Administration Functionality' self.description = 'This is the Administration module. Do not remove this module.' self.type = 'Core' self.subtype = None core.Common().add_to_log("2", "Admin", "Loading")