Beispiel #1
0
#!/usr/bin/python
import os
import sys
import isys
USE_ISYS = False

# only mount dev and umount dev dolog, so we use server Logger
from miutils.milogger import ServerLogger_Long
Log = ServerLogger_Long.get_instance(ServerLogger_Long, __name__)
dolog = Log.i

class AttrDict(dict):
    """A dict class, holding the dict. Two extra method to get dict
    value, e.g.:
    attrs = attrs_dict(cat)
    attrs.tips
    attrs('tips')"""
    def __init__(self, d={}):
        self.d = d
    def __call__(self, arg):
        return self.get(arg, None)
    def __getattr__(self, attr):
        return self.get(attr, None)

class NamedTuple(tuple):
    """Access a tuple by attribute name. e.g.:
    class AutoPartTuple(NamedTuple):
        attr_oder = ['mountpoint', 'size', 'filesystem']

    part = ('/', '32G', 'ext2')
    part = AutoPartTuple(part)
Beispiel #2
0
 def get_instance(TAG):
     return ServerLogger_Long.get_instance(ServerLogger_Long, TAG)
Beispiel #3
0
 def del_instances():
     ServerLogger_Long.del_instances(ServerLogger_Long)
Beispiel #4
0
from miutils.milogger import ServerLogger_Short, ServerLogger_Long
ServerLogger_Long.disable_print_log(ServerLogger_Long)
class LoggerShort(object):
    @staticmethod
    def get_instance(TAG):
        return ServerLogger_Short.get_instance(ServerLogger_Short, TAG)
    @staticmethod
    def del_instances():
        ServerLogger_Short.del_instances(ServerLogger_Short)
        
class LoggerLong(object):
    @staticmethod
    def get_instance(TAG):
        return ServerLogger_Long.get_instance(ServerLogger_Long, TAG)
    @staticmethod
    def del_instances():
        ServerLogger_Long.del_instances(ServerLogger_Long)
        
Logger = LoggerLong
        
from gettext import gettext as _

class FakeMiactions(object):
    def set_step(self, operid, arg0, arg1):
        print 'mia.set_step( %d,  %d, %d )' % (operid, arg0, arg1)