コード例 #1
0
ファイル: add_city.py プロジェクト: piojo/aquilon
    def render(self, session, logger, city, country, fullname, comments,
               timezone, campus,
               **arguments):
        if country:
            dbparent = Country.get_unique(session, country, compel=True)
        else:
            dbparent = Campus.get_unique(session, campus, compel=True)

        dbcity = add_location(session, City, city, dbparent, fullname=fullname,
                              comments=comments, timezone=timezone)

        session.flush()

        plenary = Plenary.get_plenary(dbcity, logger=logger)
        with plenary.get_key():
            try:
                plenary.write(locked=True)

                dsdb_runner = DSDBRunner(logger=logger)
                dsdb_runner.add_city(city, dbcity.country.name, fullname)
                dsdb_runner.commit_or_rollback()

            except:
                plenary.restore_stash()
                raise
        return
コード例 #2
0
    def render(self, session, logger, city, country, fullname, comments,
               timezone, campus, **arguments):
        if country:
            dbparent = Country.get_unique(session, country, compel=True)
        else:
            dbparent = Campus.get_unique(session, campus, compel=True)

        dbcity = add_location(session,
                              City,
                              city,
                              dbparent,
                              fullname=fullname,
                              comments=comments,
                              timezone=timezone)

        session.flush()

        plenary = PlenaryCity(dbcity, logger=logger)
        key = plenary.get_write_key()
        try:
            lock_queue.acquire(key)
            plenary.write(locked=True)

            dsdb_runner = DSDBRunner(logger=logger)
            dsdb_runner.add_city(city, dbcity.country.name, fullname)
            dsdb_runner.commit_or_rollback()

        except:
            plenary.restore_stash()
            raise
        finally:
            lock_queue.release(key)
コード例 #3
0
ファイル: add_campus.py プロジェクト: stdweird/aquilon
    def render(self, session, logger, campus, country, fullname, comments, **arguments):
        dbcountry = Country.get_unique(session, country, compel=True)
        add_location(session, Campus, campus, dbcountry, fullname=fullname, comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_campus(campus, comments)
        dsdb_runner.commit_or_rollback()

        return
コード例 #4
0
ファイル: add_campus.py プロジェクト: ned21/aquilon
    def render(self, session, logger, campus, country, fullname, comments,
               **arguments):
        dbcountry = Country.get_unique(session, country, compel=True)
        add_location(session,
                     Campus,
                     campus,
                     dbcountry,
                     fullname=fullname,
                     comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_campus(campus, comments)
        dsdb_runner.commit_or_rollback()

        return
コード例 #5
0
 def render(self, session, country, **arguments):
     return Country.get_unique(session, country, compel=True)