gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUe-dev] Recent Changes in Appserver


From: Johannes Vetter
Subject: [GNUe-dev] Recent Changes in Appserver
Date: Fri, 14 Jan 2005 09:41:05 +0100

Hi,

There has been a major change to appserver today, so please to some
extra testing with your projects before updating production
environments ... :)

The way how appserver joins tables
-----------------------------------

This has changed from an inner to an outer join.
The following request ():

request ('address_person', [], [], ['address_name',
'address_country.address_name'])

would have returned only those persons who's country-reference is *NOT*
NULL, silently ignoring all the rest. Doing the same request () now,
will return *all* persons (since there's no restrictive condition at
all) but having a country set to None for those missing it.


Life's a bit easier with langauge-interface now
-----------------------------------------------

using appserver's langauge-interface you can do the following piece of
code now, without getting an exception:

guys = find ('address_person', [], [], ['address_name',
'address_country.address_name'])

for guy in guys: 
  print guy.name, guy.country.name

where you will get an empty (NullObject) result for all missing refs.
Such a NullObject behaves very much like python's native None-Type does:

if x:
  print "value of x is not None"
x == None  --> True
cmp (x, None) --> True

Most notable difference is that you cannot do "x is None" which isn't
True. The point is, that you can access longer chains of indirect
properties and you don't have to bother wether a part in the middle is
now. 

so: guy.country.name is either the name of the country of empty
(NullObject) if there is no country referenced. You does *not* get an
AttributeError: NoneType has no attribute 'name'


Thanks,
Johannes

-- 
BYTEWISE Software GmbH          Tel +43 (5577) 89877-0
i.A. Johannes Vetter            Fax +43 (5577) 89877-66
A-6890 Lustenau, Enga 2         http://www.bytewise.at
-------------------------------------------------------
Wir bieten die Installation von Debian GNU/Linux auf
Servern für kleinere Netzwerke zum Pauschalpreis an.
Mehr dazu unter http://www.bytewise.at/texte/pl-debian

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]