| OLD | NEW |
| 1 # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 once. | 553 once. |
| 554 | 554 |
| 555 test: a QuestionForm | 555 test: a QuestionForm |
| 556 | 556 |
| 557 answer_key: an XML string of your answer key, for automatically | 557 answer_key: an XML string of your answer key, for automatically |
| 558 scored qualification tests. | 558 scored qualification tests. |
| 559 (Consider implementing an AnswerKey class for this to support.) | 559 (Consider implementing an AnswerKey class for this to support.) |
| 560 | 560 |
| 561 test_duration: the number of seconds a worker has to complete the test. | 561 test_duration: the number of seconds a worker has to complete the test. |
| 562 | 562 |
| 563 auto_granted: if True, requests for the Qualification are granted immedi
ately. | 563 auto_granted: if True, requests for the Qualification are granted |
| 564 Can't coexist with a test. | 564 immediately. Can't coexist with a test. |
| 565 | 565 |
| 566 auto_granted_value: auto_granted qualifications are given this value. | 566 auto_granted_value: auto_granted qualifications are given this value. |
| 567 | 567 |
| 568 """ | 568 """ |
| 569 | 569 |
| 570 params = {'Name' : name, | 570 params = {'Name' : name, |
| 571 'Description' : description, | 571 'Description' : description, |
| 572 'QualificationTypeStatus' : status, | 572 'QualificationTypeStatus' : status, |
| 573 } | 573 } |
| 574 if retry_delay is not None: | 574 if retry_delay is not None: |
| 575 params['RetryDelay'] = retry_delay | 575 params['RetryDelayInSeconds'] = retry_delay |
| 576 | 576 |
| 577 if test is not None: | 577 if test is not None: |
| 578 assert(isinstance(test, QuestionForm)) | 578 assert(isinstance(test, QuestionForm)) |
| 579 assert(test_duration is not None) | 579 assert(test_duration is not None) |
| 580 params['Test'] = test.get_as_xml() | 580 params['Test'] = test.get_as_xml() |
| 581 | 581 |
| 582 if test_duration is not None: | 582 if test_duration is not None: |
| 583 params['TestDurationInSeconds'] = test_duration | 583 params['TestDurationInSeconds'] = test_duration |
| 584 | 584 |
| 585 if answer_key is not None: | 585 if answer_key is not None: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 params = {'QualificationTypeId' : qualification_type_id } | 623 params = {'QualificationTypeId' : qualification_type_id } |
| 624 | 624 |
| 625 if description is not None: | 625 if description is not None: |
| 626 params['Description'] = description | 626 params['Description'] = description |
| 627 | 627 |
| 628 if status is not None: | 628 if status is not None: |
| 629 params['QualificationTypeStatus'] = status | 629 params['QualificationTypeStatus'] = status |
| 630 | 630 |
| 631 if retry_delay is not None: | 631 if retry_delay is not None: |
| 632 params['RetryDelay'] = retry_delay | 632 params['RetryDelayInSeconds'] = retry_delay |
| 633 | 633 |
| 634 if test is not None: | 634 if test is not None: |
| 635 assert(isinstance(test, QuestionForm)) | 635 assert(isinstance(test, QuestionForm)) |
| 636 params['Test'] = test.get_as_xml() | 636 params['Test'] = test.get_as_xml() |
| 637 | 637 |
| 638 if test_duration is not None: | 638 if test_duration is not None: |
| 639 params['TestDuration'] = test_duration | 639 params['TestDuration'] = test_duration |
| 640 | 640 |
| 641 if answer_key is not None: | 641 if answer_key is not None: |
| 642 if isinstance(answer_key, basestring): | 642 if isinstance(answer_key, basestring): |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 self.fields = [] | 905 self.fields = [] |
| 906 self.qid = None | 906 self.qid = None |
| 907 | 907 |
| 908 def endElement(self, name, value, connection): | 908 def endElement(self, name, value, connection): |
| 909 if name == 'QuestionIdentifier': | 909 if name == 'QuestionIdentifier': |
| 910 self.qid = value | 910 self.qid = value |
| 911 elif name in ['FreeText', 'SelectionIdentifier', 'OtherSelectionText'] a
nd self.qid: | 911 elif name in ['FreeText', 'SelectionIdentifier', 'OtherSelectionText'] a
nd self.qid: |
| 912 self.fields.append((self.qid,value)) | 912 self.fields.append((self.qid,value)) |
| 913 elif name == 'Answer': | 913 elif name == 'Answer': |
| 914 self.qid = None | 914 self.qid = None |
| OLD | NEW |