2004年08月10日 星期二 13:34
已经可以了。把前后两段代码贴出来共享一下:
这是不能更新的:
def update(self, index, text):
"""remove a quote"""
self.__content[index] = text
下面是可以刷新的:
def update(self, index, text, REQUEST=None):
"""remove a quote"""
self.__content[index] = text
if REQUEST is not None:
return self.manageForm(REQUEST,
manage_tabs_message='Quote has inserted
successfully.')
--- "Zoom.Quiet" <zoomquiet at infopro.cn>,
zoomq at itcase.com, zoomq at infopro.cn,
UNEXPECTED_DATA_AFTER_ADDRESS at .SYNTAX-ERROR. 的正文:
> Hollo mike:
>
> Zope 下开发的话,可能就 Limodou 有经验,
> 在下只是使用而已,
>
> 不过,不论是DHTML还是 ZPT 最终都是要解析为 HTML
> 来让浏览器显示,
>
>
因为你的提交表单与结果列表是在同一页面的,是必须要刷新,重新载入才可以看到新内容的,
> 所以,在你表单的 submit 事件中,加上 reload()
> 的 JS 动作,应该可以满足要求是也乎?
>
> /******** [2004-08-10]13:12:39 ; mike wrote:
>
> mike gaul> 多谢limodou这么多次帮助我。
>
> mike gaul> 另外,有谁知道具体怎么做吗?谢谢了!
>
> mike gaul> --- limodou <chatme at 263.net> 的正文:
> >> mike gaul,您好!
> >>
> >>
> >>
> mike gaul>
>
现在好久不搞Zope,都记不起来了。可以使用RESPONSE.redirect方法吧。或加一个javascript来刷新document.location吧。具体是什么已经记不清了。
> >>
> >> ======= 2004-08-10 11:03:16
> 您在来信中写道:=======
> >>
> >> >我创建了一个简单的Product
> >> >其中在ZMI下面有个管理页面,有如下内容:
> >> >1.一个添加内容表单
> >> >2.内容列表
> >> >
> >>
>
>>现在的问题是,我在添加内容表单里面添加了一个内容,不会立刻
> >>
>
>>反映在内容列表中,要自己刷新一下才可以。怎样能自动反映变化
> >> >呢?
> >> >
> >> >下面是那个页面的dtml代码:
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >This form allows you to change the poll's
> question
> >> and
> >> >responses. Changing a poll's question and
> >> responses
> >> >will reset the poll's vote tally..
> >> >
> >> >
> >> >
> >> >
> >> >2004年08月10日 星期二 13:34
"Zoom.Quiet"Hollo hoxide: > > 嗯嗯! >感觉Python 从一开始就是关注 创造力的实现 ,而不是运行效率! >所以,丰富的数据类型后面,可能就是松散的内容管理, > >但是不影响Python 的快速布属和应用是也乎,毕竟现在的内存真的不值钱了!Windows 已经开始要求独占200Mb 内存了! > >当然这得是有浑厚 C 基础的同志们来关注,提升Python 的内涵是也乎?? > >其实,可以利用C,写一个内存探针,嵌入到Python 脚本中运行来测试各种对象运行时的内存使用情况是也乎??? > > >/******** [2004-08-10]13:17:47 ; hoxide wrote: > >hoxide> gentoo.cn,您好! > >hoxide> 资料不错,他的讨论证实了python中很难准确计算对象占用的内存数. >hoxide> 其实现在我也对python的内存管理感兴趣,昨天发现mod_python好像存在内存泄漏的问题. > >hoxide> ======= 2004-08-10 12:53:49 您在来信中写道:======= > >>>找到一个相关的讨论 >>>http://www.egenix.com/mailman-archives/egenix-users/2002-November/000156.html >>> >>>gentoo.cn wrote: >>> >>>>我的意思是:是不是可以通过计算一个Object的Struct来猜测这个Object的大小? >>>>比如c='a', string="abcd" >>>>那么c的类型是1c, string的类型是4c >>>>calcsize('c')=1 >>>>calcsize('L')=4 >>>>也就是说一个数值型的对象占用4Bytes内存空间,一个字符型对象占用1Bytes内存 >>>>空间? >>>>对于string="abcd"这个对象,类型是4c所以占用4Bytes内存空间? >>>>不知道Python如何考虑对齐的(也许他最小的单位是1Bytes所以都是8bit的倍数, >>>>这样就对齐了?) >>>> >>>>大家都来讨论讨论啊。 >>>> >>>> >>>> >>>>limodou wrote: >>>> >>>> >>>> >>>>>gentoo.cn,您好! >>>>> >>>>> 那个不是内存的大小吧。而是对应的struct的大小。因为在python中都是对象,而不仅仅是数据结构。不知道:你想知道内存大小有什么用? >>>>> >>>>>======= 2004-08-10 11:05:42 您在来信中写道:======= >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>>import struct >>>>>>struct.pack >>>>>>struct.calcsize ? >>>>>> >>>>>>难道使用这个方法吗? >>>>>>我也想知道有什么方法来计算对象的size >>>>>> >>>>>>*calcsize*( fmt) >>>>>> >>>>>> Return the size of the struct (and hence of the string) >>>>>> corresponding to the given format. >>>>>> >>>>>>Format characters have the following meaning; the conversion between C >>>>>>and Python values should be obvious given their types: >>>>>> >>>>>>*Format* *C Type* *Python* *Notes* >>>>>>x pad byte no value >>>>>>c char string of length 1 >>>>>>b signed char integer >>>>>>B unsigned char integer >>>>>>h short integer >>>>>>H unsigned short integer >>>>>>i int integer >>>>>>I unsigned int long >>>>>>l long integer >>>>>>L unsigned long long >>>>>>q long long long (1) >>>>>>Q unsigned long long long (1) >>>>>>f float float >>>>>>d double float >>>>>>s char[] string >>>>>>p char[] string >>>>>>P void * integer >>>>>> >>>>>> >>>>>>tocer wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>比如: >>>>>>>a=[1,2,3] >>>>>>>测试 a 在内存中的所占的字节数 >>>>>>> >>>>>>>------------------------------------------------------------------------ >>>>>>> >>>>>>>_______________________________________________ >>>>>>>python-chinese list >>>>>>>python-chinese at lists.python.cn >>>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>_______________________________________________ >>>>>>python-chinese list >>>>>>python-chinese at lists.python.cn >>>>>>http://python.cn/mailman/listinfo/python-chinese >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>= = = = = = = = = = = = = = = = = = = = >>>>> >>>>> >>>>> 致 >>>>>礼! >>>>> >>>>> >>>>> limodou >>>>> chatme at 263.net >>>>> 2004-08-10 >>>>> >>>>> >>>>> >>>>>------------------------------------------------------------------------ >>>>> >>>>>_______________________________________________ >>>>>python-chinese list >>>>>python-chinese at lists.python.cn >>>>>http://python.cn/mailman/listinfo/python-chinese >>>>> >>>>> >>>>> >>>>> >>>> >>>>_______________________________________________ >>>>python-chinese list >>>>python-chinese at lists.python.cn >>>>http://python.cn/mailman/listinfo/python-chinese >>>> >>>> >>>> >>>> >>> >>>_______________________________________________ >>>python-chinese list >>>python-chinese at lists.python.cn >>>http://python.cn/mailman/listinfo/python-chinese > >hoxide> = = = = = = = = = = = = = = = = = = = = > > >hoxide> 致 >hoxide> 礼! > > >hoxide> hoxide >hoxide> hoxide_dirac at yahoo.com.cn >hoxide> 2004-08-10 > > > >********************************************/ > >-- >Free as in Freedom > > Zoom.Quiet > >#=========================================# >]Time is unimportant, only life important![ >#=========================================# > >sender is the Bat!2.12.00 > >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese > = = = = = = = = = = = = = = = = = = = = 致 礼! Jerry Marx zhiyuan.ma at enorbus.com.cn 2004-08-10
2004年08月10日 星期二 13:38
gentoo.cn,您好! 怕的就是用数组 完全没办法控制大小 ======= 2004-08-10 11:58:00 您在来信中写道:======= >C++不用指针没法实现树吗? >同理,Python中使用C++中不用指针的树的算法不就可以了吗 >提示:使用数组的树 > >Jacob Fan wrote: > >>实现树和链表不需要指针,只要引用就可以了.所谓Python,Java一类的语言中没有指针是指你不能得到一个数据的确切的地址,不能做指针运算等等 不是说你不能引用另外一个对象. >> >>class LinkedListNode: >> def __init__(self, nextNode): >> self.nextNode = nextNode >> >>----- Original Message ----- >>From: "limodou" <chatme at 263.net> >>To: <python-chinese at lists.python.cn> >>Sent: Tuesday, August 10, 2004 11:38 AM >>Subject: Re: [python-chinese] Python没有指针,怎么实现树和链表的结构? >> >> >> >> >>>guochen,您好! >>> >>>使用对象啊。对象可以是任意的东西啊。 >>> >>>a = [1,2,[3,4,[5,6]]] >>> >>>这样不就和链表一样吗?树也可以这样表示啊。 >>> >>>======= 2004-08-10 11:15:39 您在来信中写道:======= >>> >>> >>> >>>>python-chinese,您好! >>>> >>>> >>>> >>>> 致 >>>>礼! >>>> >>>> >>>> guochen >>>> guochen at 1218.com.cn >>>> 2004-08-10 >>>> >>>> >>>>_______________________________________________ >>>>python-chinese list >>>>python-chinese at lists.python.cn >>>>http://python.cn/mailman/listinfo/python-chinese >>>> >>>> >>>= = = = = = = = = = = = = = = = = = = = >>> >>> >>> 致 >>>礼! >>> >>> >>> limodou >>> chatme at 263.net >>> 2004-08-10 >>> >>> >>> >>> >> >> >>-------------------------------------------------------------------------------- >> >> >> >> >>>_______________________________________________ >>>python-chinese list >>>python-chinese at lists.python.cn >>>http://python.cn/mailman/listinfo/python-chinese >>> >>> >>>------------------------------------------------------------------------ >>> >>>_______________________________________________ >>>python-chinese list >>>python-chinese at lists.python.cn >>>http://python.cn/mailman/listinfo/python-chinese >>> >>> > >_______________________________________________ >python-chinese list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese = = = = = = = = = = = = = = = = = = = = 致 礼! guochen guochen at 1218.com.cn 2004-08-10
2004年08月10日 星期二 13:39
limodou,您好!
但是现在还要实现出上下级别的关系和各个节点之间的索引
======= 2004-08-10 11:38:00 您在来信中写道:=======
>guochen,您好!
>
> 使用对象啊。对象可以是任意的东西啊。
>
>a = [1,2,[3,4,[5,6]]]
>
>这样不就和链表一样吗?树也可以这样表示啊。
>
>======= 2004-08-10 11:15:39 您在来信中写道:=======
>
>>python-chinese,您好!
>>
>>
>>
>> 致
>>礼!
>>
>>
>> guochen
>> guochen at 1218.com.cn
>> 2004-08-10
>>
>>
>>_______________________________________________
>>python-chinese list
>>python-chinese at lists.python.cn
>>http://python.cn/mailman/listinfo/python-chinese
>
>= = = = = = = = = = = = = = = = = = = =
>
>
> 致
>礼!
>
>
> limodou
> chatme at 263.net
> 2004-08-10
>
>_______________________________________________
>python-chinese list
>python-chinese at lists.python.cn
>http://python.cn/mailman/listinfo/python-chinese
= = = = = = = = = = = = = = = = = = = =
致
礼!
guochen
guochen at 1218.com.cn
2004-08-10
Zeuux © 2025
京ICP备05028076号