Changeset 4738


Ignore:
Timestamp:
8 Jan 2010, 03:39:34 (15 years ago)
Author:
uli
Message:

Remove unused view-components and clean up a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/university/coursecontainer.py

    r4470 r4738  
    55from zope.component.interfaces import IFactory
    66from waeup.interfaces import ICourseContainer, ICourse
    7 from waeup.viewlets import MainArea, Index, Manage, FormWrapMixin
    8 from waeup.widgets.interfaces import ITableProvider
    97
    108class CourseContainer(grok.Container):
     
    1513
    1614    def addCourse(self, course):
     15        """Add a course.
     16        """
    1717        if not ICourse.providedBy(course):
    1818            raise TypeError('CourseContainers contain only ICourse instances')
     
    2121
    2222    def clear(self):
     23        """Remove all objects from course container.
     24        """
    2325        keys = self.keys()
    2426        for key in keys:
     
    3840    def getInterfaces(self):
    3941        return implementedBy(CourseContainer)
    40 
    41 
    42 class ManageForm(grok.EditForm):
    43     """Manage the basic properties of a `Coursecontainer` instance.
    44     """
    45 
    46     form_fields = grok.AutoFields(ICourseContainer)
    47 
    48     @property
    49     def label(self):
    50         # Set department name as form label
    51         #return self.form_fields['title'].field.get(self.context)
    52         return ''
    53    
    54     @grok.action('Save')
    55     def save(self, **data):
    56         self.applyData(self.context, **data)
    57         return
    58    
    59     @grok.action('Save and return')
    60     def saveAndReturn(self, **data):
    61         self.applyData(self.context, **data)
    62         self.redirect(self.url(self.context))
    63         return
    64 
    65     @grok.action('Cancel')
    66     def cancel(self, **data):
    67         self.redirect(self.url(self.context))
    68         return
    69 
    70 class ManageCourseContainer(FormWrapMixin, grok.Viewlet):
    71     """A viewlet that renders the `ManageForm`.
    72     """
    73     grok.viewletmanager(MainArea)
    74     grok.context(ICourseContainer)
    75     grok.view(Manage)
    76     grok.require('waeup.manageUniversity')
    77    
    78     formview_name = 'manageform' # The name of the formview we want to
    79                                  # be rendered in this viewlet.
    80 
    81 class CourseList(grok.Viewlet):
    82     grok.viewletmanager(MainArea)
    83     grok.context(ICourseContainer)
    84     grok.view(Index)
    85     grok.order(3)
    86 
    87     def update(self):
    88         self.table = ITableProvider(self.context).getTables(view=self.view)[0]
    89         self.table.need()
Note: See TracChangeset for help on using the changeset viewer.