|
|
|
|
| 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? |
 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 02:22 | 376 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - limodou [ 2005-04-23 11:51 | 73 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 14:15 | 576 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 14:12 | 840 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 14:07 | 214 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - limodou [ 2005-04-23 14:32 | 334 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 19:07 | 895 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-23 18:18 | 80 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - limodou [ 2005-04-23 23:06 | 304 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-24 14:12 | 1,028 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - limodou [ 2005-04-24 15:40 | 46 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-24 16:51 | 867 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - limodou [ 2005-04-24 20:13 | 68 byte(s)]
 Re: 请问各位大侠,在Zope中如何用python script实现修改一个File的内容啊!? - kaze [ 2005-04-24 13:52 | 13 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
偶在Zope中用python script实现File的上传,并创建对应的File对象。
但当我想使用python script实现修改一个File的内容该如何实现呢?!比如一个Image上传错了,重新上传时,要求对应的File对象的ID不变,只是修改其内容,有什么方法?!
我GOOGLE了一下,好象是使用PUT方法,但不知道具体如何使用,不知道哪位知道呢?!
指点下迷津啊,多谢!
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
File有类似edit的方法吗?!是不是应该使用update_data啊?!
我使用update_data方法时,Zope要求我输入用户密码呢,是不是因为匿名用户没有使用该方法的权限啊?!
老大,请再指点啊! ^_^
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
若使用manage_edit的话,不知道要填写什么参数呢?!出现如下错误了:
Site Error
An error was encountered while publishing this resource.
Error Type: TypeError
Error Value: manage_edit() takes at least 3 arguments (2 given)
--------------------------------------------------------------------------------
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the error log.
If the error persists please contact the site maintainer. Thank you for your patience.
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
老大,我就随便添了个''给manage_edit后,好象是成功了,但怎么文件的内容没有修改呢?
<ZPublisher.HTTPRequest.FileUpload instance at 0x01FE7530>
上传用的代码如下:
#参数:file_id,file
ret = 1
for item in container.objectItems():
if file_id == item[0]:
item[1].manage_edit(file,'')
ret = 0
break
if ret == 1:
context.manage_addFile(file_id,file)
return 'output : '+str(ret)
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
我很早以前做过,有些想不起来了。如果你有兴趣可以去 pyrecord.freezope.org 下载翻译平台看一看,里面有相似的代码。
我查了查,好象是先得到文件对象,然后调用它的manage_edit(text, '')即可。
输密码很正常,zope有这样的安全控制。要设置你的脚本的权限,一般是设置一个proxy,详细地要看 The Zope Book 这本书。
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
我设置了proxy为Manager,但执行的时候出现如下的错误了……
搞不掂呢……老大……
Site Error
An error was encountered while publishing this resource.
Error Type: Unauthorized
Error Value: You are not allowed to access 'update_data' in this context
--------------------------------------------------------------------------------
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the error log.
If the error persists please contact the site maintainer. Thank you for your patience.
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
不是有个软件下载嘛。那里面就有呀。翻译与评论网网站源代码,它就是用zope实现的。
权限的问题我一时也想不起来,我已经放下zope好长时间了。不过你是管理员身份就没有这个问题呀。先测试功能,权限可以慢慢试。有时间还是很文档吧,我也不是很明白。还可以去czug.org去问一问,它是专业的zope/plone网站。
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
再问老大一个问题:
我在一个DTML Method中使用如下的语句:
<dtml-with REQUEST>
<dtml-if name>
<dtml-in expr="test(user='&dtml-name')">
Hello,<dtml-var user><br>
</dtml-in>
</dtml-if>
</dtml-with>
其中,test是一个从数据库查询用户信息的ZSQL方法,但不知道为什么,死活就是查询不出结果来……
如果换成下面这样就可以(在用户信息表中有一个名为123的用户):
<dtml-with REQUEST>
<dtml-if name>
<dtml-in expr="test(user='123')">
Hello,<dtml-var user><br>
</dtml-in>
</dtml-if>
</dtml-with>
偶吐血了…… 这是为什么呢?!?!
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
改为下面这样子还是不行:
<dtml-with REQUEST>
<dtml-if name>
<dtml-in expr="test(user='&dtml-name;')">
Hello,<dtml-var user><br>
</dtml-in>
</dtml-if>
</dtml-with>
改为下面这样子还会出现错误:unexpected EOF while parsing (, line 1)
<dtml-with REQUEST>
<dtml-if name>
<dtml-in expr="test(user='&dtml-name');">
Hello,<dtml-var user><br>
</dtml-in>
</dtml-if>
</dtml-with>
搞不懂了…… :(
|
|
|
[Original]
[Print]
[Top]
|
|
|