Changeset 5988 for main/waeup.sirp/trunk/src
- Timestamp:
- 27 Apr 2011, 07:43:49 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/breadcrumbs.py
r5864 r5988 121 121 @property 122 122 def title(self): 123 prefix = self.context.title_prefix 124 prefix = prefix[0].upper() + prefix[1:] 125 return '%s of %s' % (prefix, self.context.title) 123 return self.context.longtitle() 126 124 127 125 class DepartmentBreadcrumb(FacultyBreadcrumb): -
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5987 r5988 41 41 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor) 42 42 from waeup.sirp.university.catalog import search 43 from waeup.sirp.utils.helpers import getName44 43 from waeup.sirp.widgets.interfaces import ITableProvider 45 44 … … 905 904 grok.name('index') 906 905 pnav = 1 906 907 907 @property 908 908 def title(self): 909 return "%s (%s)" % (getName(self.context), self.context.code)909 return self.context.longtitle() 910 910 911 911 #def update(self, code=None, edit=None, delete=None): … … 995 995 grok.name('index') 996 996 pnav = 1 997 #title = 'xxx' 997 998 998 999 @property 999 1000 def title(self): 1000 return "%s (%s)" % (getName(self.context), self.context.code) 1001 #import pdb; pdb.set_trace() 1002 return self.context.longtitle() 1001 1003 1002 1004 def update(self): -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultycontainerpage.pt
r5942 r5988 15 15 <tr tal:repeat="value context/values"> 16 16 <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td> 17 <td tal:content="value/ title">Title</td>17 <td tal:content="value/longtitle">Title</td> 18 18 </tr> 19 19 </tbody> -
main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/facultypage.pt
r5942 r5988 15 15 <tr tal:repeat="value context/values"> 16 16 <td> <a tal:attributes="href value/__name__"> <span tal:content="value/code">Name</span></a></td> 17 <td tal:content="value/ title">Title</td>17 <td tal:content="value/longtitle">Title</td> 18 18 <td class="text-right"> 19 19 </td> -
main/waeup.sirp/trunk/src/waeup/sirp/tables.py
r5915 r5988 6 6 from waeup.sirp.widgets.table import YUITable as Table 7 7 from waeup.sirp.widgets.table import Col 8 from waeup.sirp.utils.helpers import getName9 8 10 9 class CodeAndTitleTableProvider(grok.Adapter): … … 42 41 Col( 43 42 header='Title', sortable=True, 44 data = tuple([ getName(data[x])for x in data])),43 data = tuple([data[x] for x in data])), 45 44 ) 46 45 self.table = Table(self.title, cols=cols) -
main/waeup.sirp/trunk/src/waeup/sirp/university/department.py
r5953 r5988 6 6 from zope.interface import implementedBy 7 7 from waeup.sirp.university.interfaces import IDepartment, IDepartmentAdd 8 from waeup.sirp.university.vocabularies import inst_types 8 9 9 10 class Department(grok.Container): … … 40 41 return None 41 42 43 def longtitle(self): 44 return "%s %s (%s)" % (inst_types.getTerm(self.title_prefix).title, 45 self.title, 46 self.code) 47 42 48 43 49 class DepartmentFactory(grok.GlobalUtility): -
main/waeup.sirp/trunk/src/waeup/sirp/university/faculty.py
r5953 r5988 7 7 from waeup.sirp.university.interfaces import ( 8 8 IFaculty, IFacultyAdd, IDepartment) 9 from waeup.sirp.university.vocabularies import inst_types 9 10 10 11 class Faculty(grok.Container): … … 36 37 del self[key] 37 38 38 #def getName(self, key): 39 # """Get complete department name. 40 # """ 41 # if key in self.keys(): 42 # dept = self[key] 43 # prefix = dept.title_prefix 44 # prefix = prefix[0].upper() + prefix[1:] 45 # return '%s of %s' % (prefix, dept.title) 46 39 def longtitle(self): 40 return "%s %s (%s)" % (inst_types.getTerm(self.title_prefix).title, 41 self.title, 42 self.code) 47 43 48 44 class FacultyFactory(grok.GlobalUtility): -
main/waeup.sirp/trunk/src/waeup/sirp/university/facultycontainer.py
r5915 r5988 22 22 del self[key] 23 23 24 #def getName(self, key):25 # if key in self.keys():26 # fac = self[key]27 # prefix = fac.title_prefix28 # prefix = prefix[0].upper() + prefix[1:]29 # return '%s of %s' % (prefix, fac.title)30 31 24 class FacultyContainerFactory(grok.GlobalUtility): 32 25 """A factory for faculty containers. -
main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py
r5986 r5988 9 9 application_category, 10 10 study_mode, 11 inst_types, 11 12 CourseSource) 12 13 … … 28 29 ) 29 30 30 title_prefix = schema. TextLine(31 title_prefix = schema.Choice( 31 32 title = u'Title prefix', 32 33 default = u'faculty', 33 required = True, 34 ) 34 vocabulary = inst_types, 35 required = True, 36 ) 37 38 def longtitle(): 39 """ 40 Returns the long title of a faculty. 41 """ 35 42 36 43 class IFacultyAdd(IFaculty): … … 72 79 ) 73 80 74 title_prefix = schema. TextLine(81 title_prefix = schema.Choice( 75 82 title = u'Title prefix', 83 vocabulary = inst_types, 76 84 default = u'department', 77 85 required = True, … … 80 88 courses = Attribute("A container for courses.") 81 89 certificates = Attribute("A container for certificates.") 82 90 91 def longtitle(): 92 """ 93 Returns the long title of a department. 94 """ 95 83 96 class IDepartmentAdd(IDepartment): 84 97 """Representation of a university department. -
main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py
r5986 r5988 10 10 from zope.app.catalog.interfaces import ICatalog 11 11 from zope.component import getUtility 12 13 inst_types = SimpleWAeUPVocabulary( 14 ('Faculty of','faculty'), 15 ('Department of','department'), 16 ('School of','school_of'), 17 ('School for','school_for'), 18 ('Institute of','institute'), 19 ('Office for','office'), 20 ('Centre for','centre'), 21 ('College','college'), 22 ) 12 23 13 24 course_levels = SimpleWAeUPVocabulary( -
main/waeup.sirp/trunk/src/waeup/sirp/utils/helpers.py
r5876 r5988 118 118 pass 119 119 return html_code 120 121 def getName(context):122 """Construct a name out of an object with prefix and title.123 124 The `context` has to provide `title_prefix` and `title`125 attributes.126 127 >>> from waeup.sirp.utils.helpers import getName128 >>> class FakeObject(object):129 ... title_prefix = 'department'130 ... title = 'Strange Things'131 >>> getName(FakeObject())132 'Department of Strange Things'133 134 As we can see in the result the `title_prefix` is rendered135 uppercase.136 137 """138 prefix = context.title_prefix139 prefix = prefix[0].upper() + prefix[1:]140 return '%s of %s' % (prefix, context.title)141 120 142 121 class FactoryBase(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.