def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] controller = environ['pylons.routes_dict']['controller'] if controller == 'template': return WSGIController.__call__(self, environ, start_response) username = environ.get('REMOTE_USER') if not username and controller != 'config': return WSGIResponse(content='please log in', code=401) if environ.get('AUTHENTICATION_METHOD') != 'WSSE': if controller == 'watch' or controller == 'user': c.user = User.get_or_create(username) else: if (environ.get('REMOTE_ADDR').startswith('127.0.0.1') and controller == 'config') or controller == 'error': #local users can configure Twirlip and see errors pass else: #all other authentication must be by wsse return WSGIResponse(code=403, content='You need to authenticate with wsse to access %s ' % controller) if controller == 'page': #json self.params = {} for param, value in request.params.items(): self.params[param] = loads(value) return WSGIController.__call__(self, environ, start_response)
def __init__(self): WSGIController.__init__(self) self.cert_dn = None self.cert_vo = None self.cert_fqans = [] self.fqans_string = '' self.cert_owner = None
def __init__(self, *args, **kwargs): """Implements TG2 style controller-level permissions requirements. If the allow_only class attribute has been set, wrap the __before__ method with an ActionProtector using the predicate defined there. """ if hasattr(self, 'allow_only') \ and isinstance(self.allow_only, Predicate): # ControllerProtector wraps the __before__ method of this instance. cp = ControllerProtector(self.allow_only) self = cp(self) WSGIController.__init__(self, *args, **kwargs)
def __init__(self, provider, controller, *args, **kwargs): self.provider = provider self.sprockets = Sprockets(provider, controller) self.controller = controller #commonly used views c.w = WidgetBunch() sprocket = self.sprockets['databaseView'] self.databaseValue = sprocket.session.getValue() self.databaseView = sprocket.view.widget print 'controller:', self.controller self.databaseDict = dict(controller=self.controller) self.genshi_loader = TemplateLoader([pkg_resources.resource_filename('dbsprockets.dbmechanic.frameworks.pylons', 'templates')]) WSGIController.__init__(self, *args, **kwargs)
def __call__(self, environ, start_response): """Invoke the Controller.""" # set the language fallback to english add_fallback("en") # define the language based on browser preference user_agent_language = request.languages[0][0:2] set_lang(user_agent_language) formencode.api.set_stdtranslation(user_agent_language) # common values mostly inherited from config file c.version = __version__ # TODO move this into the development.ini file c.site_full_name = config["site_full_name"] # TODO move this into the development.ini file c.site_short_name = config["site_short_name"] # TODO move this into the development.ini file # controler and action named for use in templates #c.controller = request.environ['pylons.routes_dict']['controller'] #c.action = request.environ['pylons.routes_dict']['action'] # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: return WSGIController.__call__(self, environ, start_response) finally: meta.Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] response.headers["content-type"] = "application/json;charset=utf-8" return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: self.ip_addr = _get_ip_addr(environ) # make sure that we update permissions each time we call controller api_key = request.GET.get('api_key') cookie_store = CookieStoreWrapper(session.get('rhodecode_user')) user_id = cookie_store.get('user_id', None) username = get_container_username(environ, config) try: auth_user = AuthUser(user_id, api_key, username, self.ip_addr) except UserCreationError, e: from rhodecode.lib import helpers as h h.flash(e, 'error') # container auth or other auth functions that create users on # the fly can throw this exception signaling that there's issue # with user creation, explanation should be provided in # Exception itself auth_user = AuthUser(ip_addr=self.ip_addr) request.user = auth_user self.rhodecode_user = c.rhodecode_user = auth_user if not self.rhodecode_user.is_authenticated and \ self.rhodecode_user.user_id is not None: self.rhodecode_user.set_authenticated( cookie_store.get('is_authenticated') ) log.info('IP: %s User: %s accessed %s' % ( self.ip_addr, auth_user, safe_unicode(_get_access_path(environ))) ) return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] environ = request.environ controller = environ['pylons.routes_dict'].get('controller') if request.method == "POST" and controller != "auth" and controller != "hookbox" and controller != 'error': params = request.params submitted_token = params.get(secure_form.token_key) if submitted_token != secure_form.authentication_token(): #raise RuntimeError("Not secure") pass #FIXME: uncomment above user_id = session.get("user_id") if user_id: c.user = self.user = User.get(user_id) if not self.user.is_logged_in(): del session["user_id"] c.user = self.user = None else: c.user = self.user = None #generate hookbox server url hookbox_server = url('/', qualified=True) parsed = urlparse(hookbox_server) #a really fancy way of saying host:8001 c.hookbox_server = parsed.scheme + "://" + parsed.hostname + ":" + config["hookbox_js_port"] return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] tmpl_context.current_navtab = 'blah' tmpl_context.current_subnavtab = 'blakj' tmpl_context.status = 1 tmpl_context.messagebar_text = '' tmpl_context.message = '' tmpl_context.username = '' beaker = environ.get('beaker.session') or {} try: timeout = int(config.get('cw.timeout')) except Exception: timeout = 0 if timeout and beaker.get('user_id'): last_access = beaker.get('last_accessed') or False if last_access and datetime.now() - last_access > timedelta(minutes=timeout): try: return "Your session has timed out. You have been logged out for security." finally: Session.remove() beaker['last_accessed'] = datetime.now() beaker.save() try: return WSGIController.__call__(self, environ, start_response) finally: Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): # we override this here to ensure that this header, and only this # header, is trusted to reduce the number of potential # misconfigurations between wsgi application servers (e.g. gunicorn # which trusts three different headers out of the box for this) and # haproxy (which won't clean out bad headers by default) forwarded_proto = environ.get("HTTP_X_FORWARDED_PROTO", "http").lower() assert forwarded_proto in ("http", "https") request.environ["wsgi.url_scheme"] = forwarded_proto true_client_ip = environ.get('HTTP_TRUE_CLIENT_IP') ip_hash = environ.get('HTTP_TRUE_CLIENT_IP_HASH') forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') if (g.ip_hash and true_client_ip and ip_hash and hashlib.md5(true_client_ip + g.ip_hash).hexdigest() \ == ip_hash.lower()): request.ip = true_client_ip elif g.trust_local_proxies and forwarded_for and is_local_address(remote_addr): request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the paramters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.get = storify(request.GET) request.post = storify(request.POST) request.referer = environ.get('HTTP_REFERER') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.fullurl = request.host_url + request.fullpath request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if meth != 'OPTIONS': handler_name = meth + '_' + action else: handler_name = meth request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" def check_url(): "check if user should have totals calculated" if ('format' in environ['pylons.routes_dict'] and environ['pylons.routes_dict']['format'] in ['csv', 'pdf']): return False if environ['PATH_INFO'] == '/jsi18n.js': return False return True self.identity = environ.get('repoze.who.identity') if (self.identity is not None and 'user' in self.identity and environ['pylons.routes_dict']['controller'] != 'error' and check_url()): if self.identity['user']: totals = DailyTotals(Session, self.identity['user']) mailq = MailQueue(Session, self.identity['user']) c.baruwa_totals = totals.get() c.baruwa_inbound = mailq.get(1)[0] c.baruwa_outbound = mailq.get(2)[0] if self.identity['user'].is_admin: c.baruwa_status = cluster_status() tzinfo = self.identity['user'].timezone or UTC c.tzinfo = make_tz(tzinfo) try: return WSGIController.__call__(self, environ, start_response) finally: Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" def check_url(): if ('format' in environ['pylons.routes_dict'] and environ['pylons.routes_dict']['format'] in ['csv', 'pdf']): return False if environ['PATH_INFO'] == '/jsi18n.js': return False return True self.identity = environ.get('repoze.who.identity') # raise ValueError(self.identity) # if 'baruwa.auth.plugin' in self.identity: # session['baruwa.auth.plugin'] = self.identity['baruwa.auth.plugin'] # session.save() if (not self.identity is None and 'user' in self.identity and environ['pylons.routes_dict']['controller'] != 'error' and check_url()): if self.identity['user']: totals = DailyTotals(Session, self.identity['user']) mailq = MailQueue(Session, self.identity['user']) c.baruwa_totals = totals.get() c.baruwa_inbound = mailq.get(1)[0] c.baruwa_outbound = mailq.get(2)[0] if self.identity['user'].is_admin: c.baruwa_status = cluster_status() try: return WSGIController.__call__(self, environ, start_response) finally: Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: res = WSGIController.__call__(self, environ, start_response) finally: model.Session.remove() for cookie in request.cookies: # Remove the ckan session cookie if not used e.g. logged out if cookie == "ckan" and not c.user: # Check session for valid data (including flash messages) # (DGU also uses session for a shopping basket-type behaviour) is_valid_cookie_data = False for key, value in session.items(): if not key.startswith("_") and value: is_valid_cookie_data = True break if not is_valid_cookie_data: if session.id: self.log.debug("No valid session data - " "deleting session") self.log.debug("Session: %r", session.items()) session.delete() else: self.log.debug("No session id - " "deleting session cookie") response.delete_cookie(cookie) # Remove auth_tkt repoze.who cookie if user not logged in. elif cookie == "auth_tkt" and not session.id: response.delete_cookie(cookie) return res
def __call__(self, environ, start_response): """Invoke the Controller""" # Before we do anything, is there a "REMOTE USER"? # If not, we've not been authenticated! if not environ.get('REMOTE_USER') and 'login' not in environ.get('PATH_INFO'): raise httpexceptions.HTTPUnauthorized() # Redirect to a canonical form of the URL if necessary. self._redirect_noncanonical_url(environ) # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict' if 'login' not in environ.get('PATH_INFO'): self.current_user = self._user_service.get_user_by_username(environ.get('REMOTE_USER')) if not self.current_user: raise httpexceptions.HTTPUnauthorized() if self.current_user.access_level == "Admin": c.admin_user = True else: c.admin_user = False return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): # Insert any code to be run per request here. The Routes match # is under environ['pylons.routes_dict'] should you want to check # the action or route vars here # Grab Domain Info self.domain = request.environ['REMOTE_USER'] self.dominfo = get_domain_info(self.domain) # Don't allow Locked Domains to make any changes if self.dominfo['ispmanDomainLocked'] == 'true' and \ request.path_info != '/locked': h.redirect_to('/locked') elif request.path_info == '/': h.redirect_to('/domain') ccache = cache.get_cache('navigation') c.menus = ccache.get_value('i18n_menus', createfunc=self.__create_i18n_menus, type='memory', expiretime=3600) c.controller = request.environ['pylons.routes_dict']['controller'] c.action = request.environ['pylons.routes_dict']['action'] c.imgs_list = self.__images_list() if 'message' in session and session['message'] != '': c.message = session['message'] session['message'] = '' session.save() return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): true_client_ip = environ.get('HTTP_TRUE_CLIENT_IP') ip_hash = environ.get('HTTP_TRUE_CLIENT_IP_HASH') forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') if (g.ip_hash and true_client_ip and ip_hash and hashlib.md5(true_client_ip + g.ip_hash).hexdigest() \ == ip_hash.lower()): request.ip = true_client_ip elif g.trust_local_proxies and forwarded_for and is_local_address(remote_addr): request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the paramters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.get = storify(request.GET) request.post = storify(request.POST) request.referer = environ.get('HTTP_REFERER') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if meth != 'OPTIONS': handler_name = meth + '_' + action else: handler_name = meth request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name try: res = WSGIController.__call__(self, environ, start_response) except Exception as e: if g.exception_logging and not isinstance(e, OPERATIONAL_EXCEPTIONS): try: log_exception(e, *sys.exc_info()) except Exception as f: print "log_exception() freaked out: %r" % f print "sorry for breaking the stack trace:" raise return res
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] start = time.time() try: self.ip_addr = _get_ip_addr(environ) # make sure that we update permissions each time we call controller api_key = request.GET.get("api_key") cookie_store = CookieStoreWrapper(session.get("rhodecode_user")) user_id = cookie_store.get("user_id", None) username = get_container_username(environ, config) auth_user = AuthUser(user_id, api_key, username) request.user = auth_user self.rhodecode_user = c.rhodecode_user = auth_user if not self.rhodecode_user.is_authenticated and self.rhodecode_user.user_id is not None: self.rhodecode_user.set_authenticated(cookie_store.get("is_authenticated")) log.info("IP: %s User: %s accessed %s" % (self.ip_addr, auth_user, safe_unicode(_get_access_path(environ)))) return WSGIController.__call__(self, environ, start_response) finally: log.info( "IP: %s Request to %s time: %.3fs" % (_get_ip_addr(environ), safe_unicode(_get_access_path(environ)), time.time() - start) ) meta.Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] person = h.signed_in_person() if person and not person.activated: msg = ("Your account (%s) hasn't been confirmed. Check your email" " for activation instructions. %s" % (person.email_address, 'link-to-reset')) h.flash(msg, category="warning") # Moved here from index controller so that all views that import the news.mako template # have access to c.db_content_news and c.db_content_press news = DbContentType.find_by_name("News", abort_404 = False) if news: c.db_content_news = meta.Session.query(DbContent).filter_by(type_id=news.id).filter(DbContent.publish_timestamp <= datetime.datetime.now()).order_by(DbContent.creation_timestamp.desc()).limit(4).all() c.db_content_news_all = meta.Session.query(DbContent).filter_by(type_id=news.id).filter(DbContent.publish_timestamp <= datetime.datetime.now()).order_by(DbContent.creation_timestamp.desc()).all() #use all to find featured items press = DbContentType.find_by_name("In the press", abort_404 = False) if press: c.db_content_press = meta.Session.query(DbContent).filter_by(type_id=press.id).order_by(DbContent.creation_timestamp.desc()).filter(DbContent.publish_timestamp <= datetime.datetime.now()).limit(4).all() try: return WSGIController.__call__(self, environ, start_response) finally: meta.Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] # Clean out any old cookies as they may contain api keys etc # This also improves the cachability of our pages as cookies # prevent proxy servers from caching content unless they have # been configured to ignore them. for cookie in request.cookies: if cookie.startswith("ckan") and cookie not in ["ckan"]: response.delete_cookie(cookie) # Remove the ckan session cookie if not used e.g. logged out elif cookie == "ckan" and not c.user and not h.are_there_flash_messages(): if session.id: if not session.get("lang"): session.delete() else: response.delete_cookie(cookie) # Remove auth_tkt repoze.who cookie if user not logged in. elif cookie == "auth_tkt" and not session.id: response.delete_cookie(cookie) try: return WSGIController.__call__(self, environ, start_response) finally: model.Session.remove()
def __call__(self, environ, start_response): # we override this here to ensure that this header, and only this # header, is trusted to reduce the number of potential # misconfigurations between wsgi application servers (e.g. gunicorn # which trusts three different headers out of the box for this) and # haproxy (which won't clean out bad headers by default) forwarded_proto = environ.get("HTTP_X_FORWARDED_PROTO", "http").lower() assert forwarded_proto in ("http", "https") request.environ["wsgi.url_scheme"] = forwarded_proto forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') request.via_cdn = False cdn_ip = g.cdn_provider.get_client_ip(environ) if cdn_ip: request.ip = cdn_ip request.via_cdn = True elif g.trust_local_proxies and forwarded_for and is_local_address(remote_addr): request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the parameters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.referer = environ.get('HTTP_REFERER') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.fullurl = request.host_url + request.fullpath request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if (request.environ.get('r2.controller.exception') and action == 'document' and request.environ.get('render_style') == 'api'): action = 'api_error' if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if (meth == 'OPTIONS' and self._get_action_handler(action, meth) is None): handler_name = meth else: handler_name = meth + '_' + action request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] # Insert any code to be run per request here. # hg parents --template="r{rev} {date|date} by {author}\n" hg_args = ['hg', 'parents', '--template="r{rev} {date|date} by {author}\n"'] hg_process = subprocess.Popen(hg_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=os.path.dirname(__file__)) c.revision = hg_process.stdout.readline().strip()[1:] if request.environ['HTTP_HOST'].startswith("comoto") and h.get_user(request.environ).superuser: #we are running on the production server and we are a superuser hg_args = ['hg', 'incoming', '--template="{rev}\n"'] hg_process = subprocess.Popen(hg_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=os.path.dirname(__file__)) incoming_changesets = -2 #start with -4 because of extra lines printed while True: output = hg_process.stdout.readline() if len(output) > 2: incoming_changesets+=1 if output.startswith("no"): incoming_changesets = 0 break if output == '' or hg_process.poll() != None: break c.incoming_changesets = incoming_changesets try: return WSGIController.__call__(self, environ, start_response) finally: model.Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] start = time.time() try: # make sure that we update permissions each time we call controller api_key = request.GET.get('api_key') cookie_store = CookieStoreWrapper(session.get('rhodecode_user')) user_id = cookie_store.get('user_id', None) username = get_container_username(environ, config) auth_user = AuthUser(user_id, api_key, username) request.user = auth_user self.rhodecode_user = c.rhodecode_user = auth_user if not self.rhodecode_user.is_authenticated and \ self.rhodecode_user.user_id is not None: self.rhodecode_user.set_authenticated( cookie_store.get('is_authenticated') ) log.info('User: %s accessed %s' % ( auth_user, safe_unicode(environ.get('PATH_INFO'))) ) return WSGIController.__call__(self, environ, start_response) finally: log.info('Request to %s time: %.3fs' % ( safe_unicode(environ.get('PATH_INFO')), time.time() - start) ) meta.Session.remove()
def __call__(self, environ, start_response): """Invoke the Controller""" pylons.tmpl_context.db = self.db = Database(pylons.config['couchdb_uri']) self._setup() pylons.tmpl_context.use_minified_assets = asbool( pylons.config.get('use_minified_assets', 'false')) return WSGIController.__call__(self, environ, start_response)
def _perform_call(self, func, args): """ _perform_call is called by _inspect_call in Pylons' WSGIController. """ # Steal a page from TurboGears' book, and Add the GET/POST # request params to our params dict, overriding any defaults passed in. args.update(request.params.mixed()) return WSGIController._perform_call(self, func, args)
def __call__(self, environ, start_response): conn = meta.engine.connect() meta.Session.configure(bind=conn) try: return WSGIController.__call__(self, environ, start_response) finally: meta.Session.remove() conn.close()
def __call__(self, environ, start_response): true_client_ip = environ.get("HTTP_TRUE_CLIENT_IP") ip_hash = environ.get("HTTP_TRUE_CLIENT_IP_HASH") forwarded_for = environ.get("HTTP_X_FORWARDED_FOR", ()) remote_addr = environ.get("REMOTE_ADDR") if ( g.ip_hash and true_client_ip and ip_hash and hashlib.md5(true_client_ip + g.ip_hash).hexdigest() == ip_hash.lower() ): request.ip = true_client_ip elif remote_addr in g.proxy_addr and forwarded_for: request.ip = forwarded_for.split(",")[-1] else: request.ip = environ["REMOTE_ADDR"] # if x-dont-decode is set, pylons won't unicode all the paramters if environ.get("HTTP_X_DONT_DECODE"): request.charset = None request.get = storify(request.GET) request.post = storify(request.POST) request.referer = environ.get("HTTP_REFERER") request.path = environ.get("PATH_INFO") request.user_agent = environ.get("HTTP_USER_AGENT") request.fullpath = environ.get("FULLPATH", request.path) request.port = environ.get("request_port") if_modified_since = environ.get("HTTP_IF_MODIFIED_SINCE") if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None # set the function to be called action = request.environ["pylons.routes_dict"].get("action") if action: meth = request.method.upper() if meth == "HEAD": meth = "GET" request.environ["pylons.routes_dict"]["action"] = meth + "_" + action c.thread_pool = environ["paste.httpserver.thread_pool"] c.response = Response() try: res = WSGIController.__call__(self, environ, start_response) except Exception as e: if g.exception_logging: try: log_exception(e, *sys.exc_info()) except Exception as f: print "log_exception() freaked out: %r" % f print "sorry for breaking the stack trace:" raise return res
def __call__(self, environ, start_response): try: c.cats = model.Category.query.filter(model.and_( model.Category.category!="Default", model.Category.category!="Uncategorized" )).all() return WSGIController.__call__(self, environ, start_response) finally: model.Session.remove()
def __call__(self, environ, start_response): # Insert any code to be run per request here. The Routes match # is under environ['pylons.routes_dict'] should you want to check # the action or route vars here # Force Paste not to set the Content-Length to 0 before cgi.FieldStorage # can read the request body environ['CONTENT_LENGTH'] = '-1' return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: return WSGIController.__call__(self, environ, start_response) except NotImplementedError, e: abort(501)
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: res = WSGIController.__call__(self, environ, start_response) finally: model.Session.remove() for cookie in request.cookies: # Remove the ckan session cookie if not used e.g. logged out if cookie == 'ckan' and not c.user: # Check session for valid data (including flash messages) # (DGU also uses session for a shopping basket-type behaviour) is_valid_cookie_data = False for key, value in session.items(): if not key.startswith('_') and value: is_valid_cookie_data = True break if not is_valid_cookie_data: if session.id: if not session.get('lang'): self.log.debug('No session data any more - ' 'deleting session') self.log.debug('Session: %r', session.items()) session.delete() else: response.delete_cookie(cookie) self.log.debug('No session data any more - ' 'deleting session cookie') # Remove auth_tkt repoze.who cookie if user not logged in. elif cookie == 'auth_tkt' and not session.id: response.delete_cookie(cookie) return res
def __call__(self, environ, start_response): '''Invoke the Controller''' # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] path = "" try: if environ: path = environ.get("PATH_INFO", "") or "" log.debug("request %r" % path) ret = WSGIController.__call__(self, environ, start_response) log.debug("reply %r" % ret) finally: meta.Session.remove() # free the lock on the scurityPovider if any if self.sep: self.sep.dropSecurityModule() closeResolvers() # hint for the garbage collector to make the dishes data_objects = [ "resolvers_loaded", "resolver_types", "resolver_clazzes", "linotpConfig", "audit", "hsm" ] for data_obj in data_objects: if hasattr(c, data_obj): data = getattr(c, data_obj) del data log.debug("request %r done!" % path) return ret
def __call__(self, environ, start_response): # we override this here to ensure that this header, and only this # header, is trusted to reduce the number of potential # misconfigurations between wsgi application servers (e.g. gunicorn # which trusts three different headers out of the box for this) and # haproxy (which won't clean out bad headers by default) forwarded_proto = environ.get("HTTP_X_FORWARDED_PROTO", "http").lower() assert forwarded_proto in ("http", "https") request.environ["wsgi.url_scheme"] = forwarded_proto true_client_ip = environ.get('HTTP_TRUE_CLIENT_IP') ip_hash = environ.get('HTTP_TRUE_CLIENT_IP_HASH') forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') if (g.ip_hash and true_client_ip and ip_hash and hashlib.md5(true_client_ip + g.ip_hash).hexdigest() \ == ip_hash.lower()): request.ip = true_client_ip elif g.trust_local_proxies and forwarded_for and is_local_address( remote_addr): request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the paramters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.get = storify(request.GET) request.post = storify(request.POST) request.referer = environ.get('HTTP_REFERER') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.fullurl = request.host_url + request.fullpath request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if meth != 'OPTIONS': handler_name = meth + '_' + action else: handler_name = meth request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): true_client_ip = environ.get('HTTP_TRUE_CLIENT_IP') ip_hash = environ.get('HTTP_TRUE_CLIENT_IP_HASH') forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') if (g.ip_hash and true_client_ip and ip_hash and hashlib.md5(true_client_ip + g.ip_hash).hexdigest() \ == ip_hash.lower()): request.ip = true_client_ip elif remote_addr in g.proxy_addr and forwarded_for: request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the paramters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.get = storify(request.GET) request.post = storify(request.POST) request.referer = environ.get('HTTP_REFERER') request.path = environ.get('PATH_INFO') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if meth != 'OPTIONS': handler_name = meth + '_' + action else: handler_name = meth request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name c.response = Response() try: res = WSGIController.__call__(self, environ, start_response) except Exception as e: if g.exception_logging: try: log_exception(e, *sys.exc_info()) except Exception as f: print "log_exception() freaked out: %r" % f print "sorry for breaking the stack trace:" raise return res
def __call__(self, environ, start_response): # Insert any code to be run per request here. The Routes match # is under environ['pylons.routes_dict'] should you want to check # the action or route vars here return WSGIController.__call__(self, environ, start_response)
def __call__(self, environ, start_response): """Parse the request body as JSON, look up the method on the controller and if it exists, dispatch to it. """ length = 0 if 'CONTENT_LENGTH' not in environ: log.debug("No Content-Length") abort(411) else: if environ['CONTENT_LENGTH'] == '': abort(411) length = int(environ['CONTENT_LENGTH']) log.debug('Content-Length: %s', length) if length == 0: log.debug("Content-Length is 0") abort(411) raw_body = environ['wsgi.input'].read(length) json_body = json.loads(urllib.unquote_plus(raw_body)) self._req_id = json_body['id'] self._req_method = json_body['method'] self._req_params = json_body['params'] log.debug('id: %s, method: %s, params: %s', self._req_id, self._req_method, self._req_params) self._error = None try: self._func = self._find_method() except AttributeError: err = jsonrpc_error(self._req_id, 'method_not_found') return err(environ, start_response) # now that we have a method, make sure we have enough # parameters and pass off control to the controller. if not isinstance(self._req_params, dict): # JSON-RPC version 1 request. arglist = inspect.getargspec(self._func)[0][1:] if len(self._req_params) < len(arglist): err = jsonrpc_error(self._req_id, 'invalid_params') return err(environ, start_response) else: kargs = dict(zip(arglist, self._req_params)) else: # JSON-RPC version 2 request. Params may be default, and # are already a dict, so skip the parameter length check here. kargs = self._req_params # XX Fix this namespace clash. One cannot use names below as # method argument names as this stands! kargs['action'], kargs['environ'] = self._req_method, environ kargs['start_response'] = start_response self._rpc_args = kargs status = [] headers = [] exc_info = [] def change_content(new_status, new_headers, new_exc_info=None): status.append(new_status) headers.extend(new_headers) exc_info.append(new_exc_info) output = WSGIController.__call__(self, environ, change_content) output = list(output) headers.append(('Content-Length', str(len(output[0])))) replace_header(headers, 'Content-Type', 'application/json') start_response(status[0], headers, exc_info[0]) return output
def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method # the request is routed to. This routing information is # available in environ['pylons.routes_dict'] try: id = '' if 'type' in request.params: id = request.GET.get('type') #if id == 'amps-nmr': # c.num = 3 #elif id == 'maxocc': # c.num = 12 #elif id == 'anisofit': # c.num = 11 elif 'id' in request.params: id = request.GET.get('id') #print '*'*40,id elif session.has_key('PORTAL'): id = session['PORTAL'] else: id = 'amps-nmr' #c.num = 3 #if session.has_key('PORTAL'): # if session['PORTAL'] == 'amps-nmr': # c.num = 3 # id = session['PORTAL'] # elif session['PORTAL'] == 'maxocc': # c.num = 13 # id = session['PORTAL'] # elif session['PORTAL'] == 'anisofit': # c.num = 11 # id = session['PORTAL'] #f = open('/tmp/mah', 'w') #f.write(id) #f.close() if id == '1' or id == '5': return WSGIController.__call__(self, environ, start_response) if id in portalwithmenu: if id == 'amber': print "someone use amber yet!" id = 'amps-nmr' ca = Session.query(CalculationTipology).filter( CalculationTipology.tipology == id) type_id = ca[0].id portal_menu = Session.query(Menu).filter( and_(Menu.parent_id == None, Menu.sibling_id == None, Menu.calctype_id == type_id)).order_by( Menu.weight.asc()).all() all_menu = Session.query(Menu).filter( and_(Menu.parent_id == None, Menu.sibling_id == None, Menu.calctype_id == 4)).order_by( Menu.weight.asc()).all() c.main_menu = sorted(portal_menu + all_menu, key=lambda menu: menu.weight) if u'REMOTE_USER' in session: c.current_user = Session.query(Users).get( session[u'REMOTE_USER']) #log.debug(len(c.main_menu)) #if u'REMOTE_USER' in session: #c.current_user = Session.query(Users).get(session[u'REMOTE_USER']) #if not environ[u'PATH_INFO'].endswith(u'/'): #environ[u'PATH_INFO'] += u'/' #url = construct_url(environ) #log.debug('PATH_INFO: %s URL: %s' % (environ[u'PATH_INFO'], url)) #raise HTTPMovedPermanently(url) print "*******************", id return WSGIController.__call__(self, environ, start_response) finally: Session.remove()
class JSONRPCController(WSGIController): """ A WSGI-speaking JSON-RPC 2.0 controller class See the specification: `<http://groups.google.com/group/json-rpc/web/json-rpc-2-0>`. Many parts of this controller are modelled after XMLRPCController from Pylons 0.9.7 Valid controller return values should be json-serializable objects. Sub-classes should catch their exceptions and raise JSONRPCError if they want to pass meaningful errors to the client. Unhandled errors should be caught and return JSONRPC_INTERNAL_ERROR to the client. Parts of the specification not supported (yet): - Notifications - Batch """ def _get_method_args(self): """Return `self._rpc_args` to dispatched controller method chosen by __call__""" return self._rpc_args def __call__(self, environ, start_response): """Parse the request body as JSON, look up the method on the controller and if it exists, dispatch to it. """ length = 0 if 'CONTENT_LENGTH' not in environ: log.debug("No Content-Length") abort(411) else: if environ['CONTENT_LENGTH'] == '': abort(411) length = int(environ['CONTENT_LENGTH']) log.debug('Content-Length: %s', length) if length == 0: log.debug("Content-Length is 0") abort(411) raw_body = environ['wsgi.input'].read(length) json_body = json.loads(urllib.unquote_plus(raw_body)) self._req_id = json_body['id'] self._req_method = json_body['method'] self._req_params = json_body['params'] log.debug('id: %s, method: %s, params: %s', self._req_id, self._req_method, self._req_params) self._error = None try: self._func = self._find_method() except AttributeError, e: err = jsonrpc_error(self._req_id, 'method_not_found') return err(environ, start_response) # now that we have a method, make sure we have enough # parameters and pass off control to the controller. if not isinstance(self._req_params, dict): # JSON-RPC version 1 request. arglist = inspect.getargspec(self._func)[0][1:] if len(self._req_params) < len(arglist): err = jsonrpc_error(self._req_id, 'invalid_params') return err(environ, start_response) else: kargs = dict(zip(arglist, self._req_params)) else: # JSON-RPC version 2 request. Params may be default, and # are already a dict, so skip the parameter length check here. kargs = self._req_params # XX Fix this namespace clash. One cannot use names below as # method argument names as this stands! kargs['action'], kargs['environ'] = self._req_method, environ kargs['start_response'] = start_response self._rpc_args = kargs status = [] headers = [] exc_info = [] def change_content(new_status, new_headers, new_exc_info=None): status.append(new_status) headers.extend(new_headers) exc_info.append(new_exc_info) output = WSGIController.__call__(self, environ, change_content) output = list(output) headers.append(('Content-Length', str(len(output[0])))) replace_header(headers, 'Content-Type', 'application/json') start_response(status[0], headers, exc_info[0]) return output
def __call__(self, environ, start_response): # we override this here to ensure that this header, and only this # header, is trusted to reduce the number of potential # misconfigurations between wsgi application servers (e.g. gunicorn # which trusts three different headers out of the box for this) and # haproxy (which won't clean out bad headers by default) forwarded_proto = environ.get("HTTP_X_FORWARDED_PROTO", "http").lower() assert forwarded_proto in ("http", "https") request.environ["wsgi.url_scheme"] = forwarded_proto forwarded_for = environ.get('HTTP_X_FORWARDED_FOR', ()) remote_addr = environ.get('REMOTE_ADDR') request.via_cdn = False cdn_ip = g.cdn_provider.get_client_ip(environ) if cdn_ip: request.ip = cdn_ip request.via_cdn = True elif g.trust_local_proxies and forwarded_for and is_local_address( remote_addr): request.ip = forwarded_for.split(',')[-1] else: request.ip = environ['REMOTE_ADDR'] #if x-dont-decode is set, pylons won't unicode all the parameters if environ.get('HTTP_X_DONT_DECODE'): request.charset = None request.referer = environ.get('HTTP_REFERER') request.user_agent = environ.get('HTTP_USER_AGENT') request.fullpath = environ.get('FULLPATH', request.path) request.fullurl = request.host_url + request.fullpath request.port = environ.get('request_port') if_modified_since = environ.get('HTTP_IF_MODIFIED_SINCE') if if_modified_since: request.if_modified_since = read_http_date(if_modified_since) else: request.if_modified_since = None #set the function to be called action = request.environ['pylons.routes_dict'].get('action') if (request.environ.get('r2.controller.exception') and action == 'document' and request.environ.get('render_style') == 'api'): action = 'api_error' if action: meth = request.method.upper() if meth == 'HEAD': meth = 'GET' if (meth == 'OPTIONS' and self._get_action_handler(action, meth) is None): handler_name = meth else: handler_name = meth + '_' + action request.environ['pylons.routes_dict']['action_name'] = action request.environ['pylons.routes_dict']['action'] = handler_name return WSGIController.__call__(self, environ, start_response)
self._rpc_args.update(self._request_params) self._rpc_args['action'] = self._req_method self._rpc_args['environ'] = environ self._rpc_args['start_response'] = start_response status = [] headers = [] exc_info = [] def change_content(new_status, new_headers, new_exc_info=None): status.append(new_status) headers.extend(new_headers) exc_info.append(new_exc_info) output = WSGIController.__call__(self, environ, change_content) output = list(output) headers.append(('Content-Length', str(len(output[0])))) replace_header(headers, 'Content-Type', 'application/json') start_response(status[0], headers, exc_info[0]) return output def _dispatch_call(self): """ Implement dispatch interface specified by WSGIController """ try: raw_response = self._inspect_call(self._func) if isinstance(raw_response, HTTPError): self._error = str(raw_response)
def __call__(self, environ, start_response): """Parse an XMLRPC body for the method, and call it with the appropriate arguments""" # Pull out the length, return an error if there is no valid # length or if the length is larger than the max_body_length. log_debug = self._pylons_log_debug length = environ.get('CONTENT_LENGTH') if length: length = int(length) else: # No valid Content-Length header found if log_debug: log.debug("No Content-Length found, returning 411 error") abort(411) if length > self.max_body_length or length == 0: if log_debug: log.debug( "Content-Length larger than max body length. Max: " "%s, Sent: %s. Returning 413 error", self.max_body_length, length) abort(413, "XML body too large") body = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH'])) rpc_args, orig_method = xmlrpclib.loads(body) method = self._find_method_name(orig_method) func = self._find_method(method) if not func: if log_debug: log.debug("Method: %r not found, returning xmlrpc fault", method) return xmlrpc_fault(0, "No such method name %r" % method)( environ, start_response) # Signature checking for params if hasattr(func, 'signature'): if log_debug: log.debug("Checking XMLRPC argument signature") valid_args = False params = xmlrpc_sig(rpc_args) for sig in func.signature: # Next sig if we don't have the same amount of args if len(sig) - 1 != len(rpc_args): continue # If the params match, we're valid if params == sig[1:]: valid_args = True break if not valid_args: if log_debug: log.debug("Bad argument signature recieved, returning " "xmlrpc fault") msg = ("Incorrect argument signature. %r recieved does not " "match %r signature for method %r" % \ (params, func.signature, orig_method)) return xmlrpc_fault(0, msg)(environ, start_response) # Change the arg list into a keyword dict based off the arg # names in the functions definition arglist = inspect.getargspec(func)[0][1:] kargs = dict(zip(arglist, rpc_args)) kargs['action'], kargs['environ'] = method, environ kargs['start_response'] = start_response self.rpc_kargs = kargs self._func = func # Now that we know the method is valid, and the args are valid, # we can dispatch control to the default WSGIController status = [] headers = [] exc_info = [] def change_content(new_status, new_headers, new_exc_info=None): status.append(new_status) headers.extend(new_headers) exc_info.append(new_exc_info) output = WSGIController.__call__(self, environ, change_content) output = list(output) headers.append(('Content-Length', str(len(output[0])))) replace_header(headers, 'Content-Type', 'text/xml') start_response(status[0], headers, exc_info[0]) return output
def __call__(self, environ, start_response): """Invoke the Controller""" c.body_css_classes = [] c.body_css_classes.append('controller-' + self.identifier) if self.identifier in [ 'proposals', 'milestones', 'norms', 'category', 'members' ]: c.active_subheader_nav = self.identifier c.body_css_classes.append('area-' + self.identifier) c.instance = model.instance_filter.get_instance() if c.instance is not None: c.body_css_classes.append(u'instance-%s' % c.instance.key) # setup a global variable to mark the current item in # the global navigation global_nav = 'instances' if c.instance is not None else 'home' c.active_global_nav = global_nav c.body_css_classes.append('global_nav_' + global_nav) user_id = environ.get('repoze.who.identity', {}).get('user', None) user = None # make sure we're not using a detached user object if user_id is not None: user = model.meta.Session.merge(user_id) if user and (user.banned or user.delete_time): user = None if user is not None: c.body_css_classes.append('logged_in') else: c.body_css_classes.append('not_logged_in') c.user = user c.active_controller = request.environ.get('pylons.routes_dict')\ .get('controller') c.debug = config.get_bool('debug') i18n.handle_request() if h.site.is_local_url(request.params.get(u'came_from', u'')): c.came_from = request.params.get(u'came_from', u'') monitor_page_time_interval = config.get_int( 'adhocracy.monitor_page_time_interval', -1) c.page_stats_url = h.base_url('/stats/on_page') if monitor_page_time_interval > 0: c.monitor_page_time_interval = monitor_page_time_interval if config.get_bool('adhocracy.monitor_external_links'): c.monitor_external_links_url = h.base_url('/stats/record_external') if config.get_bool('adhocracy.monitor_browser_values'): c.monitor_browser_values = "enabled" if config.get_bool('adhocracy.monitor_extended'): c.monitor_extended = "enabled" if config.get_bool('adhocracy.monitor_page_performance'): c.monitor_page_performance = "enabled" if config.get_bool('adhocracy.monitor_pager_clicks'): c.monitor_pager_clicks = "enabled" h.add_rss("%s News" % h.site.name(), h.base_url('/feed.rss', None)) if c.instance: h.add_rss("%s News" % c.instance.label, h.base_url('/instance/%s.rss' % c.instance.key)) h.add_meta( "description", config.get( 'adhocracy.site.description', _(u"A liquid democracy platform for making decisions in " u"distributed, open groups by cooperatively creating " u"proposals and voting on them to establish their " u"support."))) h.add_meta( "keywords", _("adhocracy, direct democracy, liquid democracy, liqd, " "democracy, wiki, voting,participation, group decisions, " "decisions, decision-making")) try: return WSGIController.__call__(self, environ, start_response) except Exception, e: log.exception(e) model.meta.Session.rollback() raise
def __call__(self, environ, start_response): """Invoke the Controller""" c.instance = model.instance_filter.get_instance() if c.instance is not None: # setup a global variable to mark the current item in # the global navigation c.active_global_nav = 'instances' else: c.active_global_nav = 'home' c.user = environ.get('repoze.who.identity', {}).get('user') # make sure we're not using a detached user object if c.user: c.user = model.meta.Session.merge(c.user) if c.user and (c.user.banned or c.user.delete_time): c.user = None c.active_controller = request.environ.get('pylons.routes_dict')\ .get('controller') c.debug = config.get_bool('debug') i18n.handle_request() monitor_page_time_interval = config.get_int( 'adhocracy.monitor_page_time_interval', -1) c.page_stats_url = h.base_url('/stats/on_page') if monitor_page_time_interval > 0: c.monitor_page_time_interval = monitor_page_time_interval if config.get_bool('adhocracy.monitor_external_links', False): c.monitor_external_links_url = h.base_url('/stats/record_external') if config.get_bool('adhocracy.monitor_browser_values', False): c.monitor_browser_values = "enabled" if config.get_bool('adhocracy.monitor_extended', False): c.monitor_extended = "enabled" if config.get_bool('adhocracy.monitor_page_performance', False): c.monitor_page_performance = "enabled" if config.get_bool('adhocracy.monitor_pager_clicks', False): c.monitor_pager_clicks = "enabled" h.add_rss("%s News" % h.site.name(), h.base_url('/feed.rss', None)) if c.instance: h.add_rss("%s News" % c.instance.label, h.base_url('/instance/%s.rss' % c.instance.key)) h.add_meta("description", config.get( 'adhocracy.site.description', _(u"A liquid democracy platform for making decisions in " u"distributed, open groups by cooperatively creating " u"proposals and voting on them to establish their " u"support."))) h.add_meta("keywords", _("adhocracy, direct democracy, liquid democracy, liqd, " "democracy, wiki, voting,participation, group decisions, " "decisions, decision-making")) try: return WSGIController.__call__(self, environ, start_response) except Exception, e: log.exception(e) model.meta.Session.rollback() raise
def __init__(self): WSGIController.__init__(self) self._setupConfig()