>From within the setup_app function (websetup.py) of a pylons i18n
application, which is making use of a db, I was trying to initiate
multilingual content to be inserted into a db.
To do so the idea was something like:
#necessary imports here
def setup_app(command, conf, vars):
....
for lang in langs:
set_lang(lang)
content=model.Content()
content.content=_('content')
Session.add(content)
Session.commit()
Unfortunately it seems that it doesn't work. the set_lang code line is
firing an exception as follows:
File ".. i18n/translation.py", line 179, in set_lang
translator = _get_translator(lang, **kwargs)
File ".. i18n/translation.py", line 160, in _get_translator
localedir = os.path.join(rootdir, 'i18n')
File ".. /posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Actually I'm even not sure it could be possible launching i18n
mechanisms from within this setup_app function without an active
request object.
Anyone has tried some trick on a similar story ?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.