2 from ConfigParser import RawConfigParser
3 from myslice.settings import ROOT
5 # as this code suggests, you have the option to override these defaults
6 # by writing a file myslice/myslice.ini
9 #url = http://manifold.pl.sophia.inria.fr:7080/
11 #admin_password = admin
13 # use a singleton instead of staticmethods
14 from manifold.util.singleton import Singleton
17 __metaclass__ = Singleton
19 # the OpenLab-wide backend as managed by UPMC
20 # xxx production should probably use https of course
21 default_manifold_url = "https://test.myslice.info:7080/"
22 # the devel/unstable version runs on "https://dev.myslice.info:7080/"
23 # if you use a development backend running on this box, use "http://localhost:7080/"
24 # the INRIA setup is with "https://manifold.pl.sophia.inria.fr:7080/"
26 default_manifold_admin_user = 'admin'
27 default_manifold_admin_password = 'demo'
31 parser = RawConfigParser ()
32 parser.add_section('manifold')
33 parser.set ('manifold', 'url', Config.default_manifold_url)
34 parser.set ('manifold', 'admin_user', Config.default_manifold_admin_user)
35 parser.set ('manifold', 'admin_password', Config.default_manifold_admin_password)
36 parser.add_section('googlemap')
37 parser.set ('googlemap','api_key', None)
38 parser.read (os.path.join(ROOT,'myslice/myslice.ini'))
39 self.config_parser=parser
41 def manifold_url (self):
42 return self.config_parser.get('manifold','url')
44 def manifold_admin_user_password(self):
45 return (self.config_parser.get('manifold','admin_user'),
46 self.config_parser.get('manifold','admin_password'))
48 def googlemap_api_key (self):
49 return self.config_parser.get('googlemap','api_key')
51 # exporting these details to js
52 def manifold_js_export (self):
53 return "var MANIFOLD_URL = '%s';\n"%self.manifold_url();