コード例 #1
0
ファイル: views.py プロジェクト: khchine5/extjs6
def delete_element(ar, elem):
    if elem is None:
        raise Warning("Cannot delete None")
    msg = ar.actor.disable_delete(elem, ar)
    if msg is not None:
        ar.error(None, msg, alert=True)
        return settings.SITE.kernel.render_action_response(ar)

    #~ dblogger.log_deleted(ar.request,elem)

    #~ changes.log_delete(ar.request,elem)

    dd.pre_ui_delete.send(sender=elem, request=ar.request)

    try:
        elem.delete()
    except Exception as e:
        dblogger.exception(e)
        msg = _("Failed to delete %(record)s : %(error)s."
                ) % dict(record=dd.obj2unicode(elem), error=e)
        #~ msg = "Failed to delete %s." % element_name(elem)
        ar.error(None, msg)
        return settings.SITE.kernel.render_action_response(ar)
        #~ raise Http404(msg)

    return HttpResponseDeleted()
コード例 #2
0
def delete_element(ar, elem):
    if elem is None:
        raise Warning("Cannot delete None")
    msg = ar.actor.disable_delete(elem, ar)
    if msg is not None:
        ar.error(None, msg, alert=True)
        return settings.SITE.kernel.render_action_response(ar)

    #~ dblogger.log_deleted(ar.request,elem)

    #~ changes.log_delete(ar.request,elem)

    dd.pre_ui_delete.send(sender=elem, request=ar.request)

    try:
        elem.delete()
    except Exception as e:
        dblogger.exception(e)
        msg = _("Failed to delete %(record)s : %(error)s.") % dict(
            record=dd.obj2unicode(elem), error=e)
        #~ msg = "Failed to delete %s." % element_name(elem)
        ar.error(None, msg)
        return settings.SITE.kernel.render_action_response(ar)
        #~ raise Http404(msg)

    return HttpResponseDeleted()
コード例 #3
0
 def yes(ar2):
     msg = _("%s has been saved.") % dd.obj2unicode(obj)
     if not dd.plugins.beid.read_only_simulate:
         for o in objects:
             o.full_clean()
             o.save()
         watcher.send_update(ar2)
     msg = simulate_wrap(msg)
     return self.goto_client_response(ar2, obj, msg)
コード例 #4
0
ファイル: mixins.py プロジェクト: zhuangyan/lino
 def yes(ar2):
     msg = _("%s has been saved.") % dd.obj2unicode(obj)
     if not config.read_only_simulate:
         for o in objects:
             o.full_clean()
             o.save()
         watcher.send_update(ar2.request)
     msg = simulate_wrap(msg)
     return self.goto_client_response(ar2, obj, msg)
コード例 #5
0
ファイル: mixins.py プロジェクト: khchine5/xl
    def run_from_ui(self, ar, **kw):
        obj = ar.selected_rows[0]
        if obj.printed_by_id is None:
            ar.error(_("Oops, the print cache was already cleared."))
            return

        def ok(ar2):
            obj.clear_cache()
            ar2.success(_("Print cache file has been cleared."), refresh=True)
        if False:
            ar.confirm(
                ok,
                _("Going to clear the print cache file of %s") %
                dd.obj2unicode(obj))
        else:
            ok(ar)
コード例 #6
0
    def run_from_ui(self, ar, **kw):
        obj = ar.selected_rows[0]
        if obj.printed_by_id is None:
            ar.error(_("Oops, the print cache was already cleared."))
            return

        def ok(ar2):
            obj.clear_cache()
            ar2.success(_("Print cache file has been cleared."), refresh=True)
        if False:
            ar.confirm(
                ok,
                _("Going to clear the print cache file of %s") %
                dd.obj2unicode(obj))
        else:
            ok(ar)
コード例 #7
0
 def obj2unicode(cls, obj, ar):
     return dd.obj2unicode(obj)
コード例 #8
0
ファイル: models.py プロジェクト: zhuangyan/lino
 def obj2unicode(cls, obj, ar):
     return dd.obj2unicode(obj)