예제 #1
0
파일: mUUID.py 프로젝트: imclab/GitFS
    def getUUIDFromFile(filename, create=False):
        uuid = mUUID()

        uuid.readFromFile(filename)
        if uuid.valid():
            return uuid

        lf = LockFile(filename + '.lock')
        try:
            lf.lock()
            uuid.readFromFile(filename)
            if uuid.valid():
                return uuid

            uuid = mUUID()
            uuid.generate()
            if not uuid.writeToFile(filename):
                return None
            return uuid
        finally:
            lf.unlock()
예제 #2
0
파일: generator.py 프로젝트: Zavteq/fixofx
    def to_ofx(self):
        fields = []

        if self.type is None:
            self.type = "DEBIT"

        fields.append(TRNTYPE(self.type))
        fields.append(DTPOSTED(self.date))
        fields.append(TRNAMT(self.amount))

        if self.number is not None:
            fields.append(CHECKNUM(self.number))

        if self.txid is None:
            self.txid = uuid.generate().upper()

        fields.append(FITID(self.txid))
        fields.append(NAME(self.payee))

        if self.memo is not None:
            fields.append(MEMO(self.memo))

        return STMTTRN(*fields)
예제 #3
0
    def to_ofx(self):
        fields = []

        if self.type is None:
            self.type = "DEBIT"

        fields.append(TRNTYPE(self.type))
        fields.append(DTPOSTED(self.date))
        fields.append(TRNAMT(self.amount))

        if self.number is not None:
            fields.append(CHECKNUM(self.number))

        if self.txid is None:
            self.txid = uuid.generate().upper()

        fields.append(FITID(self.txid))
        fields.append(NAME(self.payee))

        if self.memo is not None:
            fields.append(MEMO(self.memo))

        return STMTTRN(*fields)