• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python transaction.Transaction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: prepare

def prepare(request):
    """ prepare the transaction """
    if request.method == "POST":
        modules = []
        for module, value in request.POST.items():
            modules.append(module)
        transaction = Transaction(request, modules)
        return HttpResponseRedirect(transaction.first_step_url())
    else:
        return HttpResponseRedirect(reverse('sections'))
开发者ID:figarocorso,项目名称:mss,代码行数:10,代码来源:views.py


示例17: gettransaction

 def gettransaction(self, txid, deserialized=False):
     """Retrieve a transaction. """
     tx = self.wallet.transactions.get(txid) if self.wallet else None
     if tx is None and self.network:
         raw = self.network.synchronous_get(('blockchain.transaction.get', [txid]))
         if raw:
             tx = Transaction(raw)
         else:
             raise BaseException("Unknown transaction")
     return tx.deserialize() if deserialized else tx
开发者ID:mnaamani,项目名称:electrum,代码行数:10,代码来源:commands.py


示例18: install

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

    # launch modules install
    xmlrpc.call('install_modules', transaction.modules_list)
    return render(request, 'install.html', {'transaction': transaction})
开发者ID:figarocorso,项目名称:mss,代码行数:10,代码来源:views.py


示例19: __init__

    def __init__(self, data):
        self._data = data

        # Call after data has been set (size is computed in Transaction's init)
        Transaction.__init__(self)

        # Insert the transaction in the Manager
        self._trManager.append(self)
        logging.debug("Created transaction %d" % self.get_id())
        self._trManager.flush()
开发者ID:SafPlusPlus,项目名称:dd-agent,代码行数:10,代码来源:ddagent.py


示例20: 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)
     t.deserialize()
     if privkey:
         pubkey = bitcoin.public_key_from_private_key(privkey)
         t.sign({pubkey:privkey})
     else:
         self.wallet.sign_transaction(t, self.password)
     return t
开发者ID:mnaamani,项目名称:electrum,代码行数:10,代码来源:commands.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python transaction.TransactionManager类代码示例发布时间:2022-05-27
下一篇:
Python transaction.savepoint函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap