| | 160 | @interface.invariant |
| | 161 | def noAutoStartAndAttachPort(obj): |
| | 162 | """Cannot specify both auto-starting and an attachment port""" |
| | 163 | if obj.autoStart and (obj.attachPort is not None): |
| | 164 | raise interface.Invalid( |
| | 165 | _(u'Cannot specify both auto-start and an attachment port')) |
| | 166 | |
| | 167 | attachPasswordSource = schema.Choice( |
| | 168 | title=_(u'Password source'), |
| | 169 | description=_(u'attach-password-source-description', |
| | 170 | u'Where to source the password information for the ' |
| | 171 | u'attaching IDE'), |
| | 172 | vocabulary=schema.vocabulary.SimpleVocabulary.fromItems(( |
| | 173 | (_(u'Wing Profile Directory'), PWD_PROFILE), |
| | 174 | (_(u'Specified path'), PWD_PATH), |
| | 175 | (_(u'Specified password'), PWD_MANUAL))), |
| | 176 | default=PWD_PROFILE) |
| | 177 | |
| | 178 | attachPasswordPath = schema.TextLine( |
| | 179 | title=_(u'Password source path'), |
| | 180 | description=_(u'attach-password-path-description', |
| | 181 | u'The path to a password source file. Can be both a ' |
| | 182 | u'file as well as a directory path; in the latter case ' |
| | 183 | u'the file .wingdebugpw in that directory will be ' |
| | 184 | u'used.'), |
| | 185 | required=False) |
| | 186 | |
| | 187 | attachPassword = schema.BytesLine( |
| | 188 | title=_(u'Attach password'), |
| | 189 | description=_(u'attach-password-description', |
| | 190 | u'Password to be supplied by attaching IDE'), |
| | 191 | required=False) |
| | 192 | |
| | 193 | @interface.invariant |
| | 194 | def checkAttachPassword(obj): |
| | 195 | """If source is not PWD_PROFILE, the source needs to be specified""" |
| | 196 | if obj.attachPasswordSource == PWD_PATH: |
| | 197 | if not obj.attachPasswordPath: |
| | 198 | raise interface.Invalid( |
| | 199 | _(u'Please specify the path of the password source')) |
| | 200 | elif obj.attachPasswordSource == PWD_MANUAL: |
| | 201 | if not obj.attachPassword: |
| | 202 | raise interface.Invalid( |
| | 203 | _(u'Please specify an attach password')) |
| | 204 | |