Hi group, I am busy with a part of a cms in which several DTML documents are being displayed on the frontpage. I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time, i tried different things, none of them helped. To me it seems not a difficult problem, but anyway, i could not figure out how to do that. Can anyone help me? This peace of code is contains it: list = context.items.objectItems('DTML Document') #list.sort(list(bobobase_modification-time)) #list.sort(cmp) #list.sort(lambda a, b: cmp(a.bobobase_modification_time,b.bobobase_modification_time)) #list.sort(objectValues(),('bobobase_modification_time')) All the commented lines contains different approaches, all of them return errors. Maybe someone has a link to where i can read about these things, to figure out what goes wrong? Sebastian Kügler ________________________ Webmaster NSM
On Fri, Sep 28, 2001 at 10:33:29AM +0200, Sebastian KЭgler wrote:
I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time
<dtml-in documents sort="bobobase_modification_time"> works for me. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Fri, Sep 28, 2001 at 10:33:29AM +0200, Sebastian KЭgler wrote:
I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time
<dtml-in documents sort="bobobase_modification_time"> works for me.
I am doing this in a python script, sorting in dtml has not been a problem. sebas.
On Fri, Sep 28, 2001 at 11:16:27AM +0200, Sebastian Kugler wrote:
I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time
<dtml-in documents sort="bobobase_modification_time"> works for me.
I am doing this in a python script, sorting in dtml has not been a problem.
from DTML import SortEx return SortEx(documents, (("bobobase_modification_time",),)) Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time
<dtml-in documents sort="bobobase_modification_time"> works for me.
I am doing this in a python script, sorting in dtml has not been a problem.
from DTML import SortEx return SortEx(documents, (("bobobase_modification_time",),))
I am getting the following error while importing DTML, the first line though the error is: Error Type: ImportError Error Value: import of "DTML" is unauthorized the last lines from the traceback are these: File /usr/local/zope/lib/python/Products/PythonScripts/PythonScript.py, line 363, in _exec (Object: output_news_py) (Info: ({'script': <PythonScript instance at 8a1d808>, 'context': <Folder instance at 89f3718>, 'container': <Folder instance at 8870198>, 'traverse_subpath': []}, (), {}, None)) File Script (Python), line 21, in output_news_py (Object: guarded_getitem) File /usr/local/zope/lib/python/AccessControl/ZopeGuards.py, line 213, in guarded_import ImportError: (see above) Any more ideas? tia, Sebastian Kügler ________________________ Webmaster NSM
On Fri, Sep 28, 2001 at 12:54:34PM +0200, Sebastian KЭgler wrote:
from DTML import SortEx return SortEx(documents, (("bobobase_modification_time",),))
I am getting the following error while importing DTML, the first line though
the error is: Error Type: ImportError Error Value: import of "DTML" is unauthorized
Then use mailist to learn how to eneble import DTML and other modules. Or do it in External Method. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
I can not imagine that this can not be done with sort() Maybe it is just me using the wrong syntax, could someone maybe check this for me? Maybe it is just a missing _. or something like that whick keeps me hanging with this problem ... tia, Sebas
I am busy with a part of a cms in which several DTML documents are being displayed on the frontpage.
I have the following problem with it, i could not yet figure out how to sort the items by bobobas modification time, i tried different things, none of them helped. To me it seems not a difficult problem, but anyway, i could not figure out how to do that.
Can anyone help me?
This peace of code is contains it:
list = context.items.objectItems('DTML Document') #list.sort(list(bobobase_modification-time)) #list.sort(cmp) #list.sort(lambda a, b:cmp(a.bobobase_modification_time,b.bobobase_modification_time)) #list.sort(objectValues(),('bobobase_modification_time'))
All the commented lines contains different approaches, all of them return errors.
Maybe someone has a link to where i can read about these things, to figure out what goes wrong?
On Fri, Sep 28, 2001 at 03:33:28PM +0200, Sebastian KЭgler wrote:
I can not imagine that this can not be done with sort()
Of course it can be done.
#list.sort(lambda a, b:cmp(a.bobobase_modification_time,b.bobobase_modification_time))
bobobase_modification_time is a function - call it: list.sort(lambda a, b: \ cmp(a.bobobase_modification_time(), b.bobobase_modification_time())) Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Oleg Broytmann -
Sebastian Kügler