使用Plone调用grok.View时,self.redirect会导致TypeError(self.redirect causes TypeError when calling grok.View with Plone)
我一直在使用简单的grok和Plone 4.1.4。 到目前为止,我尝试了从这里获取的版本1.2.0和1.1.1的良好配置five.grok
我尝试使用带重定向的grok.View,每当运行重定向代码(self.redirect('url'))时,都会引发以下TypeError:
TypeError: redirect() got an unexpected keyword argument 'trusted' > /home/alex/projects/eggs/grokcore.view-1.13.5-py2.6.egg/grokcore/view/components.py(50)redirect() -> url, status=status, trusted=trusted)
我发现这个讨论涉及类似的问题,但没有真正的解决方案。 gmane
重现错误非常简单,只需在grok.View派生类中使用更新方法即可。
from five import grok from Products.CMFCore.interfaces import ISiteRoot class RedirectTest(grok.View): grok.context(ISiteRoot) grok.require('zope2.View') grok.name('testredirect') def update(self): self.redirect(self.url('')) def render(self): self.redirect(self.url(''))
I've been using a simple grok and Plone 4.1.4. So far I tried known good configuration for version 1.2.0 and 1.1.1 taken from here five.grok
I attempt to use grok.View with redirects, and whenever redirect code (self.redirect('url')) is run, the following TypeError is raised:
TypeError: redirect() got an unexpected keyword argument 'trusted' > /home/alex/projects/eggs/grokcore.view-1.13.5-py2.6.egg/grokcore/view/components.py(50)redirect() -> url, status=status, trusted=trusted)
I found this discussion that deals with similar problem but no real solution. gmane
It's really easy to reproduce the error, just have an update method in grok.View-derived class.
from five import grok from Products.CMFCore.interfaces import ISiteRoot class RedirectTest(grok.View): grok.context(ISiteRoot) grok.require('zope2.View') grok.name('testredirect') def update(self): self.redirect(self.url('')) def render(self): self.redirect(self.url(''))
原文:https://stackoverflow.com/questions/14696133
最满意答案
某些存储引擎(如MyISAM和ISAM)会存储确切的计数。 但对于其他存储引擎,如InnoDB,这个值是一个近似值,并且可能与实际值相差多达40%到50%。 在这种情况下,使用SELECT COUNT(*)来获得准确的计数。“
Some storage engines, such as MyISAM and ISAM, store the exact count. BUT for other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count."
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
我们可以看出python包装和进口的工作原理吗?(Can we shed some definitive light on how python packaging and import works?)[2022-07-24]
在大多数情况下,这是试图查看包装/分销方面,而不是import 。 不幸的是,包装是Python提供多种方法的地方。 我只是试图让球滚动,希望其他人会帮助填补我错过或指出错误。 首先,这里有一些凌乱的术语。 包含__init__.py文件的目录是一个包。 然而,我们这里所说的大部分内容是在PyPI上发布的特定版本的软件,其中一个是镜像,或者是像Debian的Apt,Redhat的Yum,Fink,Macports,Homebrew或ActiveState的pypm之类的供应商特定的软件包管理系统。 这些发布 ... -
是否可以在O(1)时间内从表中获取行数?(Is it possible to get the number of rows from a table in O(1) time?)[2022-06-17]
是的,您可以使用sys.partitions ,它可能不是确切的数字,但它非常快: SELECT SUM(rows) FROM sys.partitions WHERE [object_id] = OBJECT_ID('dbo.MyTable') AND index_id IN (0,1); Yes, you can use sys.partitions, it might not be the exact number, but it's extremely fast: SELECT SUM(rows ... -
某些存储引擎(如MyISAM和ISAM)会存储确切的计数。 但对于其他存储引擎,如InnoDB,这个值是一个近似值,并且可能与实际值相差多达40%到50%。 在这种情况下,使用SELECT COUNT(*)来获得准确的计数。“ Some storage engines, such as MyISAM and ISAM, store the exact count. BUT for other storage engines, such as InnoDB, this value is an approxim ...
-
这是一个变量变量 print ${$b} 它首先评估{$b}并获得'a' 。 那么它评估$a并获得"b" (值存储在$a )。 This is a variable variable print ${$b} It first evaluates {$b} and gets 'a'. So then it evaluates $a and gets "b" (the value stores in $a).
-
Windows上的问题(Issues with light on Windows)[2023-04-22]
它与操作系统无关。 请运行一个移植到JOGL的OpenGL Red Book的简单示例,例如这个 。 我假设问题来自OpenGL驱动程序。 我建议你在尝试制作一个胖JAR时阅读这篇文章。 在GNU Linux下,我至少有一个没有正常工作的旧显卡。 请将您的第一行评论翻译成英文,想想绝大多数不了解我们母语的StackOverflow用户。 It has nothing to do with the operating system. Please run a simple example of the Ope ... -
看起来ANR是由Service运行超过5秒引起的。 显然,一些用户有大量的文件需要经历。 我通过将所有艰苦的工作转移到AsyncTask解决了这个问题。 It seems that the ANR was caused by the Service running for more than 5 seconds. Apparently a few users had a very large number of files that it had to go through. I've solved it ...
-
这对我each_with_index ,我认为使用each_with_index枚举,你必须传入一个哈希数组,即[{...},{...},{...}],而不是一个带有多个键的哈希 -值 def print_with_index(students) students.each_with_index do |students, index| index_plus_one = index + 1 puts "#{index_plus_one}. #{students[:name] ...
-
我担心你必须为paredit这样做。 它没有定义默认键盘快捷键。 这里还有另一个问题 ,它显示了paredit命令以及如何设置它们。 如果您打算在不同的计算机上使用Light Table,可以考虑将您的用户文件存储在Dropbox或Git中,以便在您的计算机之间同步它们。 I am afraid you have to do that for paredit. It doesn't have default keyboard shortcuts defined. There is another quest ...
-
我会检查你不回收任何数据库对象。 还可以在代码中使用print添加多个try {} catch()语句,以便找到代码崩溃的位置以缩小问题范围。 您还可以检查状态和应用程序/会话超时的配置http://www.dalsgaard-data.eu/blog/tuning-your-xpages/ I would check that you don't recycle any database objects. Also add multiple try{}catch() statements in your ...