예제 #1
0
 def __call__(self, context):
     try:
         section = ISection(context)
     except (TypeError,):
         linked_activity = proxy.removeSecurityProxy(context)
         section = ISection(linked_activity.__parent__)
     return ExternalActivitiesSource(section)
예제 #2
0
 def contains(self, principal):
     setting = ConfigurableScheduleEditors(self.context)
     if not setting.contains(principal):
         return False
     section = ISection(self.context, None)
     if section is None:
         return False
     contains = InstructorsCrowd(section).contains(principal)
     return contains
예제 #3
0
 def enabled(self):
     gradebook = removeSecurityProxy(self.context)
     worksheet = gradebook.context
     if worksheet.hidden:
         return False
     courses = list(ISection(gradebook).courses)
     if not courses:
         return False
     for course in courses:
         if not flourish.canEdit(course):
             return False
     return super(DeployAsCourseWorksheetLinkViewlet, self).enabled
예제 #4
0
 def courses(self):
     courses = []
     request_courses = self.request.get('courses', [])
     for course in ISection(self.context).courses:
         if not flourish.canEdit(course):
             continue
         checked = ('SUBMIT' not in self.request
                    or course.__name__ in request_courses)
         courses.append({
             'name': course.__name__,
             'title': course.title,
             'checked': checked and 'checked' or '',
             'obj': course,
         })
     return courses
예제 #5
0
 def schoolyear(self):
     return ISchoolYear(ISection(self.context))