[python-win32] translating VB into Python...

Michael March mmarch at gmail.com
Wed May 16 17:01:08 CEST 2007


Hurray!!!!!!!!

>>> mybug=bfact.Item(24)

>>> mybug.Field("BG_DESCRIPTION")
u'Test Set: Mercury Tours UI\nTest: [1]Welcome Page\nRun: Run_9-11_11-43-36\nSte
p: Verify Tag Properties\n\nDescription:\n1. Click the "Find Next" button.\n2. V
erify <WIDTH, HEIGHT and ALT> properties for the tag.\n\nExpected result:\n<The
WIDTH and HEIGHT properties should be set to numeric values. The ALT property sh
ould define a text alternative to the graphic.>\n\nActual Result:\nIMG tags have
 no these attributes on all HTML pages of the Mercury Tours site.'

>>> mybug.SetField("BG_DESCRIPTION", "123")

>>> mybug.Field("BG_DESCRIPTION")
u'123'

>>> mybug.Post()


On 5/16/07, Graham Bloice <graham.bloice at trihedral.com> wrote:
> Tim Golden wrote:
> > Michael March wrote:
> >> [resend - I think the mailing list ate my last post..]
> >
> > I saw it! But no matter, the web link's useful. I imagine
> > Mark's hitting the sack about now (assuming he's in
> > Australia). It's 3pm here in the UK so I'll try to see
> > if I can spot what's happening, but from a glance at
> > the generated code, it looks like one of those awkward
> > cases where a method is also a property and *also* the
> > default value. I'll try and have a go at it.
> >
>
> Looking at the makepy output isn't this a case where pywin32 has to use
> a method to access an indexed property using a "SetXXX" call.
>
> From the makepy:
>
> class IBug(DispatchBaseClass):
>         """Represents a defect."""
>         CLSID = IID('{2AF970F7-6CCC-4DFB-AA78-08F689481F94}')
>         coclass_clsid = IID('{AF9180F9-8C16-4824-9EA1-A9010B072B2C}')
>
>         # The method Field is actually a property, but must be used as a method
> to correctly pass the arguments
>         def Field(self, FieldName=defaultNamedNotOptArg):
>                 """The value of the specified field."""
>                 return self._ApplyTypes_(0, 2, (12, 0), ((8, 0),),                                      'Field',
> None,FieldName)
>
> ...
>
>         # The method SetField is actually a property, but must be used as a
> method to correctly pass the arguments
>         def SetField(self, FieldName=defaultNamedNotOptArg,
> arg1=defaultUnnamedArg):
>                 """The value of the specified field."""
>                 return self._oleobj_.InvokeTypes(0, LCID, 4, (24, 0),                                   ((8, 0),
> (12, 1)),FieldName, arg1)
>
>
> So try using:
>
> mybug.SetField("BG_DESCRIPTION", "123")
>
> --
> Regards,
>
> Graham Bloice
>


-- 
<admiral>

Michael F. March ----- mmarch at gmail.com
Ph: (415)462-1910 ---- Fax: (602)296-0400
P.O. Box 2254 ---- Phoenix, AZ 85002-2254
          "Seriously" - HSR


More information about the Python-win32 mailing list