473,503 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Zope] How to filter and sort PropertyObjects from ZCatalog

Hallo NG,

Hope, that I'm not totally wrong in this newsgroup. I have a question about
PropertyObjects in Zope:

I want to get some PropertyObjects out of a ZCatalog.

This Code:
result = (map( lambda brain: brain.getObject(),
container.Catalog.searchResults()))

returns me a list of all Objects in the Catalog, which are, in this case
PropertyObjects.

These PropertyObjects have a property 'priority' (type: int) , which I can
access with:

result[0].getProperty('priority')

Now, I want to filter out all PropertyObjects, which have 'priority == 0'
and sort all other POs by 'priority',
so that I finally have a list like this:

result[0].getProperty('priority') == 1
result[1].getProperty('priority') == 2
result[2].getProperty('priority') == 3
....

Does anyone know, how to reach such a list
a) by changing the query to the ZCatalog with 'filters' and 'sort
algorithms'
or
b) by changing my list 'result' ??

Thanks alot


Jul 18 '05 #1
1 1752
> Now, I want to filter out all PropertyObjects, which have 'priority == 0'

For the 'filter problem', I found a possibility:

result = (map( lambda brain: brain.getObject(),
filter(lambda x: x.getObject().getProperty('priority')>0,
container.Catalog.searchResults())))

Stays the 'sort problem'...
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2172
by: Jerrykhan | last post by:
Hello, who know the best Bug tracker system on a Python/Zope server ? BugZilla is Perl oriented (beuh !!) What about others ? Is A python oriented BugZilla like exists ? or need I write it ? ...
4
2327
by: Jochen Demuth | last post by:
Hi, I am trying to install ZWiki on Zope 2.5.1 / Debian 2.4.20-bf2.4-xfs. First I copied the contents of the ZWiki-0.32.0.tgz to the Products-directory under SOFTWARE_HOME: This is what it...
9
1587
by: john | last post by:
Hi I am developing a timesheet system. It will have 3 levels of access 1)Administrator 2)Approver -- Will approve or reject the timesheet filled by employees 3)Employees -- Fill in the timesheet...
4
1388
by: John Benson | last post by:
Hi, I've been reading the above-titled book and it looks like some major Python and Zope features have been cherry-picked for pushing down into .NET, like application memory management (Python...
0
2102
by: Unigroup of New York | last post by:
Content-Type: multipart/mixed; boundary="------------C465DF38DCB38DD2AF7117E0" Lines: 327 Date: Tue, 15 Feb 2005 23:36:38 -0500 NNTP-Posting-Host: 24.46.113.251 X-Complaints-To: abuse@cv.net...
4
1334
by: Kay Schluehr | last post by:
The last downloadable release is from november 2004. The Windows installer is configured for Python 2.3(!). The Zope.org main page announces Zope 2.8 beta 2. Is it stillborn? Kay
2
1496
by: Almad | last post by:
Hello, is ZCatalog available for standalone zodb? As far as I read tutorial, the relation to zope is obvious. I knew there is IndexedCatalog, but its not developed any more...and without...
2
2475
by: Mike Sweetman | last post by:
I have a form Form1 which when the Advanced Filter/Sort is used creates a form(maybe) with a title 'Form1Filter1 : Filter'. When I apply the filter to Form1 it is applied, but the value of...
4
5116
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.