def main(): raise Exception( "this script will assign new reference numbers while moving, " "most certainly you don't want that to happen..." ) app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() print SEPARATOR print SEPARATOR print "Date: {}".format(datetime.now().isoformat()) setup_plone(app, options) if options.dry_run: transaction.doom() print "DRY-RUN" rename_repositories(options) print "Done." print SEPARATOR print SEPARATOR
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() print SEPARATOR print SEPARATOR print "Date: {}".format(datetime.now().isoformat()) setup_plone(app, options) if options.dry_run: transaction.doom() print "DRY-RUN" fixer = FixReferenceNumbers(options) fixer.fix_reference_numbers() if not options.dry_run: import pdb; pdb.set_trace() transaction.commit() print "Done." print SEPARATOR print SEPARATOR
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) parser.add_option("-p", dest="profile", help="profile that contains the repository excel file.") options, args = parser.parse_args() if not options.profile: logger.error("the profile (-p) argument is required.") return if ":" not in options.profile: logger.error("invalid profile id: '{}', missing ':'" .format(options.profile)) return if options.dry_run: logger.warn('transaction doomed because we are in dry-mode.') transaction.doom() plone = setup_plone(app, options) RetentionPeriodFixer(plone, options).run() if options.dry_run: logger.warn('skipping commit because we are in dry-mode.') else: transaction.commit() logger.info('done.')
def main(): plone = setup_plone(setup_app()) roots = plone.portal_catalog.unrestrictedSearchResults( {'portal_type': ['opengever.repository.repositoryroot']}) for root in roots: print 'checking repository {}'.format(root.id) recursive_find_uncatalogued_mails(root, plone.portal_catalog)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-r", dest="reindex", action="store_true", default=False) (options, args) = parser.parse_args() plone = setup_plone(app, options) incorrectly_synched = find_incorrectly_synched_tasks(plone, options) print SEPARATOR print SEPARATOR if incorrectly_synched: print '{} incorrectly_synched tasks detected.'.format( len(incorrectly_synched)) print SEPARATOR pp(incorrectly_synched) if options.reindex: reindex_tasks(incorrectly_synched) transaction.commit() print SEPARATOR print 'All incorrectly synched tasks has been reindexed.' else: print 'Everything is fine.' print SEPARATOR print SEPARATOR
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() plone = setup_plone(app, options) print SEPARATOR count_objects(plone, options)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) fix_broken_indices(plone, options)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() plone = setup_plone(app, options) stats = get_stats(plone) print json.dumps(stats)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) check_for_reference_numbers(plone, options)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) find_long_task_titles(plone, options)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) remove_broken_transforms(plone)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() print SEPARATOR setup_plone(app, options) CatalogConsistencyChecker().check()
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-p", "--profile-id", action="store", dest="profile_id", default=None) (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) check_dossier_nesting(plone, options)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-b", "--batch-size", dest="batch_size", type="int", default=100) parser.add_option("-C", "--convert", action="store_true", dest="convert", default=False) (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) manager = PDFConversionManager(plone, options) manager.convert_pdfs()
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() if not len(args) == 2: print USAGE print "Error: Incorrect number of arguments" sys.exit(1) user_id, new_pass = args update_password(app, user_id, new_pass) print SEPARATOR
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() if not len(args) == 1: print USAGE print "Error: Incorrect number of arguments" sys.exit(1) secret = args[0] plone = setup_plone(app, options) set_shared_secret(plone, secret) print SEPARATOR
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() logger.warn("Date: {}".format(datetime.now().isoformat())) setup_plone(app, options) if options.dry_run: transaction.doom() logger.warn("DRY-RUN") fix_broken_sortable_title_indexes(options)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() print SEPARATOR print "Date: {}".format(datetime.now().isoformat()) setup_plone(app, options) if options.dry_run: transaction.doom() print "DRY-RUN" fix_mails_with_no_subject(options)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() logger.info(SEPARATOR) logger.info("Date: {}".format(datetime.now().isoformat())) setup_plone(app, options) if options.dry_run: transaction.doom() logger.info("DRY-RUN") move_documents_in_proposal_to_dossier(options)
def main(): app = setup_app() parser = setup_option_parser() (options, args) = parser.parse_args() if not len(args) == 1: print USAGE print "Error: Incorrect number of arguments" sys.exit(1) new_timestamp_str = args[0] new_secret_ts = float(new_timestamp_str) print SEPARATOR setup_plone(app, options) set_secret_ts(app, new_secret_ts)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-u", "--user", action="store", dest="user", default=None) parser.add_option("-n", "--dry-run", action="store_true", dest="dryrun", default=False) parser.add_option("-c", "--comment", action="store", dest="comment", default='') (options, args) = parser.parse_args() print SEPARATOR plone = setup_plone(app, options) if not options.user: print "Please supply a username!" sys.exit(1) checkin_documents_for_user(plone, options)
def main(): app = setup_app() print SEPARATOR plone = setup_plone(app, []) # prevents erroneous execution transaction.doom() def log(msg): print msg fixer = ReferenceNumberFixer(log, plone) print "Running 'fixing broken mappings'..." fixer.fix_child_mappings() print "Done"
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-f", "--fix", action="store_true", dest="fix", help="Flags whether the script should fix or just display the wrong mimetypes.") parser.add_option("-t", "--mimetype", dest="specific_type", help="Search for the given MIMETYPE.") (options, args) = parser.parse_args() plone = setup_plone(app, options) if not options.specific_type: print "No MIMETYPE given." return if not options.fix: list_objects_with_specific_mime_types(plone, options.specific_type) else: fix_wrong_mime_types(plone, options.specific_type)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() print SEPARATOR setup_plone(app, options) if options.dry_run: transaction.doom() print "DRY-RUN" crop_long_dossier_titles() crop_long_task_titles() if commit_needed: if not options.dry_run: transaction.commit()
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) parser.add_option("--domain", dest="domain", default=None, help="Domain used in links to renamed content in " "report file.") (options, args) = parser.parse_args() if options.domain: assert not options.domain.startswith("http") assert not options.domain.endswith("/") logger.info(SEPARATOR) logger.info("Date: {}".format(datetime.now().isoformat())) setup_plone(app, options) if options.dry_run: transaction.doom() logger.info("DRY-RUN") use_canonical_document_id(options)
def main(): app = setup_app() parser = setup_option_parser() parser.add_option("-n", dest="dry_run", action="store_true", default=False) (options, args) = parser.parse_args() print SEPARATOR print SEPARATOR print "Date: {}".format(datetime.now().isoformat()) setup_plone(app, options) if options.dry_run: transaction.doom() print "DRY-RUN" ReferenceChecker(options).check_ref_nums() if not options.dry_run: transaction.commit() print "Done." print SEPARATOR print SEPARATOR
'after-catalog', 'after-obj', 'title', 'path'] print '' print '' print 'INFO: Writing statistics to', STATS_CSV_PATH with open(STATS_CSV_PATH, 'w+') as csvfile: writer = DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() for item in items.values(): if len(set(item) - set(fieldnames)): raise Abort('Unexpected keys {} in {}'.format( set(item) - set(fieldnames), item)) writer.writerow(make_utf8(item)) if __name__ == '__main__': app = setup_app() plone = setup_plone(app, []) if True: print 'WARNING: transaction dommed because we are in dry-mode.' print '' transaction.doom() DossierRefnumsResetter(plone)() transaction.commit()
def main(): plone = setup_plone(setup_app()) fix_mail_class(plone)