#!/usr/bin/env python # -*- coding: utf-8 -*- class Anonymous: def __init__(self, mem_web, key): self.mem_web = mem_web self.__key = key self.__started = False for key in ("settings", "i18n", "_print", "exception"): hasattr(self, key) or setattr(self, key, getattr(mem_web, key)) def start(self, callback = None): self._print("info", "mem_web_" + self.__key + "_starting") end = lambda status:MemWeb.execute(callback, status) if self.__started: self._print("warn", "mem_web_" + self.__key + "_already_started") end(False) return False self.__started = True hasattr(self, "__start") and MemWeb.execute(self.__start, callback) end(True) self._print("ok", "mem_web_" + self.__key + "_started") return True if "MemWeb" not in globals(): class MemWeb:pass if not hasattr(MemWeb, "Abstracts"): class SubAnonymous:pass MemWeb.Abstracts = SubAnonymous del globals()["SubAnonymous"] MemWeb.Abstracts.Common = Anonymous del globals()["Anonymous"]