[Tutor] Linear programming - is it bad?

Vsevolod Sipakov python-tutor at vs.megalink.ru
Wed Aug 11 02:55:52 CEST 2004


Hello,

On Mon, Aug 09, 2004 at 05:22:21PM -0700, Danny Yoo wrote:
> Ack!  I didn't see that the default values for all but the AutoAdminLogon
> were the empty string, and not zero.  Let me fix this.
> 
> ###
> def queryForValue(reg, name, defaultValue=""):
>     try:
>         values = QueryValueEx(reg, name)
>         return values[0]
>     except WindowsError:
>         print "Error:", name, "string missing from registry:",
>         print "creating default value:", defaultValue
>         nothing = SetValueEx(reg, name, 0, REG_SZ, defaultValue)
>         return "0"

I think this function should return defaultValue too :-)

> regusername = queryForValue(reg, "DefaultUserName")
> regusername = queryForValue(reg, "DefaultUserName")
> regpassword = queryForValue(reg, "DefaultPassword")
> regdomain = queryForValue(reg, "DefaultDomainName")
> regautolog = queryForValue(reg, "AutoAdminLogon", "0")
> ###
> 

-- 
Vsevolod Sipakov


More information about the Tutor mailing list