我正面临着一个有趣的问题。我使用同步基本工作室+ Web将HTML转换成PDF格式。有时它工作得很好,但有时却完全没用。
什么叫完全没用?每次调用HtmlToPdf转换器的转换方法时,它都会抛出UnauthorizedException。但并不是每次都会发生,只是随机出现。这是我的代码:
string htmlString = "";
try
{ // Open the text file using a stream reader.
using (StreamReader sr = new Stre
我有一个输入/编辑帖子的视图。
如果人们没有登录(在模型中),我想阻止他们创建或编辑帖子&我想将./post/ new视图重定向到帖子列表,并显示一条消息"You not create new post if you I not logged in“。
我尝试在post控制器中更改"new“命令,如下所示:
def new
if !session[:user]
redirect_to(@posts, :notice => 'You cannot create a post unless you are logged in.
正如标题所说:为什么我不能在没有授权策略的情况下使用身份验证策略?
仅设置身份验证策略将导致:
pyramid.exceptions.ConfigurationExecutionError: <class 'pyramid.exceptions.ConfigurationError'>:
Cannot configure an authentication policy without also configuring
an authorization policy (use the set_authorization_policy method)