def main(): mapper.db['exif_tags'].remove({}) mapper.run( mapper.db['photos'].find({'exif':{'$ne':[]}}), mapper.db['exif_tags'], ExifReport())
def delete_post(post_num): """Deletes a post or thread. This deletes a post or a thread. If the supplied post number is a thread, it deferrs deletion of child posts for later. Args: post_num: The number of the post or thread to delete. Raises: ValueError: Given post ID does not exist. """ our_key = models.Post.get_key(post_num) our_model = our_key.get() if our_model: if our_model.parent_thread is None: mapper = DeletePostMapper(our_key.id()) mapper.run() logging.info("Thread deletion started") our_key.delete() if our_model.image: blobstore.delete([our_model.image]) if our_model.parent_thread is None: memcache.delete(models.Post.POST_KEY_PREFIX + str(our_key.id())) else: memcache.delete(models.Post.POST_KEY_PREFIX + str(our_model.parent_thread.id())) else: raise ValueError("Given post ID does not exist.")
from mapper import run from os import listdir, makedirs, path import logging _MADMP_EXAMPLES_PATHS = [(path.join("examples", "madmp", d), d) for d in listdir(path.join("examples", "madmp"))] _ROCRATE_EXAMPLES_PATHS = [(path.join("examples", "rocrate", d), d) for d in listdir(path.join("examples", "rocrate"))] if __name__ == '__main__': # Transform all RDA maDMP examples to Ro-Crates for mpath, mname in _MADMP_EXAMPLES_PATHS: print("\n", "MADMP TO ROCRATE: Generating Rocrate for {}".format(mpath), sep="") run(mpath, path.join("demo_files", "generated_rocrates", mname)) # Transform all Ro-Crates examples to RDA maDMP for rpath, rname in _ROCRATE_EXAMPLES_PATHS: print("\n", "ROCRATE TO MADMP: Generating MADMP for {}".format(rpath), sep="") target_path = path.join("demo_files", "generated_madmps", rname) try: makedirs(target_path) except FileExistsError: pass run(rpath, target_path)