def main(): #open_database() # ZEO open_database('file:/www/var/qon.fs') #iterate_touch() #iterate_id() iterate_counts_sizes('/www/var/qon.fs') close_database()
def main(): unsuccessful_recipients = ['*****@*****.**'] try: import pdb; pdb.set_trace() open_database() update_stats() update_group_karma() close_database() except Exception, why: if 1: sender = '*****@*****.**' subject = "Warning: Hourly cron was unsuccessful" body = "To: %s\nFrom: %s\nSubject: %s\n\n%s\n\n" % (",".join(unsuccessful_recipients), sender, subject, why) server = smtplib.SMTP('localhost') server.sendmail(sender, unsuccessful_recipients, body)
def main(): successful_recipients = ['*****@*****.**'] unsuccessful_recipients = ['*****@*****.**'] try: start = datetime.utcnow() open_database() # create a Publisher object for qon.api from qon.ui.util import create_publisher publisher = create_publisher() clean_upload_dir() expire_sessions() purge_mail_messages() purge_unsponsored_groups() decay_inactive_discussions() update_stats() publish_stats() pack_database() close_database() td = datetime.utcnow() - start time_in_sec = td.days*86400 + td.seconds if 1: sender = '*****@*****.**' subject = "Daily cron was successful" msg = 'Completed in %s seconds.' % time_in_sec body = "To: %s\nFrom: %s\nSubject: %s\n\n%s\n\n" % (",".join(successful_recipients), sender, subject, msg) server = smtplib.SMTP('localhost') server.sendmail(sender, successful_recipients, body) except Exception, why: if 1: sender = '*****@*****.**' subject = "Warning: Daily cron was unsuccessful" body = "To: %s\nFrom: %s\nSubject: %s\n\n%s\n\n" % (",".join(unsuccessful_recipients), sender, subject, why) server = smtplib.SMTP('localhost') server.sendmail(sender, unsuccessful_recipients, body)
first_comment_post[c.author] = c.date if not num_comment_posts.has_key(c.author): num_comment_posts[c.author] = 1 else: num_comment_posts[c.author] = num_comment_posts[c.author] + 1 i += 1 if __name__ == "__main__": snapshot_date = datetime(int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])) print 'using snapshot date of ' + str(snapshot_date) + ' Pacific Time\n' # open the ZODB database file #db = open_database("file:/www/var/qon.fs") db = open_database() # do it do_all_users() do_all_group_blogitems() do_all_group_wikipages() do_all_groups() # -------------------------------------------------------------------------------------- # USER REPORT STUFF # -------------------------------------------------------------------------------------- sorted_users = [] for userid, u in db.user_db.root.items():
#!/usr/bin/env python """$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/toboso/bin/create_db $ $Id: create_db,v 1.24 2005/04/12 04:45:46 pierre Exp $ Create an initial database. """ import os os.environ['SITE'] = 'qon' from qon.base import open_database, close_database from qon.dbtools import init_database, add_real_data, essential_content from qon.group_db import create_initial_groups from qon.tags_db import initialize_tagging if __name__ == "__main__": db = open_database("file:/www/var/qon.fs") init_database(db) add_real_data(db) create_initial_groups() initialize_tagging() essential_content(db) get_transaction().commit() db.close()
# so let's join the first owner of the child group to the parent creator = child_group.owners[0] try: api.group_join(parent_group, creator) print ' Joined user "%s" to "%s"' % (creator.display_name(), parent_group.display_name()) api.group_join(parent_group, child_group) print ' Group succesfully joined.' except NotEnoughPrivileges: print ' Failed because could not join user "%s" to "%s"' % (creator.display_name(), parent_group.display_name()) return transaction_commit() if __name__ == "__main__": open_database() group_db = get_group_database() # do it join(group_db, 'federation', 'community-general') join(group_db, 'mini-action', 'community-general') join(group_db, 'on', 'community-general') join(group_db, 'reflections', 'community-general') join(group_db, 'resources', 'community-general') join(group_db, 'constitution', 'community-general') join(group_db, 'welcome', 'community-general') join(group_db, 'activestories', 'general-other') join(group_db, 'scouts', 'general-other') join(group_db, 'bookclub', 'general-other') join(group_db, 'buddies', 'general-other')