|
|
@ -35,22 +35,19 @@ class RootResource: |
|
|
|
|
|
|
|
|
|
|
|
def get_moin_user(self): |
|
|
|
def get_moin_user(self): |
|
|
|
email, name = '', '' |
|
|
|
email, name = '', '' |
|
|
|
try: |
|
|
|
moin_data_dir = self._get_wiki_data_dir() |
|
|
|
moin_data_dir = self._get_wiki_data_dir() |
|
|
|
moin_session_dir = os.path.join( |
|
|
|
moin_session_dir = os.path.join( |
|
|
|
moin_data_dir, |
|
|
|
moin_data_dir, |
|
|
|
'cache', |
|
|
|
'cache', |
|
|
|
'__session__' |
|
|
|
'__session__' |
|
|
|
) |
|
|
|
) |
|
|
|
moin_user_id = self._get_user_id(moin_session_dir) |
|
|
|
moin_user_id = self._get_user_id(moin_session_dir) |
|
|
|
moin_user_file = os.path.join(moin_data_dir, 'user', moin_user_id) |
|
|
|
moin_user_file = os.path.join(moin_data_dir, 'user', moin_user_id) |
|
|
|
with open(moin_user_file, 'r') as fh: |
|
|
|
with open(moin_user_file, 'r') as fh: |
|
|
|
if 'email=' in line: |
|
|
|
if 'email=' in line: |
|
|
|
email = line.split('=', 1)[1] |
|
|
|
email = line.split('=', 1)[1] |
|
|
|
if 'name=' in line: |
|
|
|
if 'name=' in line: |
|
|
|
name = line.split('=', 1)[1] |
|
|
|
name = line.split('=', 1)[1] |
|
|
|
|
|
|
|
except: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
return email, name |
|
|
|
return email, name |
|
|
|
|
|
|
|
|
|
|
|
def _get_wiki_data_dir(self): |
|
|
|
def _get_wiki_data_dir(self): |
|
|
@ -118,7 +115,6 @@ def the_view(context, request): |
|
|
|
def main(global_config, **settings): |
|
|
|
def main(global_config, **settings): |
|
|
|
""" This function returns a Pyramid WSGI application. |
|
|
|
""" This function returns a Pyramid WSGI application. |
|
|
|
""" |
|
|
|
""" |
|
|
|
print(settings) |
|
|
|
|
|
|
|
RootResource.pre_init(settings['moin.config_path']) |
|
|
|
RootResource.pre_init(settings['moin.config_path']) |
|
|
|
|
|
|
|
|
|
|
|
config = Configurator(settings=settings) |
|
|
|
config = Configurator(settings=settings) |
|
|
|