Larry Bradley wrote:
> I'm having trouble handling a no record found condition from a requery.
>
> I have the following code in a in a form, which gets called when I click in
> a button:
>
> def Test(self):
> membernum = self.MemberNum
> self.bo.setParams(membernum)
> try:
> self.bo.requery()
> except NoRecordsException:
> dabo.ui.exclaim("Not found")
>
> dabo.ui.info(self.bo.Record.surname)
>
>
> What I'm trying to do is catch the case where the query failed to return
> any results. "bo" is the bizobject.
>
> I've tried a gaggle of things in the "except" clause, such as
>
> except dException.NoRecordsException:
>
> except self.bo.dException.NoRecordsException:
>
> I always get this:
>
> File "c:\dabo\dabo\db\dCursorMixin.py", line 703, in getFieldVal
> raise dException.NoRecordsException, _("No records in the data set.")
> NoRecordsException: No records in the data set.
Your problem is that requery() doesn't raise the NoRecordsException.
Trying to get a current field value from a dataset with no records does.
--
pkm ~ http://paulmcnett.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]