Exemplo n.º 1
0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

import sys
import os, os.path

sys.path.append(os.path.dirname(os.getcwd() + '/..'))
from lodel.context import LodelContext
LodelContext.init()
from lodel.settings.settings import Settings as settings
settings('globconf.d')
from lodel.settings import Settings


def generate_dyncode(model_file, translator):
    from lodel.editorial_model.model import EditorialModel
    from lodel.leapi import lefactory

    model = EditorialModel.load(translator, filename=model_file)
    dyncode = lefactory.dyncode_from_em(model)
    return dyncode


def refresh_dyncode(model_file, translator, output_filename):
Exemplo n.º 2
0
#Here we have to bootstrap a minimal __loader__ context in order
#to be able to load the settings
#
#This file (once bootstraped) start a new process for uWSGI. uWSGI then
#run lodel.plugins.multisite.run.application function
try:
    from lodel.context import LodelContext
except ImportError:
    LODEL_BASE_DIR = os.path.dirname(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
    from lodel.context import LodelContext

from lodel import buildconf

LodelContext.init(LodelContext.MULTISITE)
LodelContext.set(None)  #Loading context creation
#Multisite instance settings loading
CONFDIR = os.path.join(os.getcwd(), 'conf.d')
if not os.path.isdir(CONFDIR):
    warnings.warn('%s do not exists, default settings used' % CONFDIR)
LodelContext.expose_modules(
    globals(), {
        'lodel.settings.settings': [('Settings', 'settings')],
        'lodel.plugins.multisite.confspecs': 'multisite_confspecs'
    })
if not settings.started():
    settings('./conf.d', multisite_confspecs.LODEL2_CONFSPECS)

LodelContext.expose_modules(globals(), {'lodel.settings': ['Settings']})