当前位置: 首页>>代码示例>>Python>>正文


Python transaction.Transaction类代码示例

本文整理汇总了Python中transaction.Transaction的典型用法代码示例。如果您正苦于以下问题:Python Transaction类的具体用法?Python Transaction怎么用?Python Transaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Transaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: download

def download(request):
    transaction = Transaction(request)
    transaction.set_current_step(Steps.DOWNLOAD)
    if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
        return HttpResponseRedirect(transaction.next_step_url())

    return render(request, 'download.html', {'transaction': transaction})
开发者ID:figarocorso,项目名称:mss,代码行数:7,代码来源:views.py

示例2: checkUndoInvalidation

    def checkUndoInvalidation(self):
        oid = self._storage.new_oid()
        revid = self._dostore(oid, data=MinPO(23))
        revid = self._dostore(oid, revid=revid, data=MinPO(24))
        revid = self._dostore(oid, revid=revid, data=MinPO(25))

        info = self._storage.undoInfo()
        if not info:
            # Preserved this comment, but don't understand it:
            # "Perhaps we have an old storage implementation that
            #  does do the negative nonsense."
            info = self._storage.undoInfo(0, 20)
        tid = info[0]['id']

        # Now start an undo transaction
        t = Transaction()
        t.note('undo1')
        oids = self._begin_undos_vote(t, tid)

        # Make sure this doesn't load invalid data into the cache
        self._storage.load(oid, '')

        self._storage.tpc_finish(t)

        assert len(oids) == 1
        assert oids[0] == oid
        data, revid = self._storage.load(oid, '')
        obj = zodb_unpickle(data)
        assert obj == MinPO(24)
开发者ID:1-Hash,项目名称:ZEO,代码行数:29,代码来源:Cache.py

示例3: TestTransaction

class TestTransaction(unittest.TestCase):
  def setUp(self):
    Transaction.objects = {}

    self.transaction = Transaction(datetime(2014, 10, 4, 20, 0), 33.50)

  def test_initial_attributes(self):
    self.transaction.date        |should| equal_to(datetime(2014, 10, 4, 20, 0))
    self.transaction.month       |should| equal_to(10)
    self.transaction.value       |should| equal_to(33.50)
    self.transaction.id          |should| equal_to(1)

  def test_persistence(self):
    Transaction.objects |should| equal_to({ 1: self.transaction })

  def test_associate_credit_card(self):
    with Stub() as credit_card: credit_card.id >> 1

    self.transaction.associate_credit_card(credit_card)

    self.transaction.credit_card_id |should| equal_to(credit_card.id)

  def test_associate_seller(self):
    with Stub() as seller: seller.id >> 1

    self.transaction.associate_seller(seller)

    self.transaction.seller_id |should| equal_to(seller.id)
开发者ID:oswaldoferreira,项目名称:python-classes,代码行数:28,代码来源:transaction_spec.py

示例4: undo

 def undo(self, tid, note=None):
     t = Transaction()
     if note is not None:
         t.note(note)
     oids = self._begin_undos_vote(t, tid)
     self._storage.tpc_finish(t)
     return oids
开发者ID:NextThought,项目名称:ZODB,代码行数:7,代码来源:TransactionalUndoStorage.py

示例5: config

def config(request):
    """ configuration page """
    transaction = Transaction(request)
    transaction.set_current_step(Steps.CONFIG)
    if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
        return HttpResponseRedirect(transaction.next_step_url())

    config = xmlrpc.call('get_config', transaction.modules_list)

    run_config = False
    skip_config = True
    for module in transaction.modules_info:
        if module["has_configuration"]:
            skip_config = False
        if module["has_configuration_script"]:
            run_config = True

    # modules don't have configuration scripts
    if not run_config:
        for module in transaction.modules_list:
            config_end(request, module)
        return render(request, 'config_no.html', {'transaction': transaction})
    # some module have configuration
    elif not skip_config:
        return render(request, 'config.html', {'transaction': transaction, 'config': config})
    else:
        return HttpResponseRedirect(reverse('config_valid'))
开发者ID:figarocorso,项目名称:mss,代码行数:27,代码来源:views.py

示例6: preinst

def preinst(request):
    """ preinst page """
    transaction = Transaction(request)
    transaction.set_current_step(Steps.PREINST)
    if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
        return HttpResponseRedirect(transaction.next_step_url())

    return render(request, 'preinst.html', {'transaction': transaction})
开发者ID:figarocorso,项目名称:mss,代码行数:8,代码来源:views.py

示例7: undo

 def undo(self, tid, note):
     t = Transaction()
     t.note(note)
     self._storage.tpc_begin(t)
     oids = self._storage.undo(tid, t)
     self._storage.tpc_vote(t)
     self._storage.tpc_finish(t)
     return oids
开发者ID:grodniewicz,项目名称:oship,代码行数:8,代码来源:TransactionalUndoStorage.py

示例8: all_unknown

 def all_unknown(self, message, *args, **kwargs):
     __callstack_var_tx__ = Transaction(name=self._transactionName)
     yield self.once.begin(self._transactionName)
     try:
         yield self.all.unknown(message, *args, **kwargs)
         yield __callstack_var_tx__.commit()
     except TransactionException:
         yield __callstack_var_tx__.rollback()
开发者ID:seecr,项目名称:meresco-core,代码行数:8,代码来源:transactionscope.py

示例9: end

def end(request):
    transaction = Transaction(request)
    transaction.set_current_step(Steps.END)

    for module in transaction.modules_list:
        xmlrpc.call("end_config", module, 0, "")

    return render(request, "end.html", {"transaction": transaction})
开发者ID:jfmorcillo,项目名称:mss,代码行数:8,代码来源:views.py

示例10: medias_auth

def medias_auth(request):
    """ media auth page """
    transaction = Transaction(request)
    transaction.set_current_step(Steps.MEDIAS_AUTH)
    if transaction.current_step()['state'] in (State.DONE, State.DISABLED):
        return HttpResponseRedirect(transaction.next_step_url())

    return render(request, 'media_auth.html', {'transaction': transaction})
开发者ID:figarocorso,项目名称:mss,代码行数:8,代码来源:views.py

示例11: signtransaction

 def signtransaction(self, tx, privkey=None):
     """Sign a transaction. The wallet keys will be used unless a private key is provided."""
     t = Transaction(tx)
     if privkey:
         pubkey = lbrycrd.public_key_from_private_key(privkey)
         t.sign({pubkey:privkey})
     else:
         self.wallet.sign_transaction(t, self._password)
     return t.as_dict()
开发者ID:DaveA50,项目名称:lbryum,代码行数:9,代码来源:commands.py

示例12: end

def end(request):
    transaction = Transaction(request)
    transaction.set_current_step(Steps.END)

    for module in transaction.modules_list:
        xmlrpc.call('end_config', module, 0, "")

    return render(request, 'end.html',
                  {'transaction': transaction})
开发者ID:figarocorso,项目名称:mss,代码行数:9,代码来源:views.py

示例13: transfer_required_deposits

	def transfer_required_deposits(self):
		from transaction import Transaction
		
		transaction = Transaction()
		value = round(float(self.r*self.get_account("D")), 4)
		transaction.this_transaction("rD",  self.identifier,  -3,  value,  self.rb,  0,  -1)
		self.accounts.append(transaction)
		
		return  -1.0*value
开发者ID:B-Leslie,项目名称:systemshock,代码行数:9,代码来源:bank.py

示例14: __init__

    def __init__(self, size, manager):
        Transaction.__init__(self)
        self._trManager = manager
        self._size = size
        self._flush_count = 0
        self._endpoint = 'https://example.com'
        self._api_key = 'a' * 32

        self.is_flushable = False
开发者ID:SupersonicAds,项目名称:dd-agent,代码行数:9,代码来源:test_transaction.py

示例15: decode_transaction

	def decode_transaction(self, document):
			assert document["_type"] == "transaction"
			transaction = Transaction(document['_id'], document["time"])
			transaction.value_in = document['value_in']
			transaction.value_out = document['value_out']
			transaction.addressesValue_receving = document['addressesValue_receving']
			transaction.addressesValue_sending = document['addressesValue_sending']
	
			return transaction
开发者ID:V1LL0,项目名称:bitcoinVisualization,代码行数:9,代码来源:dao.py


注:本文中的transaction.Transaction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。