From: Thierry Parmentelat Date: Tue, 1 Oct 2013 12:39:20 +0000 (+0200) Subject: Merge branch 'configfile' into checkboxes X-Git-Tag: myslice-0.2-5~61 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a387c58445b7cde5ecf05a022c5a875645eeb463;hp=99791cf1c8642e4e9b34a68aa1d44f2d61370613;p=unfold.git Merge branch 'configfile' into checkboxes --- diff --git a/manifold/manifoldapi.py b/manifold/manifoldapi.py index 47cf4c98..3fa5f978 100644 --- a/manifold/manifoldapi.py +++ b/manifold/manifoldapi.py @@ -27,7 +27,7 @@ class ManifoldAPI: self.trace = [] self.calls = {} self.multicall = False - self.url = config.manifold_url + self.url = config.manifold_url() self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True) def __repr__ (self): return "ManifoldAPI[%s]"%self.url diff --git a/manifold/static/js/manifold-query.js b/manifold/static/js/manifold-query.js index 4da77da1..3116f84d 100644 --- a/manifold/static/js/manifold-query.js +++ b/manifold/static/js/manifold-query.js @@ -31,7 +31,7 @@ INSERT INTO object VALUES(field=value) this.__repr = function () { res = "ManifoldQuery "; - res += " id=" + this.query_uuid; +// res += " id=" + this.query_uuid; res += " a=" + this.action; res += " o=" + this.object; res += " ts=" + this.timestamp; diff --git a/manifold/static/js/manifold.js b/manifold/static/js/manifold.js index 726e68fd..791e4cfc 100644 --- a/manifold/static/js/manifold.js +++ b/manifold/static/js/manifold.js @@ -364,8 +364,7 @@ var manifold = { // by default we publish using the same uuid of course if (publish_uuid==undefined) publish_uuid=query.query_uuid; if (manifold.asynchroneous_debug) { - messages.debug("sending POST on " + manifold.proxy_url + " to be published on " + publish_uuid); - messages.debug("... ctd... with actual query= " + query.__repr()); + messages.debug("sending POST on " + manifold.proxy_url + query.__repr()); } query.iter_subqueries(function (sq) { diff --git a/myslice/config.py b/myslice/config.py index c0e171bf..9cf24072 100644 --- a/myslice/config.py +++ b/myslice/config.py @@ -1,18 +1,38 @@ +import os.path +from ConfigParser import RawConfigParser +from myslice.settings import ROOT + +# as this code suggests, you have the option to write myslice/myslice.ini +# that looks like this +#[manifold] +#url = http://manifold.pl.sophia.inria.fr:7080/ + class Config: -# this version of unfold expects a backend that runs a new API + # the OpenLab-wide backend as managed by UPMC + # xxx production should probably use https of course + default_manifold_url = "http://test.myslice.info:7080/" + # the devel/unstable version runs on "http://dev.myslice.info:7080/" + # if you use a development backend running on this box, use "http://localhost:7080/" + # the INRIA setup is with "http://manifold.pl.sophia.inria.fr:7080/" -# production should probably use https of course + _config_parser = None + # having grown tired of screwing up with git stashes + # taking away my local config, we now more properly use + # an external config file to override teh default + @staticmethod + def manifold_url (): + if Config._config_parser: + return Config._config_parser.get('manifold','url') + config = RawConfigParser () + config.add_section('manifold') + config.set ('manifold', 'url', Config.default_manifold_url) + config.read (os.path.join(ROOT,'myslice/myslice.ini')) + Config._config_parser=config + return Config.manifold_url() -# if you use a development backend running on this box -# manifold_url = "http://localhost:7080/" -# the INRIA setup -# manifold_url = "http://manifold.pl.sophia.inria.fr:7080/" -# the OpenLab-wide backend as managed by UPMC -# manifold_url = "http://dev.myslice.info:7080/" # development version - manifold_url = "http://test.myslice.info:7080/" #stable version # exporting these details to js @staticmethod def manifold_js_export (): - return "var MANIFOLD_URL = '%s';\n"%Config.manifold_url; + return "var MANIFOLD_URL = '%s';\n"%Config.manifold_url(); diff --git a/portal/homeview.py b/portal/homeview.py index b5e47fe6..b9d039a5 100644 --- a/portal/homeview.py +++ b/portal/homeview.py @@ -15,7 +15,7 @@ class HomeView (View): # expose this so we can mention the backend URL on the welcome page def default_env (self): return { - 'manifold_url':Config.manifold_url, + 'MANIFOLD_URL':Config.manifold_url(), } def post (self,request): diff --git a/portal/sliceview.py b/portal/sliceview.py index 1eb6778e..0e514dd9 100644 --- a/portal/sliceview.py +++ b/portal/sliceview.py @@ -21,6 +21,8 @@ from plugins.active_filters import ActiveFilters from plugins.quickfilter import QuickFilter from plugins.messages import Messages +from myslice.config import Config + tmp_default_slice='ple.upmc.myslicedemo' # temporary : turn off the users part to speed things up @@ -33,8 +35,9 @@ class SliceView (LoginRequiredAutoLogoutView): page = Page(request) page.add_css_files ('css/slice-view.css') page.add_js_files ( [ "js/common.functions.js" ] ) - page.add_js_chunks ('$(function() { console.log("sliceview: jQuery version " + $.fn.jquery); });') - page.add_js_chunks ('$(function() { console.log("sliceview: users turned %s"); });'%("on" if do_query_users else "off")) + page.add_js_chunks ('$(function() { messages.debug("sliceview: jQuery version " + $.fn.jquery); });') + page.add_js_chunks ('$(function() { messages.debug("sliceview: users turned %s"); });'%("on" if do_query_users else "off")) + page.add_js_chunks ('$(function() { messages.debug("manifold URL %s"); });'%(Config.manifold_url())) page.expose_js_metadata() metadata = page.get_metadata() diff --git a/portal/templates/home-view.html b/portal/templates/home-view.html index 5072e525..123bc28b 100644 --- a/portal/templates/home-view.html +++ b/portal/templates/home-view.html @@ -25,7 +25,7 @@ European and national projects, OneLab offers access to a range of tools and testbeds including PlanetLab Europe, the NITOS wireless testbed, and other federated testbeds.

-

This UI server is connected to the manifold backend running at {{ manifold_url }}.

+

This UI server is connected to the manifold backend running at {{ MANIFOLD_URL }}.

{% endblock unfold2_main %}