Created
December 1, 2010 17:30
-
-
Save eightysteele/723855 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Copyright 2010 Map Of Life | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
from mapreduce import operation as op | |
from google.appengine.ext import db | |
from Tiles import Tiles, TmpTile | |
def delete(entity): | |
"""Deletes the entity from the datastore.""" | |
yield op.db.Delete(entity) | |
def build_tiles(entity): | |
"""Converts a TmpTile entity into a Tile entity. | |
Basically we convert the TmpTile.keyLiteral property into a new Tile key and | |
convert the TmpTile.band property into the Tile.blob property. | |
Args: | |
entity: A TmpTile entity | |
""" | |
tile = Tiles(key_name=entity.keyLiteral) | |
tile.band = db.Blob(entity.keyLiteral) | |
yield op.db.Put(tile) | |
yield op.db.Delete(entity) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment