Esempio n. 1
0
from channelguide import manage, init
init.init_external_libraries()
from channelguide.guide.views import channels, frontpage
from channelguide.guide.models import user
from channelguide import db, cache
import time

cache.client.get = lambda x: None

database = db.connect()

def request(_method='GET', _path="/", **kwargs):

    class MockRequest:
        connection = database
        method = _method
        path = _path
        if _method == 'GET':
            GET = kwargs
        if _method == 'POST':
            POST = kwargs
        META = {'QUERY_STRING':''}
        # middleware would do this, but I'm lazy
        user = user.AnonymousUser()
        total_channels = 0

    return MockRequest()

while True:
    print 'updating'
    channels.popular(request(view='month'))
Esempio n. 2
0
File: q.py Progetto: kmshi/miroguide
# Copyright (c) 2008 Participatory Culture Foundation
# See LICENSE for details.
"""This is just a quick list of imports for when I'm running the shell.

Typical usage is:

    ./manage.py shell
    from channelguide.q import *

Or you can add some test statements at the end of this file run "python q.py".
"""
import manage
import time
import datetime
import itertools

from channelguide import init
init.init_external_libraries()
from channelguide import db
from channelguide.guide.models import *
from channelguide.guide.tables import *

connection = db.connect()
channel_q = Channel.query().order_by('modified', desc=True).limit(10)
channels = channel_q.execute(connection)
tags = Tag.query().limit(10).execute(connection)
cats = Category.query().limit(10).execute(connection)
Esempio n. 3
0
from channelguide import manage, init
init.init_external_libraries()
from channelguide import db
from channelguide.guide.forms import channels
from channelguide.guide.models.user import User, ModeratorAction
from channelguide.guide.models.channel import Channel
from channelguide.guide.models.note import ChannelNote
from channelguide.guide import emailmessages
from django.forms import ValidationError
from datetime import datetime, timedelta
database = db.connect()
user = User.query(User.c.username == "miroguide").get(database)
checker = channels.RSSFeedField()
checker.connection = database


def sendNote(channel, email):
    note = ChannelNote(user, email.title, email.body,
                       ChannelNote.MODERATOR_TO_OWNER)
    note.channel = channel
    note.save(database)
    database.commit()
    channel.join('owner').execute(database)
    if channel.owner.email is not None:
        email.send_email(channel.owner.email)


def scan(query, goodFunc=None, errorFunc=None):
    for channel in query.execute(database):
        try:
            checker.check_missing(channel.url)
Esempio n. 4
0
File: q.py Progetto: kmshi/miroguide
# Copyright (c) 2008 Participatory Culture Foundation
# See LICENSE for details.

"""This is just a quick list of imports for when I'm running the shell.

Typical usage is:

    ./manage.py shell
    from channelguide.q import *

Or you can add some test statements at the end of this file run "python q.py".
"""
import manage
import time
import datetime
import itertools

from channelguide import init
init.init_external_libraries()
from channelguide import db
from channelguide.guide.models import *
from channelguide.guide.tables import *

connection = db.connect()
channel_q = Channel.query().order_by('modified', desc=True).limit(10)
channels = channel_q.execute(connection)
tags = Tag.query().limit(10).execute(connection)
cats = Category.query().limit(10).execute(connection)