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


Python Location.parse方法代码示例

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


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

示例1: getNumberOfActiveRooms

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def getNumberOfActiveRooms( **kwargs ):
     """
     FINAL (not intented to be overriden)
     Returns number of rooms that are active (not logicaly deleted).
     """
     name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
     location = Location.parse(name)
     return location.factory.newRoom().getNumberOfActiveRooms(location=name)
开发者ID:vstitches,项目名称:indico,代码行数:10,代码来源:rb_room.py

示例2: getNumberOfReservableRooms

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def getNumberOfReservableRooms( **kwargs ):
     """
     FINAL (not intented to be overriden)
     Returns number of rooms which can be reserved.
     """
     name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
     location = Location.parse(name)
     return location.factory.newRoom().getNumberOfReservableRooms(location=name)
开发者ID:vstitches,项目名称:indico,代码行数:10,代码来源:rb_room.py

示例3: getNumberOfRooms

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def getNumberOfRooms( **kwargs ):
     """
     FINAL (not intented to be overriden)
     Returns total number of rooms in database.
     """
     name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
     location = Location.parse(name)
     return location.factory.newRoom().getNumberOfRooms(location=name)
开发者ID:vstitches,项目名称:indico,代码行数:10,代码来源:rb_room.py

示例4: _getAnswer

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
    def _getAnswer( self ):

        res = []

        if Location.parse( self._location ):
            for room in CrossLocationQueries.getRooms( location = self._location ):
                res.append((room.name, room.getFullName()))

        return res
开发者ID:aninhalacerda,项目名称:indico,代码行数:11,代码来源:roomBooking.py

示例5: _getAnswer

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
    def _getAnswer(self):

        res = {}
        minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
        if minfo.getRoomBookingModuleActive():
            if Location.parse(self._location):
                for room in CrossLocationQueries.getRooms(location=self._location):
                    res[room.name] = room.name
        return sorted(res)
开发者ID:ferhatelmas,项目名称:indico,代码行数:11,代码来源:roomBooking.py

示例6: approve

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
    def approve(self, sendNotification=True):
        """
        Approve the room blocking and reject colloding bookings
        """
        self.active = True
        # If the blocking has not been saved yet, don't reject anything - will be done later in block.insert()
        if self.block.id is None:
            return
        # Create a fake reservation candidate to find bookings colliding with the blocking
        candResv = Location.parse(self.room.locationName).factory.newReservation()
        candResv.room = self.room
        candResv.startDT = datetime.datetime.combine(self.block.startDate, datetime.time())
        candResv.endDT = datetime.datetime.combine(self.block.endDate, datetime.time(23, 59))
        candResv.repeatability = RepeatabilityEnum.daily
        candResv.isConfirmed = None
        collisions = candResv.getCollisions()
        rejectionReason = "Conflict with blocking %s: %s" % (self.block.id, self.block.message)
        emailsToBeSent = []
        for coll in collisions:
            collResv = coll.withReservation
            if collResv.isRejected:
                continue
            elif self.block.canOverride(collResv.createdByUser(), self.room):
                continue
            elif collResv.repeatability is None or (
                collResv.startDT.date() >= self.block.startDate and collResv.endDT.date() <= self.block.endDate
            ):
                collResv.rejectionReason = rejectionReason
                collResv.reject()  # Just sets isRejected = True
                collResv.update()
                emails = collResv.notifyAboutRejection()
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking rejected")
                info.append("Reason: '%s'" % collResv.rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
            else:  # repeatable -> only reject the specific days
                rejectDate = coll.startDT.date()
                collResv.excludeDay(rejectDate, unindex=True)
                collResv.update()
                emails = collResv.notifyAboutRejection(date=rejectDate, reason=rejectionReason)
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking occurence of the %s rejected" % rejectDate.strftime("%d %b %Y"))
                info.append("Reason: '%s'" % rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
        if sendNotification:
            emailsToBeSent += RoomBlockingNotification.blockingRequestProcessed(self)
        for email in emailsToBeSent:
            GenericMailer.send(GenericNotification(email))
开发者ID:bubbas,项目名称:indico,代码行数:58,代码来源:roomblocking.py

示例7: getTotalSurfaceAndCapacity

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def getTotalSurfaceAndCapacity( **kwargs ):
     """
     FINAL (not intented to be overriden)
     Returns (total_surface, total_capacity) of all Active rooms.
     """
     name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
     location = Location.parse(name)
     roomEx = location.factory.newRoom()
     roomEx.isActive = True
     roomEx.isReservable = True
     rooms = CrossLocationQueries.getRooms( roomExample = roomEx, location = name )
     totalSurface, totalCapacity = 0, 0
     for r in rooms:
         if r.surfaceArea:
             totalSurface += r.surfaceArea
         if r.capacity:
             totalCapacity += r.capacity
     return ( totalSurface, totalCapacity )
开发者ID:vstitches,项目名称:indico,代码行数:20,代码来源:rb_room.py

示例8: reservation

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
    def reservation(self, locList):

        Factory.getDALManager().connect()

        resvEx = ReservationBase()
        resvEx.startDT = self._fromDT
        resvEx.endDT = self._toDT

        locList = filter(lambda loc: Location.parse(loc) is not None, locList)

        if self._fromDT or self._toDT:
            daysParam = (day.date() for day in rrule.rrule(rrule.DAILY, dtstart=self._fromDT, until=self._toDT))
        else:
            # slow!
            daysParam = None

        for loc in sorted(locList):
            resvs = CrossLocationQueries.getReservations(location=loc, resvExample=resvEx, days=daysParam)
            for obj in self._process(resvs, filter=self._resvFilter):
                yield obj

        Factory.getDALManager().disconnect()
开发者ID:VishrutMehta,项目名称:indico,代码行数:24,代码来源:http_api.py

示例9: _checkParams

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def _checkParams( self ):
     self._location = Location.parse(self._param("location"))
开发者ID:aninhalacerda,项目名称:indico,代码行数:4,代码来源:roomBooking.py

示例10: _getGuid

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
 def _getGuid( self ):
     if self.id == None or self.locationName == None:
         return None
     if Location.parse( self.locationName ):
         return RoomGUID( Location.parse( self.locationName ), self.id )
     return None
开发者ID:vstitches,项目名称:indico,代码行数:8,代码来源:rb_room.py

示例11: MapAspect

# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import parse [as 别名]
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from indico.core.db import DBMgr
from MaKaC.rb_location import Location, MapAspect
from MaKaC.plugins.RoomBooking.default.factory import Factory

aspects = [
    {'id': 0, 'name':'Meyrin', 'centerLatitude': 46.23456689405093, 'centerLongitude': 6.046686172485352, 'topLeftLatitude': '46.225660710473136', 'topLeftLongitude': '6.030035018920898', 'bottomRightLatitude': '46.2434716324829', 'bottomRightLongitude': '6.063294410705566', 'zoomLevel':15, 'defaultOnStartup': True},
    {'id': 1, 'name':'PREVESSIN', 'centerLatitude': 46.259051447415175, 'centerLongitude': 6.057773351931246, 'topLeftLatitude': '46.2501492379416', 'topLeftLongitude': '6.041107177734375', 'bottomRightLatitude': '46.26795221179669', 'bottomRightLongitude': '6.074366569519043', 'zoomLevel':15, 'defaultOnStartup': False},
    {'id': 2, 'name':'POINT 1', 'centerLatitude': 46.23573201283012, 'centerLongitude': 6.054509639707248, 'topLeftLatitude': '46.23350564968721', 'topLeftLongitude': '6.050344705581665', 'bottomRightLatitude': '46.23795828565159', 'bottomRightLongitude': '6.058659553527832', 'zoomLevel':17, 'defaultOnStartup': False},
    {'id': 3, 'name':'POINT 2', 'centerLatitude': 46.25115822762375, 'centerLongitude': 6.020456314054172, 'topLeftLatitude': '46.24893249040227', 'topLeftLongitude': '6.016291379928589', 'bottomRightLatitude': '46.253383874525866', 'bottomRightLongitude': '6.024606227874756', 'zoomLevel':17, 'defaultOnStartup': False},
    {'id': 4, 'name':'POINT 5', 'centerLatitude': 46.30958858268458, 'centerLongitude': 6.077267646724067, 'topLeftLatitude': '46.30736521774798', 'topLeftLongitude': '6.073100566864014', 'bottomRightLatitude': '46.31181185731005', 'bottomRightLongitude': '6.081415414810181', 'zoomLevel':17, 'defaultOnStartup': False},
    {'id': 5, 'name':'POINT 6', 'centerLatitude': 46.29345231426436, 'centerLongitude': 6.1115119456917455, 'topLeftLatitude': '46.29122829396059', 'topLeftLongitude': '6.107347011566162', 'bottomRightLatitude': '46.295676244254715', 'bottomRightLongitude': '6.115661859512329', 'zoomLevel':17, 'defaultOnStartup': False},
    {'id': 6, 'name':'POINT 8', 'centerLatitude': 46.24158691675184, 'centerLongitude': 6.097038745847385, 'topLeftLatitude': '46.2393607911537', 'topLeftLongitude': '6.092873811721802', 'bottomRightLatitude': '46.24381295202931', 'bottomRightLongitude': '6.101188659667969', 'zoomLevel':17, 'defaultOnStartup': False},
]

DBMgr.getInstance().startRequest()
Factory.getDALManager().connect()

location = Location.parse('CERN')

for aspectData in aspects:
    aspect = MapAspect()
    aspect.updateFromDictionary(aspectData)
    location.addAspect(aspect)

DBMgr.getInstance().endRequest()
开发者ID:ferhatelmas,项目名称:indico,代码行数:32,代码来源:mapAspects.py


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