All pastes #447906 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-19 11:22 UTC
rendered paste body
flowerhour.libs.functions.Log.py:

class Log:

    def __init__(self, file, mode):
        if __debug__:
            self.__descriptor = open(file, mode)

    def __del__(self):
        self.close()

    def append(self, string):
        self.__descriptor.write(string + "\n\n")
        # add some more information if you please                                                                                                            

    def close(self):
        self.__descriptor.close()

    # Variables                                                                                                                                              
    __descriptor = []
#                                                                                                                                                            

global log
log = Log("/tmp/main_log",'w')


views.py:

    from flowerhour.libs.functions import Log

    log.append("something happened")

ERROR:

Exception Type:  	NameError
Exception Value: 	name 'log' is not defined