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


Python Protocol.delete方法代码示例

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


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

示例1: test_protocol_delete

# 需要导入模块: from mapfish.protocol import Protocol [as 别名]
# 或者: from mapfish.protocol.Protocol import delete [as 别名]
 def test_protocol_delete(self):
     """Delete an existing point"""
     proto = Protocol(session, Spot)
     id = 1
     
     request = FakeRequest({})
     response = FakeResponse()
     
     proto.delete(request, response, id)
     eq_(response.status, 204)
     
     spot = session.query(Spot).get(id)
     ok_(spot is None)
开发者ID:123rohan123,项目名称:mapfish,代码行数:15,代码来源:test_postgis.py

示例2: ParkingMetersController

# 需要导入模块: from mapfish.protocol import Protocol [as 别名]
# 或者: from mapfish.protocol.Protocol import delete [as 别名]
class ParkingMetersController(BaseController):
    readonly = True # if set to True, only GET is supported

    def __init__(self):
        self.protocol = Protocol(Session, ParkingMeter, self.readonly)

    @geojsonify
    def index(self, format='json'):
        """GET /: return all features."""
        # If no filter argument is passed to the protocol index method
        # then the default MapFish filter is used.
        #
        # If you need your own filter with application-specific params 
        # taken into acount, create your own filter and pass it to the
        # protocol read method.
        #
        # E.g.
        #
        # from sqlalchemy.sql import and_
        #
        # default_filter = create_default_filter(request, ParkingMeter)
        # filter = and_(default_filter, ParkingMeter.columname.ilike('%value%'))
        # return self.protocol.read(request, filter=filter)
        if format != 'json':
            abort(404)
        response.headers['Access-Control-Allow-Origin'] = 'http://localhost:8000';
        return self.protocol.read(request)

    @geojsonify
    def show(self, id, format='json'):
        """GET /id: Show a specific feature."""
        if format != 'json':
            abort(404)
        return self.protocol.read(request, response, id=id)

    @geojsonify
    def create(self):
        """POST /: Create a new feature."""
        return self.protocol.create(request, response)

    @geojsonify
    def update(self, id):
        """PUT /id: Update an existing feature."""
        return self.protocol.update(request, response, id)

    def delete(self, id):
        """DELETE /id: Delete an existing feature."""
        return self.protocol.delete(request, response, id)

    def count(self):
        """GET /count: Count all features."""
        return self.protocol.count(request)
开发者ID:gocodeboulder,项目名称:hotspots-mapfish,代码行数:54,代码来源:parking_meters.py

示例3: test_protocol_delete_fails

# 需要导入模块: from mapfish.protocol import Protocol [as 别名]
# 或者: from mapfish.protocol.Protocol import delete [as 别名]
 def test_protocol_delete_fails(self):
     """Try to delete a not-existing point"""
     proto = Protocol(session, Spot)
     
     proto.delete(FakeRequest({}), FakeResponse(), -1)
开发者ID:123rohan123,项目名称:mapfish,代码行数:7,代码来源:test_postgis.py


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