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


Python Transaction.commit方法代码示例

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


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

示例1: all_unknown

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import commit [as 别名]
 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,代码行数:10,代码来源:transactionscope.py

示例2: any_unknown

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import commit [as 别名]
 def any_unknown(self, message, *args, **kwargs):
     __callstack_var_tx__ = Transaction(name=self._transactionName)
     yield self.once.begin(name=self._transactionName)
     try:
         try:            
             response = yield self.any.unknown(message, *args, **kwargs)
         except NoneOfTheObserversRespond:
             raise DeclineMessage
         yield __callstack_var_tx__.commit()
         raise StopIteration(response)
     except TransactionException:
         yield __callstack_var_tx__.rollback()
开发者ID:seecr,项目名称:meresco-core,代码行数:14,代码来源:transactionscope.py

示例3: map

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import commit [as 别名]
        return parent.find_element_by_css_selector(selector).text
    except NoSuchElementException:
        return None

for hotelurl in session.query(HotelUrl).filter(HotelUrl.crawled==None):



    driver.get(hotelurl.hotel_url)
    description = driver.find_element_by_css_selector("#summary").text
    address = driver.find_element_by_css_selector("#hp_address_subtitle")
    features = driver.find_elements_by_css_selector("div.facilitiesChecklistSection")
    
    hotel_features = {}
    for category in features:
        cat = category.find_element_by_css_selector("h5").text
        fs = map(lambda x: x.text, category.find_elements_by_css_selector("li"))
        hotel_features[cat]=fs

    address = extract_address(address.text)
    opinions,hotel_grade = getOpinionsAndHotelGrade(driver,hotelurl.hotel_opinion_url)

    #session, hotel_url, address, hotel_grade, description, opinions, features
    # print description,address,hotel_features,opinions,hotel_grade

    transaction = Transaction(session,hotelurl,address,hotel_grade,description,opinions,hotel_features)
    transaction.commit()

    
    
开发者ID:Zotek,项目名称:ED-bookingcom,代码行数:29,代码来源:detailed_scrap.py

示例4: str

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import commit [as 别名]
                key = args[1]
                value = args[2]
                transaction.set(key, value)
            elif args[0] == "GET":
                key = args[1]
                value = transaction.get(key)
                print value if value != None else "NULL"
            elif args[0] == "UNSET":
                key = args[1]
                transaction.unset(key)
            elif args[0] == "NUMEQUALTO":
                value = args[1]
                print str(transaction.numEqualTo(value))
            elif args[0] == "BEGIN":
                transaction = transaction.createChild()
            elif args[0] == "COMMIT":
                transaction = transaction.commit({})
            elif args[0] == "ROLLBACK":
                if transaction.parent != None:
                    transaction = transaction.parent
                else:
                    print "NO TRANSACTION"
            else:
                raise Exception("Bad argument passed")
        except:
            print "Command not recognized or malformed"
            print "Commands: SET, GET, UNSET, NUMEQUALTO, BEGIN, COMMIT, ROLLBACK, END"
        finally:
            line = sys.stdin.readline().rstrip()

开发者ID:gabe-terrell,项目名称:RelayRides-Exercises,代码行数:31,代码来源:database.py


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