예제 #1
0
 def new(self):
     if len(c.db_content_types) is 0:
         h.flash("Configuration Error: Please make sure at least one content type exists.", 'error')
     if DbContentType.find_by_name("News") is None:
         h.flash("Configuration Error: Please make sure the 'News' content type exists for full functionality.", 'error')
     if DbContentType.find_by_name("In the press") is None:
         h.flash("Configuration Error: Please make sure the 'In the press' content type exists for full functionality.", 'error')
     return render('/db_content/new.mako')
예제 #2
0
 def new(self):
     if len(c.db_content_types) is 0:
         h.flash(
             "Configuration Error: Please make sure at least one content type exists.",
             'error')
     if DbContentType.find_by_name("News") is None:
         h.flash(
             "Configuration Error: Please make sure the 'News' content type exists for full functionality.",
             'error')
     if DbContentType.find_by_name("In the press") is None:
         h.flash(
             "Configuration Error: Please make sure the 'In the press' content type exists for full functionality.",
             'error')
     return render('/db_content/new.mako')
예제 #3
0
 def rss_news(self):
     news_id = DbContentType.find_by_name("News")
     c.db_content_collection = []
     if news_id is not None: 
         c.db_content_collection = meta.Session.query(DbContent).filter_by(published='t',type_id=news_id.id).order_by(DbContent.creation_timestamp.desc()).limit(20).all()
     response.headers['Content-type'] = 'application/rss+xml; charset=utf-8'
     return render('/db_content/rss_news.mako')
예제 #4
0
 def new(self):
     if len(c.db_content_types) is 0:
         h.flash("Configuration Error: Please make sure at least one content type exists.", 'error')
     if DbContentType.find_by_name("News") is None:
         h.flash("Configuration Error: Please make sure the 'News' content type exists for full functionality.", 'error')
     if DbContentType.find_by_name("In the press") is None:
         h.flash("Configuration Error: Please make sure the 'In the press' content type exists for full functionality.", 'error')
     c.db_content = DbContent()
     defaults = h.object_to_defaults(c.db_content, 'db_content')
     if request.GET.has_key('url'):
         defaults['db_content.type'] = 1 # This is bad... we're assuming we have #1 as new page
         if request.GET['url'].startswith('/'):
             defaults['db_content.url'] = str(request.GET['url'])[1:]
         else:
             defaults['db_content.url'] = request.GET['url']
     form = render('/db_content/new.mako')
     return htmlfill.render(form, defaults)
예제 #5
0
 def rss_news(self):
     news_id = DbContentType.find_by_name("News")
     c.db_content_collection = []
     if news_id is not None:
         c.db_content_collection = meta.Session.query(DbContent).filter_by(
             published='t', type_id=news_id.id).order_by(
                 DbContent.creation_timestamp.desc()).limit(20).all()
     response.headers['Content-type'] = 'application/rss+xml; charset=utf-8'
     return render('/db_content/rss_news.mako')
예제 #6
0
 def __before__(self, **kwargs):
     c.db_content_types = DbContentType.find_all()
예제 #7
0
 def _to_python(self, value, state):
     return DbContentType.find_by_id(value)
예제 #8
0
 def __before__(self, **kwargs):
     c.db_content_types = DbContentType.find_all()
예제 #9
0
 def _to_python(self, value, state):
     return DbContentType.find_by_id(value)