def missingSmugMugCategoriesHTML(conn): rows = db.missingSmugMugCategories(conn) columns = ["Category"] if len(rows) == 0: return "" else: return webUtil.getTable(columns, rows)
def createMissingCategories(configobj, smugmug, lock): """ Will create any missing Categories on SmugMug that have been found locally, but not on SmugMug. """ myLogger.debug('createMissingCategories - parent process: %s process id: %s', os.getppid(), os.getpid()) conn = db.getConn(configobj) sync = datetime.now() categories = db.missingSmugMugCategories(conn) for category in categories: result = smugmug.categories_create(Name=category[0]) id = result["Category"]["id"] myLogger.debug("Category created: '%s' and id '%s'", category[0], id) lock.acquire() db.insertCategoryLog(conn, id, category[0], sync) lock.release()