示例#1
0
 def get(self):
    """ Simply retrieves an Article entity from the database keyed by the Title
    assumption is there is a 1:1 correspondence between the page and 1 article entity
    :return:
    """
    article = Article()
    response = article.get_article_by_title("About Us")
    template_values = {"article": response}
    self.render_template("about.template", template_values)
示例#2
0
    def load_articles(self, dopurge = False):
        if dopurge:
            self.purge_entity(Article())
        #About Page
        about_page = Article()
        about_page.title = "About Us"
        about_page.byline = "Favio's Mom"
        about_page.short_description = "About Us"
        about_page.body = """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                             Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                             Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                             Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."""
        about_page.put()

        article = Article()
        article.title = "Cuban Sandwich"
        article.byline = "Favio's Mom"
        article.short_description = "Cuban Sandwich"
        article.body = self.load_article_body_from_file("admin/articles/cuban_sandwich.txt")
        article.put()
示例#3
0
# -*- coding: utf-8 -*-

# ##########################################################
# ## make sure administrator is on localhost
# ###########################################################

from movuca import Access, DataBase
db = DataBase()
auth = Access(db)
from datamodel.article import Article, ContentType, Category
ContentType(db)
Category(db)
Article(db)

response.view = '%(name)s/app/appadmin.html' % db.config.theme

import os
import socket
import datetime
import copy
import gluon.contenttype
import gluon.fileutils

# ## critical --- make a copy of the environment

global_env = copy.copy(globals())
global_env['datetime'] = datetime

http_host = request.env.http_host.split(':')[0]
remote_addr = request.env.remote_addr
try: