Not from tryton. But you can use grep [1] or ack [2]
>
> 2)I tried to use print for debug (i know is not professional but for
> learning purpose is ok)
I use that for debug also and it is professional and even faster then
any debuger :-)
> and i noticed a strange behaviour
> i put a print "step1" in write function of the address.py.
> then i started the server,started the client,upgraded the party module
> and created a new address but
> on the server console i did not noticed anything,second time when i
> added a new item i saw the "step1"
> very easy to reproduce ,have any ideea why ?
You must save the party to have the addresses saved.
[1] http://unixhelp.ed.ac.uk/CGI/man-cgi?grep
[2] http://petdance.com/ack/
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email: cedric...@b2ck.com
Jabber: cedric...@b2ck.com
Website: http://www.b2ck.com/
Because it is not the purpose of the application.
>
> 2) I spoke with Carlos and he told me that is not good to use print
> since there are some buffers
> and the print is not show imeddiately only when the buffers are empty
> and for emptying them some specila coding is needed.
> He recommended to me to use import pdb and pdb.set_trace() then i get
> the console.
I never had any issue to use print statement.
>
> 3) ids may be something like [1,2,3,4,5,6] ? or it may be simple 1 so
> it is converted to [1]
> Now why this is not handled before calling the method ?
Because anybody can call this function.
> How come is possible to get only a number and not a list ?
This make it more generic.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
But you can not. There is some tools to search for the function string
in the code like grep, ack.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Yes, otherwise you can not loop on the browse because you will receive
only one BrowseRecord instead of BrowseRecordList
>
> just to undersand better : in what use case ids=[ids] is executed as
> and when not ?
>
> when id is a int and when id is a list ?
>
> from client what do i have to do to have secnario1 when id is an int
>
> and what do i have to do to have the scenario2 when id is a list
>
It is a coding guidelines, function that use ids must handle both case
single int or list of int.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
cristi>
cristi> Ok i got it.
cristi>
cristi> Now the final question i hope related to this issue:
cristi>
cristi>
cristi> when ids is a list in this particular case of write on address.py.
cristi>
cristi> So what do i have to do in order to get a list of ids like [1,2,3,4] ?
cristi>
cristi> where do i have to go in the client and what to do in order to have a
cristi> list not a single int
cristi> ?
cristi>
cristi> thx
cristi> On 15 Ian, 16:44, Cédric Krier <cedric.kr...@b2ck.com> wrote:
cristi> > On 15/01/09 06:04 -0800, cristi wrote:
cristi> >
cristi> >
cristi> >
cristi> >
cristi> >
cristi> >
cristi> >
cristi> > > def write(self, cursor, user, ids, vals,
cristi> > > context=None):
cristi> > > if 'party' in vals:
cristi> > > if isinstance(ids, (int, long)):
cristi> > > ids = [ids]
cristi> > > for address in self.browse(cursor, user, ids,
cristi> > > context=context):
cristi> > > if address.party.id != vals['party']:
cristi> > > self.raise_user_error(cursor, 'write_party',
cristi> > > context=context)
cristi> > > return super(Address, self).write(cursor, user, ids, vals,
cristi> > > context=context)
cristi> >
cristi> > > is necesarry to do the if isinstance(ids, (int, long)): ?
cristi> >
cristi> > Yes, otherwise you can not loop on the browse because you will receive
cristi> > only one BrowseRecord instead of BrowseRecordList
cristi> >
cristi> >
cristi> >
cristi> > > just to undersand better : in what use case ids=[ids] is executed as
cristi> > > and when not ?
cristi> >
cristi> > > when id is a int and when id is a list ?
cristi> >
cristi> > > from client what do i have to do to have secnario1 when id is an int
cristi> >
cristi> > > and what do i have to do to have the scenario2 when id is a list
cristi> >
cristi> > It is a coding guidelines, function that use ids must handle both case
cristi> > single int or list of int.
cristi> >
cristi> > --
cristi> > Cédric Krier
cristi> >
cristi> > B2CK SPRL
cristi> > Rue de Rotterdam, 4
cristi> > 4000 Liège
cristi> > Belgium
cristi> > Tel: +32 472 54 46 59
cristi> > Email: cedric.kr...@b2ck.com
cristi> > Jabber: cedric.kr...@b2ck.com
cristi> > Website:http://www.b2ck.com/
cristi> >
cristi> > application_pgp-signature_part
cristi> > < 1 KVedeţiDescărcaţi- Ascunde citatul -
cristi> >
cristi> > - Afişare text în citat -
cristi> --~--~---------~--~----~------------~-------~--~----~
cristi> try...@googlegroups.com mailing list
cristi> -~----------~----~----~----~------~----~------~--~---
cristi>
--
Recomiendo Postgresql, el sistema manejador de bases de datos
http://www.postgresql.org
Am Donnerstag, den 15.01.2009, 06:50 -0800 schrieb cristi:
> when ids is a list in this particular case of write on address.py.
> So what do i have to do in order to get a list of ids like [1,2,3,4] ?
The check if ids is a list is to be sure that all other models
which (will possibly) inherit Address later are correct programmed.
The methods in party.address model always creating a list for ids,
even if there is only one value inside.
So its just to make the use of the class Address hardened against
programming mistakes in other modules. (Hope that's correct)
One power of Python is that variable typing is 'weak' and not strong:
http://www.artima.com/intv/strongweak.html
> where do i have to go in the client and what to do in order to have a
> list not a single int
> ?
In a list view for example you can select many records. When you click
on an action button, the ids of the selected records are 'transported'
in the 'ids' variable of the caller of the action method.
Cheers Udo
It is more a will to be more flexible.
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59