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


Python Session.add方法代码示例

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


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

示例1: setUp

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
 def setUp(self):
     # TODO: this setup is better to move to common fixture
     Session.begin()
     for i in range(1, self.node_num + 1):
         product = Product("product%s" % i)
         for j in range(1, self.node_num + 1):
             if i == 2: # product without projects
                 continue
             project = Project("project%s.%s" % (i, j))
             for k in range(1, self.node_num + 1):
                 if j == 2: # project without components
                     continue
                 component = Component("component%s.%s.%s" % (i, j, k))
                 for l in range(1, self.node_num + 1):
                     if k == 2: # component without sources
                         continue
                     source = Source("source%s.%s.%s.%s" % (i, j, k, l))
                     for m in range(1, self.node_num + 1):
                         if l == 2: # source without binaries
                             continue
                         binary = Binary("binary%s.%s.%s.%s.%s" %
                                         (i, j, k, l, m))
                         source.binaries.append(binary)
                     component.sources.append(source)
                 project.components.append(component)
             product.projects.append(project)
         Session.add(product)
     Session.commit()
开发者ID:rojkov,项目名称:pacemaker,代码行数:30,代码来源:test_packages_architecture.py

示例2: setUp

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
 def setUp(self):
     Session.begin()
     queue = Queue('testqueue')
     queueoption1 = QueueOption('check', '+helloworld', 100)
     queue.allowed_options = "check, build-deb-package"
     queue.options.append(queueoption1)
     Session.add(queue)
     Session.commit()
     self.queue = queue
开发者ID:rojkov,项目名称:pacemaker,代码行数:11,代码来源:test_queue.py

示例3: setUpModule

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
def setUpModule():

    # add all the needed objects in DB
    Session.begin()
    product = Product("product1")
    project = Project("project1")
    component = Component("component1")
    project.components.append(component)
    product.projects.append(project)
    Session.add(product)
    Session.commit()
开发者ID:rojkov,项目名称:pacemaker,代码行数:13,代码来源:test_packages_project.py

示例4: submit_add

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
    def submit_add(self):
        """Processes new submitted product
        """
        
        Session.begin()
        product = Product(self.form_result['name'])
        Session.add(product)
        msg = "A new product <b>%s</b> has been added" % product.name
        Session.commit()
        h.flash(msg)

        return redirect_to(controller='packages/packages')
开发者ID:rojkov,项目名称:pacemaker,代码行数:14,代码来源:product.py

示例5: setUpModule

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
def setUpModule():

    # add all the needed objects in DB
    Session.begin()
    product = Product("product1")
    project = Project("project1")
    component = Component("component1")
    source = Source("source1")
    binary = Binary("binary")
    source.binaries.append(binary)
    component.sources.append(source)
    project.components.append(component)
    product.projects.append(project)
    Session.add(product)
    Session.commit()
开发者ID:rojkov,项目名称:pacemaker,代码行数:17,代码来源:test_packages_binary.py

示例6: setUpModule

# 需要导入模块: from pacemaker.model.meta import Session [as 别名]
# 或者: from pacemaker.model.meta.Session import add [as 别名]
def setUpModule():

    # add all the needed objects in DB
    Session.begin()
    product = Product("product1")
    product_to_edit = Product("product_to_edit")
    product_to_delete = Product("product_to_delete")
    project1 = Project("project1")
    project2 = Project("project2")
    component = Component("component1")
    project1.components.append(component)
    product.projects.append(project1)
    product.projects.append(project2)
    Session.add(product)
    Session.add(product_to_edit)
    Session.add(product_to_delete)
    Session.commit()
开发者ID:rojkov,项目名称:pacemaker,代码行数:19,代码来源:test_packages_product.py


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