Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # 4 # 5 # 6 # Copyright (c) 2008-2011 University of Dundee. 7 # 8 # This program is free software: you can redistribute it and/or modify 9 # it under the terms of the GNU Affero General Public License as 10 # published by the Free Software Foundation, either version 3 of the 11 # License, or (at your option) any later version. 12 # 13 # This program is distributed in the hope that it will be useful, 14 # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 # GNU Affero General Public License for more details. 17 # 18 # You should have received a copy of the GNU Affero General Public License 19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 20 # 21 # Author: Aleksandra Tarkowska <A(dot)Tarkowska(at)dundee(dot)ac(dot)uk>, 2008. 22 # 23 # Version: 1.0 24 # 25 26 from webclient.controller import BaseController 2729 327034 self.mostRecentSharesComments = list(self.conn.listMostRecentShareComments()) 35 self.mostRecentSharesComments.sort(key=lambda x: x.creationEventDate(), reverse=True) 36 self.mostRecentShares = list() 37 for sh in list(self.conn.listMostRecentShares()): 38 flag = True 39 for s in self.mostRecentShares: 40 if sh.id == s.id: 41 flag = False 42 if flag: 43 self.mostRecentShares.append(sh) 44 self.mostRecentShares.sort(key=lambda x: x.started, reverse=True)4547 tags = dict() 48 for ann in list(self.conn.listMostRecentTags()): 49 try: 50 if tags[ann.id]['count'] > 0: 51 tags[ann.id]['count'] = tags[ann.id]['count'] + 1 52 else: 53 tags[ann.id]['count'] = 1 54 except: 55 tags[ann.id] = {'obj':ann, 'count':1} 56 if len(tags) == 20: 57 break 58 59 font = {'max': 0, 'min': 1} 60 for key, value in tags.items(): 61 if value['count'] < font['min']: 62 font['min'] = value['count'] 63 if value['count'] > font['max']: 64 font['max'] = value['count'] 65 self.font = font 66 self.mostRecentTags = tags67
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Sep 23 15:04:56 2014 | http://epydoc.sourceforge.net |