def preview_wikipage_view(context, request, WikiPage=WikiPage): version_num = int(request.params['version_num']) repo = find_repo(context) for version in repo.history(context.docid): if version.version_num == version_num: break else: raise NotFound("No such version: %d" % version_num) page = WikiPage() page.__parent__ = context.__parent__ page.revert(version) is_front_page = (context.__name__ == 'front_page') if is_front_page: community = find_interface(context, ICommunity) page_title = '%s Community Wiki Page' % community.title else: page_title = page.title profiles = find_profiles(context) author = profiles[version.user] # Extra paranoia, probably not strictly necessary. I just want to make # extra special sure that the temp WikiPage object we create above # doesn't accidentally get attached to the persistent object graph. transaction.doom() return { 'date': format_local_date(version.archive_time), 'author': author.title, 'title': page_title, 'body': page.cook(request), }
def preview_wikipage_view(context, request, WikiPage=WikiPage, tz=None): version_num = int(request.params['version_num']) repo = find_repo(context) for version in repo.history(context.docid): if version.version_num == version_num: break else: raise NotFound("No such version: %d" % version_num) page = WikiPage() page.__parent__ = context.__parent__ page.revert(version) is_front_page = (context.__name__ == 'front_page') if is_front_page: community = find_interface(context, ICommunity) page_title = '%s Community Wiki Page' % community.title else: page_title = page.title profiles = find_profiles(context) author = profiles[version.user] # Extra paranoia, probably not strictly necessary. I just want to make # extra special sure that the temp WikiPage object we create above # doesn't accidentally get attached to the persistent object graph. transaction.doom() return { 'date': format_local_date(version.archive_time, tz), 'author': author.title, 'title': page_title, 'body': page.cook(request), }
def _callFUT(self, date, tz=None, time_module=None): if time_module is None: import time time_module = time from karl.views.versions import format_local_date return format_local_date(date, tz=tz, time_module=time_module)