Frederic De Groef avatar Frederic De Groef committed 48642ff

defined unique_name property for CourseEvents

Comments (0)

Files changed (2)

examples/test_course_calendar.py

     print "Result : "
     print calendar
     print calendar.events
+    print calendar.events[0].unique_name
 
 
 def test_nonexistent_course():

src/gehol/coursecalendar.py

         super(CourseEvent, self).__init__(**kwargs)
         self.type = kwargs['type']
         self.title = kwargs['title']
+        self.mnemo = kwargs['mnemo']
 
     @property
     def summary(self):
         return "%s [%s]" % (self.summary, self.organizer)
 
 
+    @property
+    def unique_name(self):
+        return "%s%s" % (self.mnemo, self.location.replace('.', ''))
+
     
 class CourseCalendar(BaseCalendar):
     '''Loads events for a given course'''
         return "%s - %s (%s) [%s]" % tuple([self.metadata[k] for k in ('mnemo', 'title', 'type', 'tutor')])
 
 
+
     def __repr__(self):
         return u"{Mnemo : %s   Title : %s   Tutor : %s   Type : %s    (%d events)}" % (self.metadata['mnemo'],
                self.metadata['title'],
                     current_time = current_time + event_data['duration']
                     event_data['organizer'] = ""
                     event_data['title'] = "%s - %s" % (self.metadata['mnemo'], self.metadata['title'])
+                    event_data['mnemo'] = self.metadata['mnemo'].strip()
 
                     course_event = CourseEvent(**event_data)
                     event_list.append(course_event)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.