Example #1
0
def generate_sources(titles):
    source_list = []
    for i, title in enumerate(titles):
        source_list.append(
            Source(id=i,
                   title=title,
                   num_subs=random.randint(20, 1000),
                   desc=lipsum(n=1, min=20, max=30)))
    return source_list
Example #2
0
def news_ajax(news_id):
    n = news_list[(news_id-1) % len(news_list)]
    ct = lipsum(min=70, max=200)
    body = markdown.markdown(ct)
    context = {
        'news': n,
        'body': body, 
    }
    return render_template('includes/_news_detail.html', **context)
Example #3
0
def news(news_id):
    n = news_list[(news_id-1) % len(news_list)]
    ct = lipsum(min=70, max=200)
    body = markdown.markdown(ct)

    context = {
        'news': n,
        'body': body, 
        'nlist': news_list,
        'categories': NEWS_CATS,
    }
    return render_template('index.html', **context)
Example #4
0
def news_by_category(category):
    nlist = randomize(news_list)
    n = nlist[0]

    ct = lipsum(min=70, max=200)
    body = markdown.markdown(ct)

    context = {
        'news': n,
        'body': body, 
        'nlist': nlist,
        'category': category,
        'categories': NEWS_CATS,
    }
    return render_template('index.html', **context)
Example #5
0
    def __init__(self, likes=0, comments=0):
        self.likes = likes
        self.comments = comments


today = datetime.now().replace(minute=0, hour=0, second=0)
#today = datetime.today().date()

news_list = [
    News(id=1,
         title='How Many Computers to Identify a Cat? 16,000',
         template='1.md',
         posted=today,
         original_url='http://www.nytimes.com/2012/06/26/technology/in-a-big-network-of-computers-evidence-of-machine-learning.html?_r=1&hp',
         thumb='1.jpg',
         summary=lipsum(n=1, min=10, max=20),
         source=Source(name='NYTimes', url='http://www.nytimes.com/')),
    News(id=2,
         title='Teenage LulzSec hackers in UK plead guilty to SOCA attack',
         template='1.md',
         posted=today,
         original_url='http://news.techworld.com/security/3366126/teenage-lulzsec-hackers-in-uk-plead-guilty-soca-attack/',
         thumb='4.jpg',
         summary=lipsum(n=1, min=10, max=20),
         source=Source(name='TechWorld', url='http://www.techworld.com/')),
    News(id=3,
         title='On Orbitz, Mac Users Steered to Pricier Hotels ',
         template='1.md',
         posted=today,
         original_url='http://online.wsj.com/article/SB10001424052702304458604577488822667325882.html?mod=WSJ_business_LeadStoryCollection',
         thumb='1.jpg',