Mercurial > hg > MPIWGWeb
diff MPIWGStaff.py @ 93:48e88706cfc3
department filter for getMemberList.
author | casties |
---|---|
date | Thu, 16 May 2013 10:51:51 +0200 |
parents | ab836d3f96dc |
children | f4ac675b2031 |
line wrap: on
line diff
--- a/MPIWGStaff.py Wed May 15 21:14:26 2013 +0200 +++ b/MPIWGStaff.py Thu May 16 10:51:51 2013 +0200 @@ -135,13 +135,18 @@ return len(res) > 0 - def getMemberList(self, sortBy='last_name', onlyCurrent=False, limit=0): + def getMemberList(self, department=None, sortBy='last_name', onlyCurrent=False, limit=0): """Return the list of members. Returns a list of MPIWGStaffMember objects. """ members = [] query = "select * from personal_www_list where publish_the_data = 'yes' and is_scholar='yes'" + args = [] + + if department is not None: + query += " and department ilike %s" + args.append('%%%s%%'%department) if onlyCurrent: query += " and date_from < CURRENT_DATE" @@ -154,7 +159,7 @@ if limit > 0: query += " limit %s"%int(limit) - result = self.executeZSQL(query) + result = self.executeZSQL(query, args) for res in result: members.append(MPIWGStaffMember(self, dbresult=res)) @@ -192,17 +197,6 @@ except: return [] - def getLastArrivals(self,limit=None): - """getlast arrivals""" - if not limit: - selectStr="select * from personal_www_list where publish_the_data = 'yes' and is_scholar='yes' and date_from < CURRENT_DATE order by date_from DESC" - else: - selectStr="select * from personal_www_list where publish_the_data = 'yes' and is_scholar='yes' and date_from < CURRENT_DATE order by date_from DESC limit %s"%limit - - res=self.members.executeZSQL(selectStr) - - return res - def manage_addMPIWGStaffFolderForm(self): """form for adding the project"""