The method Update() is tried on the instantiated class. Some classes do not have an Update method, if this is the case, Python will generate an AttributeError, in this case, the name of the class is stored in the global variable noUpdate and false is returned. If an error
(b, e)
| 171 | return res |
| 172 | |
| 173 | def TryUpdate(b, e): |
| 174 | ''' |
| 175 | The method Update() is tried on the instantiated class. |
| 176 | |
| 177 | Some classes do not have an Update method, if this is the case, |
| 178 | Python will generate an AttributeError, in this case, the name |
| 179 | of the class is stored in the global variable noUpdate and false |
| 180 | is returned. |
| 181 | |
| 182 | If an error occurs on Update() then the error handler |
| 183 | will be triggered and in this case false is returned. |
| 184 | |
| 185 | :param: b - the class on which Update() will be tried. |
| 186 | :param: e - the error handler. |
| 187 | :return: True if the update was successful, False otherwise. |
| 188 | ''' |
| 189 | try: |
| 190 | b.Update() |
| 191 | if e.ErrorOccurred(): |
| 192 | return False |
| 193 | else: |
| 194 | return True |
| 195 | except AttributeError: |
| 196 | # No Update() method |
| 197 | noUpdate.add(b.GetClassName()) |
| 198 | return False |
| 199 | except: |
| 200 | raise |
| 201 | |
| 202 | def TryShutdown(b, e): |
| 203 | ''' |
no test coverage detected