コード例 #1
0
ファイル: location.py プロジェクト: shupp/VegaDNS-API
    def delete_prefixes(self):
        prefixes = LocationPrefix.select().where(
            LocationPrefix.location_id == self.location_id
        )

        for prefix in prefixes:
            prefix.delete_instance()
コード例 #2
0
    def get(self):
        location_id = self.get_location_id()

        # make sure location exists
        try:
            location = Location.get(Location.location_id == location_id)
        except peewee.DoesNotExist:
            abort(404, message="location_id does not exist")

        query = LocationPrefix.select().where(
            LocationPrefix.location_id == location_id)
        prefixes = []
        for prefix in query:
            prefixes.append(prefix.to_dict())

        return {
            'status': 'ok',
            'location_prefixes': prefixes,
            'location': location.to_dict()
        }
コード例 #3
0
    def get(self):
        location_id = self.get_location_id()

        # make sure location exists
        try:
            location = Location.get(Location.location_id == location_id)
        except peewee.DoesNotExist:
            abort(404, message="location_id does not exist")

        query = LocationPrefix.select().where(
            LocationPrefix.location_id == location_id
        )
        prefixes = []
        for prefix in query:
            prefixes.append(prefix.to_dict())

        return {
            'status': 'ok',
            'location_prefixes': prefixes,
            'location': location.to_dict()
        }
コード例 #4
0
ファイル: location.py プロジェクト: w796933/VegaDNS-API
    def delete_prefixes(self):
        prefixes = LocationPrefix.select().where(
            LocationPrefix.location_id == self.location_id)

        for prefix in prefixes:
            prefix.delete_instance()