示例#1
0
def update_custom_texts(store, lang, texts):
    custom_texts = store.find(models.CustomTexts, models.CustomTexts.lang == unicode(lang)).one()
    if custom_texts is None:
        custom_texts = models.CustomTexts()
        custom_texts.lang = lang
        store.add(custom_texts)

    custom_texts.texts = texts
示例#2
0
def update(session, tid, lang, request):
    texts = session.query(models.CustomTexts).filter(
        models.CustomTexts.tid == tid, models.CustomTexts.lang == lang).one_or_none()
    if texts is None:
        session.add(models.CustomTexts(
            {'tid': tid, 'lang': lang, 'texts': request}))
    else:
        texts.texts = request
示例#3
0
def update(session, tid, lang, request):
    """
    Transaction for updating the texts customizations of a tenant

    :param session: An ORM session
    :param tid: A tentant ID
    :param lang: The language to be used for the update
    :param request: The customization data
    """
    session.merge(
        models.CustomTexts({
            'tid': tid,
            'lang': lang,
            'texts': request
        }))
示例#4
0
def update(store, lang, request):
    texts = store.find(models.CustomTexts, lang=lang).one()
    if texts is None:
        store.add(models.CustomTexts({'lang': lang, 'texts': request}))
    else:
        texts.texts = request