Load properties from an open file stream
(self, stream)
| 219 | return newvalue |
| 220 | |
| 221 | def load(self, stream): |
| 222 | """ Load properties from an open file stream """ |
| 223 | |
| 224 | # For the time being only accept file input streams |
| 225 | if type(stream) is not file: |
| 226 | raise TypeError,'Argument should be a file object!' |
| 227 | # Check for the opened mode |
| 228 | if stream.mode != 'r': |
| 229 | raise ValueError,'Stream should be opened in read-only mode!' |
| 230 | |
| 231 | try: |
| 232 | lines = stream.readlines() |
| 233 | self.__parse(lines) |
| 234 | except IOError, e: |
| 235 | raise |
| 236 | |
| 237 | def getProperty(self, key): |
| 238 | """ Return a property for the given key """ |
no test coverage detected