Created
August 6, 2014 17:40
-
-
Save adamrb/fc6e590e30517e9fea8d 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
from r2.models import * | |
from r2.lib.db import queries | |
def bare_minimum(): | |
try: | |
a = Account._by_name(g.system_user) | |
except NotFound: | |
a = register(g.system_user, "password", "127.0.0.1") | |
try: | |
sr = Subreddit._new(name = "reddit", title = "welcome to reddit", | |
ip = '0.0.0.0', author_id = a._id, show_media=True, | |
spam_links='low', spam_selfposts='low') | |
sr._downs = 10 | |
sr.lang = "en" | |
sr._commit() | |
except SubredditExists: | |
sr = Subreddit._by_name("reddit") | |
l = Link._submit("Welcome to Reddit Open Source!", "self", a, sr, '127.0.0.1') | |
queries.new_link(l) | |
l.url = l.make_permalink_slow() | |
l.is_self = True | |
l.selftext="Welcome to the open source reddit.\n\nYou can log in with the username \"reddit\" and the password \"password\", or create any number or new users and subreddits." | |
l.c._spam = 0 | |
l._commit() | |
queries.queue_vote(a, l, True, '127.0.0.1') | |
queries.worker.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment