返回没有重组

时间:2015-11-11 16:57:01

标签: plone

运行:Plone 5.0.0 with Diazo。

如何永久地绕过在BrowserView模板中应用的重氮主题? (不是diazo.off = 1)

实施例: 我有一个重氮主题。我有一个模板,我通过BrowserView的ViewPageTemplateFile返回:

class ExhibitView(BrowserView):

    template = ViewPageTemplateFile("exhibit.pt")

    def __call__(self):
        return self.template()

exhibit.pt文件如下:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
  xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  i18n:domain="plone"
  lang="en">
<body>
    Is it just this text?
</body>
</html>

我删除了plone主模板,它仍在应用重氮规则。我只是希望它返回一个裸线模板,由diazo取代。如上所示,我们以前能够在Diazo之前做到这一点。

同样让Diazo规则跳过这个是不可能的,因为它必须安装在很多地方,我不想将规则应用于每个人的网站主题以使其发挥作用。这很黑。

提前致谢!

1 个答案:

答案 0 :(得分:6)

根据这条线:

如果你有一个名为&#39; X-Theme-Disabled&#39;变换未应用。两行之后,您会看到检查&#34; diazo.off&#34;。

的条件

因此,您应该在返回模板之前设置标头的方式修改__call__方法。 有点像这样:

 // MARK: - PHPhotoLibraryChangeObserver

func photoLibraryDidChange(changeInstance: PHChange) {
    // Check if there are changes to the assets we are showing.
    guard let
        assetsFetchResults = self.assetsFetchResults,
        collectionChanges = changeInstance.changeDetailsForFetchResult(assetsFetchResults)
        else {return}

    /*
    Change notifications may be made on a background queue. Re-dispatch to the
    main queue before acting on the change as we'll be updating the UI.
    */
    dispatch_async(dispatch_get_main_queue()) {
        // Get the new fetch result.
        self.assetsFetchResults = collectionChanges.fetchResultAfterChanges

        let collectionView = self.pictureCollectionView!

        if !collectionChanges.hasIncrementalChanges || collectionChanges.hasMoves {
            // Reload the collection view if the incremental diffs are not available
            collectionView.reloadData()

        } else {
            /*
            Tell the collection view to animate insertions and deletions if we
            have incremental diffs.
            */
            collectionView.performBatchUpdates({
                if let removedIndexes = collectionChanges.removedIndexes
                    where removedIndexes.count > 0 {
                        collectionView.deleteItemsAtIndexPaths(removedIndexes.aapl_indexPathsFromIndexesWithSection(0))
                }

                if let insertedIndexes = collectionChanges.insertedIndexes
                    where insertedIndexes.count > 0 {
                        collectionView.insertItemsAtIndexPaths(insertedIndexes.aapl_indexPathsFromIndexesWithSection(0))
                }

                if let changedIndexes = collectionChanges.changedIndexes
                    where changedIndexes.count > 0 {
                        collectionView.reloadItemsAtIndexPaths(changedIndexes.aapl_indexPathsFromIndexesWithSection(0))
                }
                }, completion:  nil)
        }

        self.resetCachedAssets() //perhaps prevents memory warning but causes the empty cells
    }
}

//MARK: - Asset Caching

private func resetCachedAssets() {
    self.imageManager?.stopCachingImagesForAllAssets()
    self.previousPreheatRect = CGRectZero
}

控制面板也在这样做:

警告:我没有测试过这个:)