| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -490,26 +490,29 @@ class SubjectList(ListResult): | |||
| 490 | 490 | _itemclass = SubjectObject | |
| 491 | 491 | ||
| 492 | 492 | ||
| 493 | - class TeacherObject(ListItem): | ||
| 494 | - """Represents a teacher.""" | ||
| 493 | + class PersonObject(ListItem): | ||
| 494 | + """Represents a person (teacher or student).""" | ||
| 495 | 495 | ||
| 496 | 496 | @lazyproperty | |
| 497 | 497 | def fore_name(self): | |
| 498 | - """fore name of the teacher""" | ||
| 498 | + """fore name of the person""" | ||
| 499 | 499 | return self._data[u'foreName'] | |
| 500 | 500 | ||
| 501 | 501 | @lazyproperty | |
| 502 | 502 | def long_name(self): | |
| 503 | - """surname of teacher""" | ||
| 503 | + """surname of person""" | ||
| 504 | 504 | return self._data[u'longName'] | |
| 505 | 505 | ||
| 506 | 506 | surname = long_name | |
| 507 | 507 | ||
| 508 | 508 | @lazyproperty | |
| 509 | 509 | def name(self): | |
| 510 | - """full name of the teacher""" | ||
| 510 | + """full name of the person""" | ||
| 511 | 511 | return self._data[u'name'] | |
| 512 | 512 | ||
| 513 | + | ||
| 514 | + class TeacherObject(PersonObject): | ||
| 515 | + """Represents a teacher.""" | ||
| 513 | 516 | @lazyproperty | |
| 514 | 517 | def title(self): | |
| 515 | 518 | """title of the teacher""" | |
@@ -681,3 +684,15 @@ def timeUnits(self): | |||
| 681 | 684 | ||
| 682 | 685 | class TimegridObject(ListResult): | |
| 683 | 686 | _itemclass = TimegridDayObject | |
| 687 | + | ||
| 688 | + | ||
| 689 | + class StudentObject(PersonObject): | ||
| 690 | + """Represents a student.""" | ||
| 691 | + | ||
| 692 | + @lazyproperty | ||
| 693 | + def full_name(self): | ||
| 694 | + """full name of student (forname, longname)""" | ||
| 695 | + return " ".join((self.fore_name, self.long_name)).strip() | ||
| 696 | + | ||
| 697 | + class StudentsList(ListResult): | ||
| 698 | + _itemclass = StudentObject | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -184,6 +184,29 @@ class PeriodObject(ListItem): | |||
| 184 | 184 | ... | |
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | + class PersonObject(ListItem): | ||
| 188 | + | ||
| 189 | + @property | ||
| 190 | + def fore_name(self) -> str: | ||
| 191 | + ... | ||
| 192 | + | ||
| 193 | + @property | ||
| 194 | + def full_name(self) -> str: | ||
| 195 | + ... | ||
| 196 | + | ||
| 197 | + @property | ||
| 198 | + def long_name(self) -> str: | ||
| 199 | + ... | ||
| 200 | + | ||
| 201 | + @property | ||
| 202 | + def name(self) -> str: | ||
| 203 | + ... | ||
| 204 | + | ||
| 205 | + @property | ||
| 206 | + def surname(self) -> str: | ||
| 207 | + ... | ||
| 208 | + | ||
| 209 | + | ||
| 187 | 210 | class RoomList(ListResult): | |
| 188 | 211 | ||
| 189 | 212 | def filter(self, **criterions) -> RoomList: | |
@@ -267,6 +290,20 @@ class SubjectObject(ListItem): | |||
| 267 | 290 | ... | |
| 268 | 291 | ||
| 269 | 292 | ||
| 293 | + class StudentsList(ListResult): | ||
| 294 | + def filter(self, **criterions) -> StudentsList: | ||
| 295 | + ... | ||
| 296 | + | ||
| 297 | + def __getitem__(self, i: int) -> StudentObject: | ||
| 298 | + ... | ||
| 299 | + | ||
| 300 | + | ||
| 301 | + class StudentObject(PersonObject): | ||
| 302 | + @property | ||
| 303 | + def full_name(self) -> str: | ||
| 304 | + ... | ||
| 305 | + | ||
| 306 | + | ||
| 270 | 307 | class SubstitutionList(ListResult): | |
| 271 | 308 | ||
| 272 | 309 | def filter(self, **criterions) -> SubstitutionList: | |
@@ -300,30 +337,13 @@ class TeacherList(ListResult): | |||
| 300 | 337 | ... | |
| 301 | 338 | ||
| 302 | 339 | ||
| 303 | - class TeacherObject(ListItem): | ||
| 304 | - | ||
| 305 | - @property | ||
| 306 | - def fore_name(self) -> str: | ||
| 307 | - ... | ||
| 308 | - | ||
| 309 | - @property | ||
| 310 | - def full_name(self) -> str: | ||
| 311 | - ... | ||
| 312 | - | ||
| 313 | - @property | ||
| 314 | - def long_name(self) -> str: | ||
| 315 | - ... | ||
| 316 | - | ||
| 340 | + class TeacherObject(PersonObject): | ||
| 317 | 341 | @property | |
| 318 | - def name(self) -> str: | ||
| 319 | - ... | ||
| 320 | - | ||
| 321 | - @property | ||
| 322 | - def surname(self) -> str: | ||
| 342 | + def title(self) -> str: | ||
| 323 | 343 | ... | |
| 324 | 344 | ||
| 325 | 345 | @property | |
| 326 | - def title(self) -> str: | ||
| 346 | + def full_name(self): | ||
| 327 | 347 | ... | |
| 328 | 348 | ||
| 329 | 349 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -323,6 +323,14 @@ def timegridUnits(self): | |||
| 323 | 323 | return objects.TimegridObject, 'getTimegridUnits', {} | |
| 324 | 324 | ||
| 325 | 325 | ||
| 326 | + @result_wrapper | ||
| 327 | + def students(self): | ||
| 328 | + """ | ||
| 329 | + | ||
| 330 | + :rtype: :py:class:`webuntis.objects.StudentsList` | ||
| 331 | + """ | ||
| 332 | + return objects.StudentsList, 'getStudents', {} | ||
| 333 | + | ||
| 326 | 334 | class Session(JSONRPCSession, ResultWrapperMixin): | |
| 327 | 335 | """The origin of everything you want to do with the WebUntis API. Can be | |
| 328 | 336 | used as a context-manager to provide automatic log-out. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments