def __init__(self, category_dom, parent): """ Constructor """ self.parent = parent super(YNAB3_Category, self).__init__(category_dom, \ [xmlize('name'), xmlize('note')])
def __init__(self, category_dom, parent): """ Constructor """ self.parent = parent super(YNAB3_MonthlySubCategoryBudget, self).__init__(category_dom, \ [xmlize('name')])
def __init__(self, transaction_dom): """Constructor """ super(YNAB3_Transaction, self).__init__(transaction_dom, [xmlize('accepted'), \ xmlize('date'), xmlize('account'), xmlize('accountID'),xmlize('payee'), \ xmlize('category'), xmlize('cleared')])
def __init__(self, category_dom): """ Constructor """ super(YNAB3_MonthlyBudget, self).__init__(category_dom, \ [xmlize('categoryName'), xmlize('month')])
class YNAB3_AccountingWidget(object): """ Base class for various YNAB3 things (ie. YNAB3_Payee, YNAB3_Transaction) """ dom = None fields_of_interest = [xmlize('memo'), xmlize('inflow'), xmlize('outflow')] def __init__(self, transaction_dom, additional_fields_of_interest): """Constructor """ self.dom = transaction_dom for field in additional_fields_of_interest: if field not in self.fields_of_interest: self.fields_of_interest.append(field) for child in transaction_dom.childNodes: self.load_properties(child) def get_property(self, name): """ get a property (return None if it doesn't exist) We do this because this class loads properties from the xml dynamically, so there's a chance some properties may be missing """ if hasattr(self, name): return getattr(self, name) return None def get_inflow(self): """ get_inflow """ return self.get_property('inflow') def get_outflow(self): """ get_outflow """ return self.get_property('outflow') def get_balance(self): """ get_balance Get the balance for this transaction, accounting for both outflow and inflow """ if self.get_outflow() != None and self.get_inflow() != None: return float(self.get_inflow()) - float(self.get_outflow()) else: return None def get_memo(self): """ get_memo """ return self.get_property('memo') def toxml(self): """ Get XML representation of this objects dom """ return self.dom.toxml()
def __init__(self, category_dom): """ Constructor """ super(YNAB3_Category, self).__init__(category_dom, \ [xmlize('name'), xmlize('type'), xmlize('note')])
def __init__(self, payee_dom): """Constructor """ super(YNAB3_Payee, self).__init__(payee_dom, [xmlize('category')])