def default(self, name, *args, **kwargs): site=get_current_site() page = Pages.find_by_name(name=name, site=site) if page == None: raise controllers.redirect('/new_page?name=' + name) return dict(page=page, site=site, archive_posts= Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def update_page(self, page_id, name, title, body): page_name = name.replace(' ', '_') page = Pages.get(page_id) page.set(name=page_name, title=title, body=body) raise controllers.redirect(page_name)
def archived(self): site=get_current_site() return dict(site=site, archive_posts=Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, posts_widget=widgets.posts_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def new_post(self): user = identity.current.user site=get_current_site() return dict(user=user, site=site, archive_posts= Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def new(self): """docstring for new""" site=get_current_site() return dict(site=site, archive_posts=Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), groups=Group.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def index(self): """docstring for index""" site=get_current_site() users = User.find_all(site=site) return dict(site=site, archive_posts=Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), users=users, admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def archives(self, year, month): archives = '/'.join((year, month)) site=get_current_site() posts = Posts.find_all_archived(archives=archives, site=site) return dict(posts=posts, site=site, archive_posts=Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, posts_widget=widgets.posts_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def edit_post(self,year, month, day, title): permalink = '/'.join((year, month, day, title)) site=get_current_site() post = Posts.find_by_permalink(permalink=permalink, site=site) return dict(post=post, site=site, comment_widget=widgets.comment_widget, archive_posts= Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def index(self): site=get_current_site() home_url=config.get('calabro.default_site') return dict(home_url=home_url, site=site, archive_posts= Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def tags(self, name): site=get_current_site() tag = Tags.find_by(name=name, site=site) if tag == None: redirect_to_home() posts = Posts.find_by_tag(tag=tag, site=site) return dict(posts=posts, site=site, archive_posts=Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, posts_widget=widgets.posts_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)
def post(self, year, month, day, title): permalink = '/'.join((year, month, day, title)) site=get_current_site() try: post = Posts.find_by_permalink(permalink=permalink, site=site) except SQLObjectNotFound: flash("Sorry, post could not be found!") raise controllers.redirect('/') return dict(post=post, site=site, comment_widget=widgets.comment_widget, archive_posts= Posts.find_archive_count(site=site), archives_widget=widgets.archives_widget, tags_widget=widgets.tags_widget, pages_widget=widgets.pages_widget, pages=Pages.find_all(site=site), tags=Tags.find_all(site=site), admin_widget=widgets.admin_widget, badge_widget=widgets.badge_widget, recent_comments=Comments.find_recent(), recent_comments_widget=widgets.recent_comments_widget)