diff options
Diffstat (limited to 'sugar_network/client/__init__.py')
-rw-r--r-- | sugar_network/client/__init__.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sugar_network/client/__init__.py b/sugar_network/client/__init__.py index d8eefcb..c863e98 100644 --- a/sugar_network/client/__init__.py +++ b/sugar_network/client/__init__.py @@ -21,6 +21,25 @@ from os.path import join, expanduser, exists from sugar_network.toolkit import http, Option +def profile_path(*args): + """Path within sugar profile directory. + + Missed directories will be created. + + :param args: + path parts that will be added to the resulting path + :returns: + full path with directory part existed + + """ + if os.geteuid(): + root_dir = join(os.environ['HOME'], '.sugar', + os.environ.get('SUGAR_PROFILE', 'default')) + else: + root_dir = '/var/sugar-network' + return join(root_dir, *args) + + api_url = Option( 'url to connect to Sugar Network server API', default='http://node-devel.sugarlabs.org', short_option='-a', @@ -36,7 +55,7 @@ no_check_certificate = Option( local_root = Option( 'path to the directory to keep all local data', - default=lambda: profile_path('network'), name='local_root') + default=profile_path('network'), name='local_root') server_mode = Option( 'start server to share local documents', @@ -113,25 +132,6 @@ keyfile = Option( _logger = logging.getLogger('client') -def profile_path(*args): - """Path within sugar profile directory. - - Missed directories will be created. - - :param args: - path parts that will be added to the resulting path - :returns: - full path with directory part existed - - """ - if os.geteuid(): - root_dir = join(os.environ['HOME'], '.sugar', - os.environ.get('SUGAR_PROFILE', 'default')) - else: - root_dir = '/var/sugar-network' - return join(root_dir, *args) - - def path(*args): """Calculate a path from the root. |