[web2py] Re: Remove link in MENU for current url

2010-10-30 Thread annet
Does this mean that the current menu's behaviour will change, or is
this patch optional?

Currently, I just style active links differently, and that works fine.
I have seen people who work with different browsers on different OS
use the active menu link to refresh the current page. Basically
because the menu link is closer to where the mouse pointer is, and
because the menu link is always on the same position in the window.
Safari has its refresh "button" to the right of the URL, in Firefox
it's the first button in a row of three to the left of the URL.


Kind regards,

Annet.


[web2py] Re: Reference to the mapping table - No drop down in admin interface

2010-10-30 Thread Steve
Cool. But I am new to both python and web2py. I did something like

def showABName(r):
a_row = db.table_a[r.a_id]
b_row = db.table_b[r.b_id]
return a_row.name[0:20] + '-' + b_row.name

and in the table definition

db.define_table('a_b',
Field('a_id', db.table_a),
Field('b_id', db.table_b),
Field('displayorder', 'integer', required=True),
format=lambda r : showABName(r))

It worked!!! But I am sure there is a simpler way. Also I am not sure
why I couldn't call the showName() directly with r argument. It gives
me an error. Probably another python thing I don't know.

Anyway thanks a lot.

Thanks,
Steve

On Oct 30, 4:06 am, mdipierro  wrote:
> format can be a function that takes the record returns a string.
>
> On Oct 29, 4:05 pm, Steve  wrote:
>
> > Hi all,
>
> > I am able to solve the issue.
>
> > I just removed the following line.
>
> > db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b)
>
> > Now, I am getting the drop down. But the drop down shows the id of
> > 'a_b' table. But ideally I would like the combination of a.name and
> > b.name in the drop
> > down for 'a_b_id' in the 'table_c'.
>
> > By changing the format of 'a_b' as '%(a_id)s - %(b_id)s', I am able to
> > show the ids combination. But I want to show the name combination to
> > make the drop down more meaningful.
>
> > Thanks,
> > Steve.
>
> > On Oct 29, 6:46 pm, Steve  wrote:
>
> > > Hi,
>
> > > I have the following table structure in my db.py.
>
> > > db.define_table('table_a',
> > >     Field('x_id', db.table_x),
> > >     Field('name', length=200, required=True),
> > >     Field('description', length=300),
> > >     Field('displayorder', 'integer', required=True),
> > >     format='%(name)s')
>
> > > db.define_table('table_b',
> > >     Field('name', length=45, required=True),
> > >     Field('description', length=200),
> > >     format='%(name)s')
>
> > > db.define_table('a_b',
> > >     Field('a_id', db.table_a),
> > >     Field('b_id', db.table_b),
> > >     Field('displayorder', 'integer', required=True),
> > >     format='%(id)s')
>
> > > db.define_table('user',
> > >     Field('user_id', 'integer', required=True),
> > >     Field('name', length=60, required=True),
> > >     format='%(name)s')
>
> > > db.define_table('table_c',
> > >     Field('a_b_id', db.a_b),
> > >     Field('user_id', db.user),
> > >     Field('content', 'text', required=True),
> > >     Field('content', 'text', required=True))
>
> > > db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b)
>
> > > Here, 'table_a' and 'table_b' have many to many mapping. Table 'a_b'
> > > is the mapping table. Now in
> > > 'table_c', I am referring to table 'a_b'. (the mapping table)
>
> > > While inserting into 'table_c', I am not getting the drop down for the
> > > 'a_b_id' column. But for the 'user_id' column, I am getting the drop
> > > down. I am not sure where things are going wrong. Any help is
> > > appreciated.
>
> > > Ideally I would like the combination of a.name and b.name in the drop
> > > down for 'a_b_id' in the 'table_c'
>
> > > By the way, web2py is an amazing piece of work. So far my experience
> > > has been great.
>
> > > Thanks,
> > > Steve.
>
>


[web2py] Newb question: How to handle multiple controller levels?

2010-10-30 Thread Tom Campbell
I have an app that supports multiple organizations.
Each organization has many customers.
Each customer has many appointments.

I think that means organizations, while controllers, employ a customer
controller, which employes an appointment controller.

In my head the URL for editing an appointment should therefore look
like this:

 /hostname/organization/5/customer/2/appointment/edit/9

This kind of organization also lets one bookmark an action or record
easily.

I am doing multiple things wrong, of course, but I don’t know exactly
what. Can someone explain at a high level what I should correct,
ideally some documentation somewhere? I have been reading the 3rd
edition section 4.2 but am stuck. Thanks!


[web2py] bug on IS_NOT_EMPTY(..)?

2010-10-30 Thread Marco Prosperi
hi all,

With web2py 1.88.* if you define something like
..
Field('myfield','string',requires=IS_NOT_EMPTY(error_message=T('my
message')),
..

you don't get 'my message' after submitting an empty a SQLFORM (yes, I
use if form.accepts...) but the default message. With older versions
of web2py there is no problem (for example 1.167.2)

I think this is connected to the same problem noticed in my other post
'bug or backward incompatibility for datetime fields' on October, 23

Marco


[web2py] Re: Newb question: How to handle multiple controller levels?

2010-10-30 Thread Tom Campbell
Never mind. Crushingly brilliant chap that I am, immediately after
posting that I realized I have the luxury of constructions like:

  _href=URL('appointment','edit',args=[customer,appointment]))


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
Interesting ...
as I want to migrate to web2py
and want to have some kind of DAL for my desktop applications,
this sounds very good.

Can you give me some guide lines, how to use the web2py DAL for desktop 
applications ?

thanks,
Stef Mientki


On 19-10-2010 05:44, Bruno Rocha wrote:
> I know DAL was not made for that, but I'm using the DAL in a desktop 
> application with PyGTK, and
> it is working very well :-)
>
> It is a simple application that monitors the presence of employees in a 
> company and reads small
> CSV files from a time clock,
> people has cards that open the gates/doors of the company factory, I use a 
> stream to read the
> track from serial port of time clock,
> then, I take the information serialized as CSV, I parse and write it into 
> SQLite db, after that ,
> the Janitor uses a PyGTK app to access that information.
>
> already been running for about 6 months, So far everything is working fine, 
> but I can not run the
> automatic migrations.
>
> Does anyone know a way to make migration work automatically with DAL Stand 
> Alone?
>
> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing 
> and doing out any crud
> operation.
>
> The only thing missing is to make migration works.
>
> I already set migrate='Mytable.table' and I tried with migrate=True
>
> 
> An example of what I have working in my 
>
> "connect.py"
> >>> from gluon.sql import *
> >>> db = DAL('sqlite://timeclock1.db')
> >>> Track =
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>
> "Form_workflow.py"
> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
> 1
> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
> 2
> >>> db.commit
>
> Until here, its ok.
>
> But now I am wanting to change the model, and including Field('department')
>
> "connect.py"
> >>> Track =
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),*Field('department')*,migrate='track.table')
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
> raise SyntaxError, 'invalid table name: %s' % tablename
> SyntaxError: invalid table name: track
> >>> 
>
> 
>
> If this is not possible, I'll have to create new fields in SQLite and then 
> update my model. 



Re: [web2py] Newb question: How to handle multiple controller levels?

2010-10-30 Thread Kenneth Lundström
I have a controller for different levels, org, customer, appointment and so on.

When i want to for example edit a customer the address looks like 
/hostname/customer/edit/5/2 where 5 is the org and 2 is the customer.

Appointment would look like /hostname/appointment/5/2/10 where 10 is the id of 
the appontment. 5 and 2 are not exactly neccesary as all appointments have a 
unique id, but often it is good to have them in the address. If nothing else it 
is good to allways use the same syntax.


Kenneth


- Alkuperäinen viesti -
> I have an app that supports multiple organizations.
> Each organization has many customers.
> Each customer has many appointments.
> 
> I think that means organizations, while controllers, employ a customer
> controller, which employes an appointment controller.
> 
> In my head the URL for editing an appointment should therefore look
> like this:
> 
>           /hostname/organization/5/customer/2/appointment/edit/9
> 
> This kind of organization also lets one bookmark an action or record
> easily.
> 
> I am doing multiple things wrong, of course, but I don’t know exactly
> what. Can someone explain at a high level what I should correct,
> ideally some documentation somewhere? I have been reading the 3rd
> edition section 4.2 but am stuck. Thanks!



[web2py] bug on IS_NOT_EMPTY(..)?

2010-10-30 Thread Marco Prosperi
hi all,

With web2py 1.88.* if you define something like
..
Field('myfield','string',requires=IS_NOT_EMPTY(error_message=T('my
message')),
..

you don't get 'my message' after submitting an empty a SQLFORM (yes, I
use if form.accepts...) but the default message. With older versions
of web2py there is no problem (for example 1.167.2)

I think this is connected to the same problem noticed in my other post
'bug or backward incompatibility for datetime fields' on October, 23

Marco


Re: [web2py] Re: PostgreSQL super slowdowns

2010-10-30 Thread Thadeus Burgess
I guess its a problem with a postgresql setting, or old drivers maybe?

--
Thadeus




On Sat, Oct 30, 2010 at 12:45 AM, Chris  wrote:

> I was just trying the home page...some selects are run on every page
> but as far as I know that's it. The machine's got plenty of memory and
> this is a very basic application with probably less than 1MB data
> total.
>
> On Oct 29, 7:59 am, Johann Spies  wrote:
> > On 29 October 2010 08:53, Chris  wrote:
> >
> > > Hey,
> >
> > > I've noticed some serious slowdowns ever since I switched from SQLite
> > > to Postgres. Pages will take MINUTES to load - it's kind of
> > > fascinating.
> >
> > I have been using both SQLITE and Postgresql (sometimes with the same
> > content) and did not notice a slowdown.  Some of my datasets are quite
> > large (a dump of a present project's database is about 3G) and I don't
> > experience any problem on Postgresql.
> >
> > What exactly were you doing when you noticed this?  Inserts?  Queries?
> >  CSV-downloads?   How much data?  How much ram available?
> >
> > Regards
> > Johann
> >
> > --
> >  May grace and peace be yours in abundance through the full knowledge
> > of God and of Jesus our Lord!  His divine power has given us
> > everything we need for life and godliness through the full knowledge
> > of the one who called us by his own glory and excellence.
> > 2 Pet. 1:2b,3a
>


[web2py] Book 3rd Edition, Lulu Printed Copy, comments

2010-10-30 Thread cjrh
Hi

My new printed copy of the third edition of the book arrived a few
days ago (took almost 2 months to find me!).

Comments:

- It's my first Lulu purchase.  The quality is as good as or even
better than expected.

- The new dark default theme for web2py does not reproduce well in the
book.  The screen dumps are too dark.  That may be something to
consider changing for the 4th edition.

- The code snippets have a dark shaded background in the book, but IMO
the appearance of the code snippets in the online version of the book
is far superior, i.e. clear background but with a significant indent.

- The table of contents needs to lose the large line spacing.

- The index could be more comprehensive.

Besides these nitpicks, very nice!


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread rochacbruno
Look this simple example:

http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py


I have a PyGTK app running very well, I will put the code online soon.



Em 30/10/2010, às 06:33, Stef Mientki  escreveu:

> Interesting ...
> as I want to migrate to web2py
> and want to have some kind of DAL for my desktop applications,
> this sounds very good.
> 
> Can you give me some guide lines, how to use the web2py DAL for desktop 
> applications ?
> 
> thanks,
> Stef Mientki
> 
> 
> On 19-10-2010 05:44, Bruno Rocha wrote:
>> 
>> I know DAL was not made for that, but I'm using the DAL in a desktop 
>> application with PyGTK, and it is working very well :-)
>> 
>> It is a simple application that monitors the presence of employees   in 
>> a company and reads small CSV files from a time clock,
>> people has cards that open the gates/doors of the company factory, I use a 
>> stream to read the track from serial port of time clock,
>> then, I take the information serialized as CSV, I parse and write it into 
>> SQLite db, after that , the Janitor uses a PyGTK app to access that 
>> information.
>> 
>> already been running for about 6 months, So far everything is working fine, 
>> but I can not run the automatic migrations.
>> 
>> Does anyone know a way to make migration work automatically with DAL Stand 
>> Alone?
>> 
>> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing 
>> and doing out any crud operation.
>> 
>> The only thing missing is to make migration works.
>> 
>> I already set migrate='Mytable.table' and I tried with migrate=True
>> 
>> 
>> An example of what I have working in my 
>> 
>> "connect.py"
>> >>> from gluon.sql import *
>> >>> db = DAL('sqlite://timeclock1.db')
>> >>> Track = 
>> >>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>> 
>> "Form_workflow.py"
>> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
>> 1
>> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
>> 2
>> >>> db.commit
>> 
>> Until here, its ok.
>> 
>> But now I am wanting to change the model, and including Field('department')
>> 
>> "connect.py"
>> >>> Track = 
>> >>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),Field('department'),migrate='track.table')
>> 
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
>> raise SyntaxError, 'invalid table name: %s' % tablename
>> SyntaxError: invalid table name: track
>> >>> 
>> 
>> 
>> 
>> If this is not possible, I'll have to create new fields in SQLite and then 
>> update my model.
> 


[web2py] Reloading components at regular intervals

2010-10-30 Thread Luther Goh Lu Feng
I would like to reload a web2py component at regular intervals. Based
on my understanding of the documentation, I believe that currently
there is no way to do it without writing my own javascript. (Glad to
be proven wrong though).

I think this feature might be useful and hope that it can be
considered for addition to web2py.


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
thanks Bruno,

seems like a good starting point.

cheers,
Stef

On 30-10-2010 12:06, rochacbruno wrote:
> Look this simple example:
>
> http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py
>
>
> I have a PyGTK app running very well, I will put the code online soon.
>
>
>
> Em 30/10/2010, às 06:33, Stef Mientki  >
> escreveu:
>
>> Interesting ...
>> as I want to migrate to web2py
>> and want to have some kind of DAL for my desktop applications,
>> this sounds very good.
>>
>> Can you give me some guide lines, how to use the web2py DAL for desktop 
>> applications ?
>>
>> thanks,
>> Stef Mientki
>>
>>
>> On 19-10-2010 05:44, Bruno Rocha wrote:
>>> I know DAL was not made for that, but I'm using the DAL in a desktop 
>>> application with PyGTK, and
>>> it is working very well :-)
>>>
>>> It is a simple application that monitors the presence of employees in a 
>>> company and reads small
>>> CSV files from a time clock,
>>> people has cards that open the gates/doors of the company factory, I use a 
>>> stream to read the
>>> track from serial port of time clock,
>>> then, I take the information serialized as CSV, I parse and write it into 
>>> SQLite db, after that
>>> , the Janitor uses a PyGTK app to access that information.
>>>
>>> already been running for about 6 months, So far everything is working fine, 
>>> but I can not run
>>> the automatic migrations.
>>>
>>> Does anyone know a way to make migration work automatically with DAL Stand 
>>> Alone?
>>>
>>> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing 
>>> and doing out any
>>> crud operation.
>>>
>>> The only thing missing is to make migration works.
>>>
>>> I already set migrate='Mytable.table' and I tried with migrate=True
>>>
>>> 
>>> An example of what I have working in my 
>>>
>>> "connect.py"
>>> >>> from gluon.sql import *
>>> >>> db = DAL('sqlite://timeclock1.db')
>>> >>> Track =
>>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>>>
>>> "Form_workflow.py"
>>> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
>>> 1
>>> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
>>> 2
>>> >>> db.commit
>>>
>>> Until here, its ok.
>>>
>>> But now I am wanting to change the model, and including Field('department')
>>>
>>> "connect.py"
>>> >>> Track =
>>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),*Field('department')*,migrate='track.table')
>>>
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
>>> raise SyntaxError, 'invalid table name: %s' % tablename
>>> SyntaxError: invalid table name: track
>>> >>> 
>>>
>>> 
>>>
>>> If this is not possible, I'll have to create new fields in SQLite and then 
>>> update my model. 
>>



[web2py] Re: web2py automatic installation on KingHost(Brazil) control panel.

2010-10-30 Thread mdipierro
+1

On Oct 29, 10:38 pm, Bruno Rocha  wrote:
> Brazilian KingHost server now has web2py as an option for automatic
> installation on your control panel.
>
> According to information from the administrators of the host, many customers
> were starting to ask for the installation of web2py, and some later canceled
> the plan, citing difficulties in publishing their websites developed with
> web2py.
>
> Now web2py is included as an option in the automatic WSGI installer,
> together with Django, Pylons, TurboGears and web.py.
>
> http://www.kinghost.com.br/promo/WEB2PYKINGHOST.html
>
> ---
>
> Servidor de hospedagem brasileiro KingHost agora tem web2py como opção para
> instalação automática em seu painel de controle.
>
> De acordo com as informações dos administradores do host, muitos clientes
> estavam começando a pedir a instalação do web2py, e alguns acabaram
> cancelando o plano, alegando dificuldades para publicar seus sites
> desenvolvidos com web2py.
>
> Agora incluiram web2py como opção no instalador WSGI automático juntamente
> com o Django, Pylons, TurboGears e web.py.
>
> http://www.kinghost.com.br/promo/WEB2PYKINGHOST.html
>
> Código promocional WEB2PYKINGHOST 6 meses com 10% de desconto!
>
> ---


[web2py] Re: Remove link in MENU for current url

2010-10-30 Thread mdipierro
oops. I did not receive it. I will apply it asap.

On Oct 29, 10:01 am, Michael Wolfe 
wrote:
> Massimo,
>
> I tried sending this patch directly to you, but I'm not sure if you
> received it.  In any case, I re-exported the patch this morning so it
> runs against trunk.
>
> Let me know if I've missed something or if you've decided to hold this
> out of the framework.  I won't be offended either way.
>
> Thanks,
> Mike
>
> On Fri, Oct 22, 2010 at 4:38 PM, mdipierro  wrote:
> > Can you please email me the patch? thanks.
>
> > On Oct 22, 3:08 pm, Michael Wolfe 
> > wrote:
> >> Following the sage advice of Jakob Nielsen, I wanted a way to turn off
> >> links that point to the current page within the menu (see #10 
> >> here:http://www.useit.com/alertbox/20031110.html).  At the bottom of this
> >> e-mail, I'm including a proposed patch that would make this easier.
>
> >> I've added two optional parameters to the MENU helper: no_link_url and
> >> active_url.
>
> >> To illustrate how this works, I'll give three examples of what you
> >> would see for the Index link in the welcome scaffolding app by
> >> altering the MENU line from layout.html.
>
> >> 1. Current behavior
> >> {{=MENU(response.menu,_class='sf-menu')}}
> >> Index
>
> >> 2. Removing the link for the current page
> >> {{=MENU(response.menu,_class='sf-menu',no_link_url=request.url)}}
> >> Index
>
> >> 3. Adding the class 'active' to the list item of the link to the current 
> >> page
> >> {{=MENU(response.menu,_class='sf-menu',active_url=request.url,
> >> li_active='active')}}
> >> Index
>
> >> And here's the patch.  Please let me know if I've missed something.
>
> >> diff -r 6608e0e6b4f3 -r badb5215df3f applications/welcome/static/base.css
> >> --- a/applications/welcome/static/base.css      Fri Oct 15 07:17:35 2010 
> >> -0500
> >> +++ b/applications/welcome/static/base.css      Fri Oct 22 15:11:06 2010 
> >> -0400
> >> @@ -216,9 +216,12 @@
> >>  .sf-menu {
> >>         float:  left;
> >>  }
> >> -.sf-menu a {
> >> +.sf-menu a, .sf-menu div {
> >>         padding: 5px 15px;
> >>  }
> >> +.sf-menu div {
> >> +        color: white;
> >> +}
> >>  .sf-menu li {
> >>         background: #33;
> >>  }
> >> diff -r 6608e0e6b4f3 -r badb5215df3f gluon/html.py
> >> --- a/gluon/html.py     Fri Oct 15 07:17:35 2010 -0500
> >> +++ b/gluon/html.py     Fri Oct 22 15:11:06 2010 -0400
> >> @@ -1699,14 +1699,16 @@
> >>              ul = UL(_class=self['ul_class'])
> >>          for item in data:
> >>              (name, active, link) = item[:3]
> >> -            if link:
> >> +            if 'no_link_url' in self.attributes and 
> >> self['no_link_url']==link:
> >> +                li = LI(DIV(name))
> >> +            elif link:
> >>                  li = LI(A(name, _href=link))
> >>              else:
> >>                  li = LI(A(name, _href='#null'))
> >>              if len(item) > 3 and item[3]:
> >>                  li['_class'] = self['li_class']
> >>                  li.append(self.serialize(item[3], level+1))
> >> -            if active:
> >> +            if active or 'active_url' in self.attributes and
> >> self['active_url']==link:
> >>                  if li['_class']:
> >>                      li['_class'] = li['_class']+' '+self['li_active']
> >>                  else:
>
>
>
>  web2py_rev1091.patch
> 2KViewDownload


[web2py] Re: bug on IS_NOT_EMPTY(..)?

2010-10-30 Thread mdipierro
I cannot reproduce the problem. Can you post a simple app to reproduce
it?

On Oct 30, 3:17 am, Marco Prosperi  wrote:
> hi all,
>
> With web2py 1.88.* if you define something like
> ..
> Field('myfield','string',requires=IS_NOT_EMPTY(error_message=T('my
> message')),
> ..
>
> you don't get 'my message' after submitting an empty a SQLFORM (yes, I
> use if form.accepts...) but the default message. With older versions
> of web2py there is no problem (for example 1.167.2)
>
> I think this is connected to the same problem noticed in my other post
> 'bug or backward incompatibility for datetime fields' on October, 23
>
> Marco


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
On 30-10-2010 12:06, rochacbruno wrote:
> Look this simple example:
>
> http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py
>
>
> I have a PyGTK app running very well, I will put the code online soon.
hi Bruno,

one other question,
in the gtk application,
do you access the database through a local server,
or direct through a local disk location ?
And in the latter case, how do you specify a hard disk location ?

thanks,
Stef
>
>
>
> Em 30/10/2010, às 06:33, Stef Mientki  >
> escreveu:
>
>> Interesting ...
>> as I want to migrate to web2py
>> and want to have some kind of DAL for my desktop applications,
>> this sounds very good.
>>
>> Can you give me some guide lines, how to use the web2py DAL for desktop 
>> applications ?
>>
>> thanks,
>> Stef Mientki
>>
>>
>> On 19-10-2010 05:44, Bruno Rocha wrote:
>>> I know DAL was not made for that, but I'm using the DAL in a desktop 
>>> application with PyGTK, and
>>> it is working very well :-)
>>>
>>> It is a simple application that monitors the presence of employees in a 
>>> company and reads small
>>> CSV files from a time clock,
>>> people has cards that open the gates/doors of the company factory, I use a 
>>> stream to read the
>>> track from serial port of time clock,
>>> then, I take the information serialized as CSV, I parse and write it into 
>>> SQLite db, after that
>>> , the Janitor uses a PyGTK app to access that information.
>>>
>>> already been running for about 6 months, So far everything is working fine, 
>>> but I can not run
>>> the automatic migrations.
>>>
>>> Does anyone know a way to make migration work automatically with DAL Stand 
>>> Alone?
>>>
>>> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing 
>>> and doing out any
>>> crud operation.
>>>
>>> The only thing missing is to make migration works.
>>>
>>> I already set migrate='Mytable.table' and I tried with migrate=True
>>>
>>> 
>>> An example of what I have working in my 
>>>
>>> "connect.py"
>>> >>> from gluon.sql import *
>>> >>> db = DAL('sqlite://timeclock1.db')
>>> >>> Track =
>>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>>>
>>> "Form_workflow.py"
>>> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
>>> 1
>>> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
>>> 2
>>> >>> db.commit
>>>
>>> Until here, its ok.
>>>
>>> But now I am wanting to change the model, and including Field('department')
>>>
>>> "connect.py"
>>> >>> Track =
>>> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),*Field('department')*,migrate='track.table')
>>>
>>> Traceback (most recent call last):
>>>   File "", line 1, in 
>>>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
>>> raise SyntaxError, 'invalid table name: %s' % tablename
>>> SyntaxError: invalid table name: track
>>> >>> 
>>>
>>> 
>>>
>>> If this is not possible, I'll have to create new fields in SQLite and then 
>>> update my model. 
>>



[web2py] link to "object" on same web page

2010-10-30 Thread Ole Martin Mæland

Hi,

I am new to web2py and I am trying to learn via doing. I am looking at 
the crm soluiton that Massimo has written.


I would like to trigger a task list on the same page as I have 
company_view and person list.


currently my main_company object looks like this:

def main_company():
company_id = request.args(0)
company = db.company[company_id] or redirect(error_page)
db.person.company.default=company_id
db.person.company.writable = False
db.person.company.readable = False
pform = crud.create(db.person)
persons=db(db.person.company==company_id)\
.select(orderby=db.person.name)
return dict(company=company, persons=persons, pform=pform)

and my edit_task :


def edit_task():
task_id=request.args(0)
task=db.task[task_id] or redirect(error_page)
person=db.person[task.person]
db.task.person.writable=db.task.person.readable=False
form=crud.update(db.task,task,next='view_task/[id]')
return dict(form=form, person=person)

on the html page I have a link button to the edit_task page, but I would 
like to have "that page" on the main_company page.


any solution ??

Thanks in advance.

Ole Martin





[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread yamandu
Still an issue with list:string.

Whem the update form loads it´s normal.
When I submit it and back to it the list:string fields display as
['string','string'].
Maybe because I loading the update form via LOAD function without
ajax.
I tested list:string with the wizard and it works perfectly.

On Oct 30, 1:41 am, Thadeus Burgess  wrote:
> Can we make some sort of massive web2py app that makes use of every single
> feature in web2py (as much as possible). If the index page of the app
> returns OK then everything is working. ???
>
> Kind of like a unit test without a unit test.
>
> --
> Thadeus
>
> On Fri, Oct 29, 2010 at 6:05 PM, mdipierro  wrote:
> > Normally it goes to the nightly build, perhaps not exactly the latest
> > but something very close. The bug in question has been there for about
> > one week. The problem is that nobody tests the nightly build.
>
> > Massimo
>
> > On Oct 29, 5:32 pm, Bruno Rocha  wrote:
> > > I have a question:
>
> > > From "Trunk" it is going directly to "Stable", or is passing throught
> > > "Nighly Built" for testing before going Stable?
>
> > > What is the roadmap/timeline for release cycle?
>
> > > 2010/10/29 Branko Vukelic 
>
> > > > On Sat, Oct 30, 2010 at 12:05 AM, mdipierro 
> > > > wrote:
> > > > > Fixed. 1.88.2 but please check it
>
> > > > Woah! Two releases in a few hours! :D
>
> > > > --
> > > > Branko Vukelić
>
> > > > bg.bra...@gmail.com
> > > > stu...@brankovukelic.com
>
> > > > Check out my blog:http://www.brankovukelic.com/
> > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > I hang out on identi.ca:http://identi.ca/foxbunny
>
> > > > Gimp Brushmakers Guild
> > > >http://bit.ly/gbg-group
>
> > > --
>
> > >http://rochacbruno.com.br
>
>


[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Luther Goh Lu Feng


On Oct 30, 7:05 am, mdipierro  wrote:
> Normally it goes to the nightly build, perhaps not exactly the latest
> but something very close. The bug in question has been there for about
> one week. The problem is that nobody tests the nightly build.
>
> Massimo
>


I would love to have a way to test non stable builds easily with my
existing apps. How does one do so besides downloading the trunk/
nightly build, and then exporting the apps from stable web2py and then
import to the trunk/nightly web2py?


[web2py] .htaccess in web2py

2010-10-30 Thread Francisco Costa
I really would like to protect a website content with a .htaccess
password file like this one 
http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/

I just don't know where to put the file at...
Any help?


[web2py] problem with multiple processes multiple threads

2010-10-30 Thread VP
I can't seem to set up multiple processes, multiple threads.

Here's the apache2 setting:

  WSGIDaemonProcess web2py user=username group=username \
   display-name=%{GROUP} processes=3
threads=10

I have a controller that is computing intensive, taking at least a
minute to run.   When this controller is called, other controllers and
the app appear to have to wait.Other apps still run however.
Increase the number of processes as above did not fix this.

Any idea?   Thanks.



PS: I have this autoroutes configuration (per power of routes tip), 1
domain per application.


[web2py] Re: link to "object" on same web page

2010-10-30 Thread VP
Something like this: http://web2py.com/book/static/
book_images_png/mywiki_show.png">?

http://web2py.com/book/static/book_images_png/mywiki_show.png

(Chapter 3, the wiki app tutorial)


On Oct 30, 7:37 am, Ole Martin Mæland  wrote:
> Hi,
>
> I am new to web2py and I am trying to learn via doing. I am looking at
> the crm soluiton that Massimo has written.
>
> I would like to trigger a task list on the same page as I have
> company_view and person list.
>
> currently my main_company object looks like this:
>
> def main_company():
>      company_id = request.args(0)
>      company = db.company[company_id] or redirect(error_page)
>      db.person.company.default=company_id
>      db.person.company.writable = False
>      db.person.company.readable = False
>      pform = crud.create(db.person)
>      persons=db(db.person.company==company_id)\
>          .select(orderby=db.person.name)
>      return dict(company=company, persons=persons, pform=pform)
>
> and my edit_task :
>
> def edit_task():
>      task_id=request.args(0)
>      task=db.task[task_id] or redirect(error_page)
>      person=db.person[task.person]
>      db.task.person.writable=db.task.person.readable=False
>      form=crud.update(db.task,task,next='view_task/[id]')
>      return dict(form=form, person=person)
>
> on the html page I have a link button to the edit_task page, but I would
> like to have "that page" on the main_company page.
>
> any solution ??
>
> Thanks in advance.
>
> Ole Martin


[web2py] Re: .htaccess in web2py

2010-10-30 Thread VP
I'd think either in web2py root or web2py/applications/yourapp.



On Oct 30, 9:28 am, Francisco Costa  wrote:
> I really would like to protect a website content with a .htaccess
> password file like this 
> onehttp://www.elated.com/articles/password-protecting-your-pages-with-ht...
>
> I just don't know where to put the file at...
> Any help?


[web2py] web2py book discount [was Book 3rd Edition, Lulu Printed Copy, comments]

2010-10-30 Thread Jonathan Lundell
On Oct 30, 2010, at 1:49 AM, cjrh wrote:
> 
> My new printed copy of the third edition of the book arrived a few
> days ago (took almost 2 months to find me!).

Lulu has a 20% discount available through Nov 1: 

http://www.lulu.com/static/102910_TRICK305Rwv.html/?cid=102910_en_email_TRICK305R

Re: [web2py] Re: .htaccess in web2py

2010-10-30 Thread Jonathan Lundell
On Oct 30, 2010, at 8:09 AM, VP wrote:
> 
> I'd think either in web2py root or web2py/applications/yourapp.

This is an interesting question. web2py and its built-in server don't look at 
.htaccess. Where *does* Apache look when pages are being served dynamically, as 
with wsgi? Presumably you can't put one in web2py/applications/yourapp, since 
Apache doesn't really know about that file structure, and even the web2py root 
needn't be known by Apache, since that's (presumably) a wsgi configuration item.

In a shared-host environment, presumably your html root (html_public or 
whatever) would work, but is there more to it than that? Something to mention 
on the deployment chapter, perhaps.


> 
> 
> 
> On Oct 30, 9:28 am, Francisco Costa  wrote:
>> I really would like to protect a website content with a .htaccess
>> password file like this 
>> onehttp://www.elated.com/articles/password-protecting-your-pages-with-ht...
>> 
>> I just don't know where to put the file at...
>> Any help?




[web2py] Re: .htaccess in web2py

2010-10-30 Thread Francisco Costa
tried both.. none worked out :(

On Oct 30, 4:09 pm, VP  wrote:
> I'd think either in web2py root or web2py/applications/yourapp.
>
> On Oct 30, 9:28 am, Francisco Costa  wrote:
>
> > I really would like to protect a website content with a .htaccess
> > password file like this 
> > onehttp://www.elated.com/articles/password-protecting-your-pages-with-ht...
>
> > I just don't know where to put the file at...
> > Any help?
>
>


Re: [web2py] Re: .htaccess in web2py

2010-10-30 Thread Jonathan Lundell
On Oct 30, 2010, at 8:47 AM, Francisco Costa wrote:
> 
> tried both.. none worked out :(

How is your server configured? What are you using?

> 
> On Oct 30, 4:09 pm, VP  wrote:
>> I'd think either in web2py root or web2py/applications/yourapp.
>> 
>> On Oct 30, 9:28 am, Francisco Costa  wrote:
>> 
>>> I really would like to protect a website content with a .htaccess
>>> password file like this 
>>> onehttp://www.elated.com/articles/password-protecting-your-pages-with-ht...
>> 
>>> I just don't know where to put the file at...
>>> Any help?
>> 
>> 




[web2py] Re: .htaccess in web2py

2010-10-30 Thread Francisco Costa
> How is your server configured? What are you using?

Ubuntu 10.10 + Apache 2
and I'm serving the files at /var/www/web2py


Re: [web2py] Re: .htaccess in web2py

2010-10-30 Thread Jonathan Lundell
On Oct 30, 2010, at 9:07 AM, Francisco Costa wrote:
> 
>> How is your server configured? What are you using?
> 
> Ubuntu 10.10 + Apache 2
> and I'm serving the files at /var/www/web2py

You might consider configuring passwords in httpd.conf instead of .htaccess, if 
you have control over the whole server.

Are you doing this as an alternative to web2py auth?

[web2py] Re: .htaccess in web2py

2010-10-30 Thread Francisco Costa
> You might consider configuring passwords in httpd.conf instead of .htaccess, 
> if you have control over the whole server.
Thank you for the suggestion.. I will look into it

> Are you doing this as an alternative to web2py auth?
No, I've finished a project and I've put it online, but before it goes
public, I only want a few persons to have access to it.
So that's why I'm searching for a password protect system.


[web2py] web2py testing & release cycle

2010-10-30 Thread b00m_chef
I was just wondering if it would be possible to have the development
team compile a list of features that need tests written for them. I
would enjoy writing a few tests, though, I don't have time to dig
through the whole code base and figure out on my own what needs
testing.

Ideally, if you guys could put together a list of features + a general
spec for how you would like to see the tests written & reported,
personally I would be happy to contribute a couple. But I can't do
that until you have produced a "check list" of features.

You could even make it into a contest at some point--who can write the
most tests in some period of time...


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Thadeus Burgess
Just my 2 cents.

Using the DAL on anything but web2py is going to be a pain in the ass and a
nightmare waiting to happen. This is due to its inherent forced procedural
coding style. You "can" wrap DAL calls as methods, but it just gets really
messy. I'm a clean code zealot, so I bet I care more than most.

For any kind of software your developing that uses object oriented
programming, use a database system that is structured around classes and
declarative bases. You will find this is much much much easier to integrate
into, for example a wxWidgets program, than the DAL is.

--
Thadeus




On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki wrote:

>  On 30-10-2010 12:06, rochacbruno wrote:
>
> Look this simple example:
>
>  http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py
>
>
>  I have a PyGTK app running very well, I will put the code online soon.
>
> hi Bruno,
>
> one other question,
> in the gtk application,
> do you access the database through a local server,
> or direct through a local disk location ?
> And in the latter case, how do you specify a hard disk location ?
>
> thanks,
> Stef
>
>
>
>
> Em 30/10/2010, às 06:33, Stef Mientki  escreveu:
>
>   Interesting ...
> as I want to migrate to web2py
> and want to have some kind of DAL for my desktop applications,
> this sounds very good.
>
> Can you give me some guide lines, how to use the web2py DAL for desktop
> applications ?
>
> thanks,
> Stef Mientki
>
>
> On 19-10-2010 05:44, Bruno Rocha wrote:
>
> I know DAL was not made for that, but I'm using the DAL in a desktop
> application with PyGTK, and it is working very well :-)
>
> It is a simple application that monitors the presence of employees in a
> company and reads small CSV files from a time clock,
> people has cards that open the gates/doors of the company factory, I use a
> stream to read the track from serial port of time clock,
> then, I take the information serialized as CSV, I parse and write it into
> SQLite db, after that , the Janitor uses a PyGTK app to access that
> information.
>
> already been running for about 6 months, So far everything is working fine,
> but I can not run the automatic migrations.
>
> Does anyone know a way to make migration work automatically with DAL Stand
> Alone?
>
> I'm importing sql.py I'm connecting with SQLite, setting tables, accessing
> and doing out any crud operation.
>
> The only thing missing is to make migration works.
>
>  I already set migrate='Mytable.table' and I tried with migrate=True
>
>  
> An example of what I have working in my
>
>  "connect.py"
> >>> from gluon.sql import *
>  >>> db = DAL('sqlite://timeclock1.db')
> >>> Track =
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>
>  "Form_workflow.py"
> >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
> 1
> >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
> 2
> >>> db.commit
>
>  Until here, its ok.
>
>  But now I am wanting to change the model, and including
> Field('department')
>
>  "connect.py"
>  >>> Track =
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),
> *Field('department')*,migrate='track.table')
>
>  Traceback (most recent call last):
>   File "", line 1, in 
>   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
> raise SyntaxError, 'invalid table name: %s' % tablename
> SyntaxError: invalid table name: track
> >>>
>
>  
>
>  If this is not possible, I'll have to create new fields in SQLite and then
> update my model.
>
>
>
>


Re: [web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Thadeus Burgess
Where should the list of apps come from? I think this is the biggest
question.

--
Thadeus




On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess wrote:

> Someone writes a script to automate the process. Have a list of apps that
> we want to be sure are tested and working. The script will download web2py
> testing, copy the apps to the downloaded version, fire a process fork to
> start that web2py, use urllib or httplib to navigate to each of the apps
> pages to verify that things are working. If a response code of 500 is ever
> received then go get the error ticket and store it somewhere central
> including which app it came from.
>
> --
> Thadeus
>
>
>
>
>
> On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng wrote:
>
>>
>>
>> On Oct 30, 7:05 am, mdipierro  wrote:
>> > Normally it goes to the nightly build, perhaps not exactly the latest
>> > but something very close. The bug in question has been there for about
>> > one week. The problem is that nobody tests the nightly build.
>> >
>> > Massimo
>> >
>>
>>
>> I would love to have a way to test non stable builds easily with my
>> existing apps. How does one do so besides downloading the trunk/
>> nightly build, and then exporting the apps from stable web2py and then
>> import to the trunk/nightly web2py?
>>
>
>


Re: [web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Thadeus Burgess
Someone writes a script to automate the process. Have a list of apps that we
want to be sure are tested and working. The script will download web2py
testing, copy the apps to the downloaded version, fire a process fork to
start that web2py, use urllib or httplib to navigate to each of the apps
pages to verify that things are working. If a response code of 500 is ever
received then go get the error ticket and store it somewhere central
including which app it came from.

--
Thadeus




On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng wrote:

>
>
> On Oct 30, 7:05 am, mdipierro  wrote:
> > Normally it goes to the nightly build, perhaps not exactly the latest
> > but something very close. The bug in question has been there for about
> > one week. The problem is that nobody tests the nightly build.
> >
> > Massimo
> >
>
>
> I would love to have a way to test non stable builds easily with my
> existing apps. How does one do so besides downloading the trunk/
> nightly build, and then exporting the apps from stable web2py and then
> import to the trunk/nightly web2py?
>


[web2py] Calling a function that exists in another controller

2010-10-30 Thread Luther Goh Lu Feng
Which syntax should I use to call in controllerA.py a private function
__foo() defined in controllerB.py?

I understand that one recommendation is to implement an XML-RPC
service. But I wonder if this is an overkill as __foo() is just 5
lines. Or should I go with execution environment (http://
www.web2py.com/book/default/chapter/04#Execution-Environment)? It
seems that in email threads and the book, there is a note of caution
associated with execution environment.

What are the issues/dangers when using execution environment?


[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Luther Goh Lu Feng
It is reasonable to suggest a universal test app that will assist in
the quality assurance of web2py. But I wonder if this will always have
100% test coverage, given that bugs may appear even when writing test
cases. This is still a good idea compared to not having a test suite.

However, I think I would have a greater sense of security if I am able
to test the apps I have written against the nightly/trunk build.

On Oct 31, 1:46 am, Thadeus Burgess  wrote:
> Where should the list of apps come from? I think this is the biggest
> question.
>
> --
> Thadeus
>
> On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess 
> wrote:
>
>
>
>
>
>
>
> > Someone writes a script to automate the process. Have a list of apps that
> > we want to be sure are tested and working. The script will download web2py
> > testing, copy the apps to the downloaded version, fire a process fork to
> > start that web2py, use urllib or httplib to navigate to each of the apps
> > pages to verify that things are working. If a response code of 500 is ever
> > received then go get the error ticket and store it somewhere central
> > including which app it came from.
>
> > --
> > Thadeus
>
> > On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng wrote:
>
> >> On Oct 30, 7:05 am, mdipierro  wrote:
> >> > Normally it goes to the nightly build, perhaps not exactly the latest
> >> > but something very close. The bug in question has been there for about
> >> > one week. The problem is that nobody tests the nightly build.
>
> >> > Massimo
>
> >> I would love to have a way to test non stable builds easily with my
> >> existing apps. How does one do so besides downloading the trunk/
> >> nightly build, and then exporting the apps from stable web2py and then
> >> import to the trunk/nightly web2py?


[web2py] Re: web2py testing & release cycle

2010-10-30 Thread Luther Goh Lu Feng
+1 Count me in. I am pretty new to python. But I am sure there are at
least one or two simple test cases for me to write tests for.

On Oct 31, 1:30 am, b00m_chef  wrote:
> I was just wondering if it would be possible to have the development
> team compile a list of features that need tests written for them. I
> would enjoy writing a few tests, though, I don't have time to dig
> through the whole code base and figure out on my own what needs
> testing.
>
> Ideally, if you guys could put together a list of features + a general
> spec for how you would like to see the tests written & reported,
> personally I would be happy to contribute a couple. But I can't do
> that until you have produced a "check list" of features.
>
> You could even make it into a contest at some point--who can write the
> most tests in some period of time...


[web2py] Re: Stand Alone DAL and migrations (again)

2010-10-30 Thread mdipierro
well. I disagree. ;-)

http://web2py.com/AlterEgo/default/show/215

On 30 oct, 12:42, Thadeus Burgess  wrote:
> Just my 2 cents.
>
> Using the DAL on anything but web2py is going to be a pain in the ass and a
> nightmare waiting to happen. This is due to its inherent forced procedural
> coding style. You "can" wrap DAL calls as methods, but it just gets really
> messy. I'm a clean code zealot, so I bet I care more than most.
>
> For any kind of software your developing that uses object oriented
> programming, use a database system that is structured around classes and
> declarative bases. You will find this is much much much easier to integrate
> into, for example a wxWidgets program, than the DAL is.
>
> --
> Thadeus
>
> On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki wrote:
>
> >  On 30-10-2010 12:06, rochacbruno wrote:
>
> > Look this simple example:
>
> >  http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py
>
> >  I have a PyGTK app running very well, I will put the code online soon.
>
> > hi Bruno,
>
> > one other question,
> > in the gtk application,
> > do you access the database through a local server,
> > or direct through a local disk location ?
> > And in the latter case, how do you specify a hard disk location ?
>
> > thanks,
> > Stef
>
> > Em 30/10/2010, às 06:33, Stef Mientki  escreveu:
>
> >   Interesting ...
> > as I want to migrate to web2py
> > and want to have some kind of DAL for my desktop applications,
> > this sounds very good.
>
> > Can you give me some guide lines, how to use the web2py DAL for desktop
> > applications ?
>
> > thanks,
> > Stef Mientki
>
> > On 19-10-2010 05:44, Bruno Rocha wrote:
>
> > I know DAL was not made for that, but I'm using the DAL in a desktop
> > application with PyGTK, and it is working very well :-)
>
> > It is a simple application that monitors the presence of employees in a
> > company and reads small CSV files from a time clock,
> > people has cards that open the gates/doors of the company factory, I use a
> > stream to read the track from serial port of time clock,
> > then, I take the information serialized as CSV, I parse and write it into
> > SQLite db, after that , the Janitor uses a PyGTK app to access that
> > information.
>
> > already been running for about 6 months, So far everything is working fine,
> > but I can not run the automatic migrations.
>
> > Does anyone know a way to make migration work automatically with DAL Stand
> > Alone?
>
> > I'm importing sql.py I'm connecting with SQLite, setting tables, accessing
> > and doing out any crud operation.
>
> > The only thing missing is to make migration works.
>
> >  I already set migrate='Mytable.table' and I tried with migrate=True
>
> >  
> > An example of what I have working in my
>
> >  "connect.py"
> > >>> from gluon.sql import *
> >  >>> db = DAL('sqlite://timeclock1.db')
> > >>> Track =
> > db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
>
> >  "Form_workflow.py"
> > >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
> > 1
> > >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
> > 2
> > >>> db.commit
>
> >  Until here, its ok.
>
> >  But now I am wanting to change the model, and including
> > Field('department')
>
> >  "connect.py"
> >  >>> Track =
> > db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),
> > *Field('department')*,migrate='track.table')
>
> >  Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
> >     raise SyntaxError, 'invalid table name: %s' % tablename
> > SyntaxError: invalid table name: track
>
> >  
>
> >  If this is not possible, I'll have to create new fields in SQLite and then
> > update my model.
>
>


Re: [web2py] Stand Alone DAL and migrations (again)

2010-10-30 Thread Stef Mientki
hi Thadeus,

On 30-10-2010 19:42, Thadeus Burgess wrote:
> Just my 2 cents.
>
> Using the DAL on anything but web2py is going to be a pain in the ass and a 
> nightmare waiting to
> happen. This is due to its inherent forced procedural coding style. You "can" 
> wrap DAL calls as
> methods, but it just gets really messy. I'm a clean code zealot, so I bet I 
> care more than most.
I guess I'm the opposite,
I'm not a programmer ( although I write code),
but I like the write with as few words as possible (and to learn and to know as 
little as possible),
to create the functionality I need ;-)
>
> For any kind of software your developing that uses object oriented 
> programming, use a database
> system that is structured around classes and declarative bases.
so what would be a good suggestion ?
> You will find this is much much much easier to integrate into, for example a 
> wxWidgets program,
> than the DAL is.
The reason to see if the DAL could be used for desktop applications:
I've a number of applications, that uses SQLite / Access / Sybase databases.
I want to make these applications independent of their underlying databases,
and want to possibility to move to SQL-Server / MySQL or PostGres.
My feeling tells me that about 80 to 90 % of the used SQL queries can be 
handled by an abstraction
layer like DAL.

I've looked at other abstraction layers in the past,
but found the learning step to high.

In fact I find the learning step for the Web2Py also too high ;-)
but as I've chozen Web2Py for web design,
I'll have to learn it anyway.

cheers,
Stef
>
> --
> Thadeus
>



[web2py] a bit of history

2010-10-30 Thread Peterle
at the beginning...


Comment by Massimo

my tests show that a loop in Ruby is about 15 times slower than the
same loop in Python. That was enough for me to drop Rails. I’d love
you to benchmark Gluon (http://mdp.cti.depaul.edu) which should be
even faster than Django because it allows you to byte-code the web
app, including the templates, so there is no parsing or text
manipulation in production mode. No other framework allows it.


[web2py] Re: a bit of history

2010-10-30 Thread Luther Goh Lu Feng
Any code samples for benchmarking? Versions of python and ruby used?

On Oct 31, 3:20 am, Peterle  wrote:
> at the beginning...
>
> Comment by Massimo
>
> my tests show that a loop in Ruby is about 15 times slower than the
> same loop in Python. That was enough for me to drop Rails. I’d love
> you to benchmark Gluon (http://mdp.cti.depaul.edu) which should be
> even faster than Django because it allows you to byte-code the web
> app, including the templates, so there is no parsing or text
> manipulation in production mode. No other framework allows it.


[web2py] Re: a bit of history

2010-10-30 Thread mdipierro
That comment is very old (2-3 years ago). New benchmarks are needed.

Massimo

On 30 oct, 14:20, Peterle  wrote:
> at the beginning...
>
> Comment by Massimo
>
> my tests show that a loop in Ruby is about 15 times slower than the
> same loop in Python. That was enough for me to drop Rails. I’d love
> you to benchmark Gluon (http://mdp.cti.depaul.edu) which should be
> even faster than Django because it allows you to byte-code the web
> app, including the templates, so there is no parsing or text
> manipulation in production mode. No other framework allows it.


Re: [web2py] Re: Stand Alone DAL and migrations (again)

2010-10-30 Thread Thadeus Burgess
Its not about can it be used stand alone. Its about how you have to
structure your code when you do. The only reason the DAL works well with
web2py is because web2py is executed and designed to be functionally coded.

I would suggest SQLAlchemy. Its designed with OOP in mind, and offers more
features than the DAL. However, Like I said, if your not concerned with
using an OOP design, then the DAL Is probably fine.

I have been here, done this. I already have wrote wxWidgets applications
that attempted to use the DAL standalone. It worked... but I soon learned
SQLAlchemy was much better suited for the job. I speak from experience.

If all you are doing is one or two models, then DAL is probably is fine. My
application of using the DAL standalone contained over 50 models, all
interconnected and weaved into each other. I also needed to organize my code
and have all of the models split up into their own files.

--
Thadeus




On Sat, Oct 30, 2010 at 2:07 PM, mdipierro  wrote:

> well. I disagree. ;-)
>
> http://web2py.com/AlterEgo/default/show/215
>
> On 30 oct, 12:42, Thadeus Burgess  wrote:
> > Just my 2 cents.
> >
> > Using the DAL on anything but web2py is going to be a pain in the ass and
> a
> > nightmare waiting to happen. This is due to its inherent forced
> procedural
> > coding style. You "can" wrap DAL calls as methods, but it just gets
> really
> > messy. I'm a clean code zealot, so I bet I care more than most.
> >
> > For any kind of software your developing that uses object oriented
> > programming, use a database system that is structured around classes and
> > declarative bases. You will find this is much much much easier to
> integrate
> > into, for example a wxWidgets program, than the DAL is.
> >
> > --
> > Thadeus
> >
> > On Sat, Oct 30, 2010 at 7:29 AM, Stef Mientki  >wrote:
> >
> > >  On 30-10-2010 12:06, rochacbruno wrote:
> >
> > > Look this simple example:
> >
> > >  http://bitbucket.org/rochacbruno/dal_on_flask/src/tip/dalFlask.py
> >
> > >  I have a PyGTK app running very well, I will put the code online soon.
> >
> > > hi Bruno,
> >
> > > one other question,
> > > in the gtk application,
> > > do you access the database through a local server,
> > > or direct through a local disk location ?
> > > And in the latter case, how do you specify a hard disk location ?
> >
> > > thanks,
> > > Stef
> >
> > > Em 30/10/2010, às 06:33, Stef Mientki 
> escreveu:
> >
> > >   Interesting ...
> > > as I want to migrate to web2py
> > > and want to have some kind of DAL for my desktop applications,
> > > this sounds very good.
> >
> > > Can you give me some guide lines, how to use the web2py DAL for desktop
> > > applications ?
> >
> > > thanks,
> > > Stef Mientki
> >
> > > On 19-10-2010 05:44, Bruno Rocha wrote:
> >
> > > I know DAL was not made for that, but I'm using the DAL in a desktop
> > > application with PyGTK, and it is working very well :-)
> >
> > > It is a simple application that monitors the presence of employees in a
> > > company and reads small CSV files from a time clock,
> > > people has cards that open the gates/doors of the company factory, I
> use a
> > > stream to read the track from serial port of time clock,
> > > then, I take the information serialized as CSV, I parse and write it
> into
> > > SQLite db, after that , the Janitor uses a PyGTK app to access that
> > > information.
> >
> > > already been running for about 6 months, So far everything is working
> fine,
> > > but I can not run the automatic migrations.
> >
> > > Does anyone know a way to make migration work automatically with DAL
> Stand
> > > Alone?
> >
> > > I'm importing sql.py I'm connecting with SQLite, setting tables,
> accessing
> > > and doing out any crud operation.
> >
> > > The only thing missing is to make migration works.
> >
> > >  I already set migrate='Mytable.table' and I tried with migrate=True
> >
> > >  
> > > An example of what I have working in my
> >
> > >  "connect.py"
> > > >>> from gluon.sql import *
> > >  >>> db = DAL('sqlite://timeclock1.db')
> > > >>> Track =
> > >
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),migrate='track.table')
> >
> > >  "Form_workflow.py"
> > > >>> Track.insert(regnumber=123,action=2,timestamp='2010-10-19')
> > > 1
> > > >>> Track.insert(regnumber=124,action=2,timestamp='2010-10-19')
> > > 2
> > > >>> db.commit
> >
> > >  Until here, its ok.
> >
> > >  But now I am wanting to change the model, and including
> > > Field('department')
> >
> > >  "connect.py"
> > >  >>> Track =
> > >
> db.define_table('track',Field('regnumber','integer'),Field('action','integer'),Field('timestamp','datetime'),
> > > *Field('department')*,migrate='track.table')
> >
> > >  Traceback (most recent call last):
> > >   File "", line 1, in 
> > >   File "/bin/DAL/gluon/sql.py", line 1346, in define_table
> > > raise SyntaxError, 'invalid table name: %s' % tablename
> > > SyntaxError: invalid table name: track
> >
> 

Re: [web2py] Re: web2py testing & release cycle

2010-10-30 Thread Albert Abril
Ok. Count on me too.
I can't organize this, because I'm not an expert in tests, but can
contribute with testing.

Regards!

On Sat, Oct 30, 2010 at 9:03 PM, Luther Goh Lu Feng wrote:

> +1 Count me in. I am pretty new to python. But I am sure there are at
> least one or two simple test cases for me to write tests for.
>
> On Oct 31, 1:30 am, b00m_chef  wrote:
> > I was just wondering if it would be possible to have the development
> > team compile a list of features that need tests written for them. I
> > would enjoy writing a few tests, though, I don't have time to dig
> > through the whole code base and figure out on my own what needs
> > testing.
> >
> > Ideally, if you guys could put together a list of features + a general
> > spec for how you would like to see the tests written & reported,
> > personally I would be happy to contribute a couple. But I can't do
> > that until you have produced a "check list" of features.
> >
> > You could even make it into a contest at some point--who can write the
> > most tests in some period of time...
>


[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread mart
Hey,

Would it make sense not to pull the apps that get built against #head
revision (unless the goal is to test the apps themselves) and
preferably just pull the code line it self @ #head revision? (follow
up on this in next paragraph) And also, I don't know where things
stand wrt bug tracking, but an important consideration are the bug
fixes ("does this build contain the fix for Bug X?"). Typically when
bugs get resolved/closed, they get verified on a clean slate, then
once validated & blessed (or rejected), the fix can be made public.

I think the process is pretty close to what Thadeus mentioned, but
would add the integration to bug tracking (this data is usually made
part of the release notes specifically instead of a description typed
in @ commit time). if the desire is automation (smoke tests) that I
would store the raw data of the "generic app" in some dedicated
tables, then re-populate the all-encompassing app with current data.
By always grabbing latest_row, you keep the previous data for the
previous build/release intact and in the correct place (so you don't
need to change the test process from release to release, and you have
the the build process insert a new set of records @ build time
referencing the current build. With this, you also have
reproducibility if needed.

Last point, and I know I am persistently annoying with this, but
mercurial, IMHO, sucks, sucks a lot. Personally I would use nothing
less then the best out there, Perforce, specially if considering
automated testing (again IMHO, but at least a fairly well supported
statement :)). web2py is Open source, Perforce does give additional
user licenses to open source projects (I'm sure Massimo would only
need to make the request (which is online @ perforce .com btw). I
mention that here because, good testing processes should be well
integrated to source control. and for the web2py user, offering time
for testing, a local instance of the perforce server can be installed,
absolutely free of charge (with a max of 2 user licenses per server -
more than enough for "remote workers" who can very easily keep in sync
with the "main web2py" server (I work from home (Quebec, Canada), work
for an American based company (HQ in Sunnyvale) - and that is how I do
my work, with my local p4D. works like a charm). Anyways, enough of
that, just thought I'd find another reason to slide that in ;)

regards,
Mart :)


On Oct 30, 2:58 pm, Luther Goh Lu Feng  wrote:
> It is reasonable to suggest a universal test app that will assist in
> the quality assurance of web2py. But I wonder if this will always have
> 100% test coverage, given that bugs may appear even when writing test
> cases. This is still a good idea compared to not having a test suite.
>
> However, I think I would have a greater sense of security if I am able
> to test the apps I have written against the nightly/trunk build.
>
> On Oct 31, 1:46 am, Thadeus Burgess  wrote:
>
> > Where should the list of apps come from? I think this is the biggest
> > question.
>
> > --
> > Thadeus
>
> > On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess 
> > wrote:
>
> > > Someone writes a script to automate the process. Have a list of apps that
> > > we want to be sure are tested and working. The script will download web2py
> > > testing, copy the apps to the downloaded version, fire a process fork to
> > > start that web2py, use urllib or httplib to navigate to each of the apps
> > > pages to verify that things are working. If a response code of 500 is ever
> > > received then go get the error ticket and store it somewhere central
> > > including which app it came from.
>
> > > --
> > > Thadeus
>
> > > On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng 
> > > wrote:
>
> > >> On Oct 30, 7:05 am, mdipierro  wrote:
> > >> > Normally it goes to the nightly build, perhaps not exactly the latest
> > >> > but something very close. The bug in question has been there for about
> > >> > one week. The problem is that nobody tests the nightly build.
>
> > >> > Massimo
>
> > >> I would love to have a way to test non stable builds easily with my
> > >> existing apps. How does one do so besides downloading the trunk/
> > >> nightly build, and then exporting the apps from stable web2py and then
> > >> import to the trunk/nightly web2py?
>
>


[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread mart
BTW - have you seen Mondrian? - is built on Perforce.

http://video.google.com/videoplay?docid=-8502904076440714866#

Mart


On Oct 30, 7:24 pm, mart  wrote:
> Hey,
>
> Would it make sense not to pull the apps that get built against #head
> revision (unless the goal is to test the apps themselves) and
> preferably just pull the code line it self @ #head revision? (follow
> up on this in next paragraph) And also, I don't know where things
> stand wrt bug tracking, but an important consideration are the bug
> fixes ("does this build contain the fix for Bug X?"). Typically when
> bugs get resolved/closed, they get verified on a clean slate, then
> once validated & blessed (or rejected), the fix can be made public.
>
> I think the process is pretty close to what Thadeus mentioned, but
> would add the integration to bug tracking (this data is usually made
> part of the release notes specifically instead of a description typed
> in @ commit time). if the desire is automation (smoke tests) that I
> would store the raw data of the "generic app" in some dedicated
> tables, then re-populate the all-encompassing app with current data.
> By always grabbing latest_row, you keep the previous data for the
> previous build/release intact and in the correct place (so you don't
> need to change the test process from release to release, and you have
> the the build process insert a new set of records @ build time
> referencing the current build. With this, you also have
> reproducibility if needed.
>
> Last point, and I know I am persistently annoying with this, but
> mercurial, IMHO, sucks, sucks a lot. Personally I would use nothing
> less then the best out there, Perforce, specially if considering
> automated testing (again IMHO, but at least a fairly well supported
> statement :)). web2py is Open source, Perforce does give additional
> user licenses to open source projects (I'm sure Massimo would only
> need to make the request (which is online @ perforce .com btw). I
> mention that here because, good testing processes should be well
> integrated to source control. and for the web2py user, offering time
> for testing, a local instance of the perforce server can be installed,
> absolutely free of charge (with a max of 2 user licenses per server -
> more than enough for "remote workers" who can very easily keep in sync
> with the "main web2py" server (I work from home (Quebec, Canada), work
> for an American based company (HQ in Sunnyvale) - and that is how I do
> my work, with my local p4D. works like a charm). Anyways, enough of
> that, just thought I'd find another reason to slide that in ;)
>
> regards,
> Mart :)
>
> On Oct 30, 2:58 pm, Luther Goh Lu Feng  wrote:
>
> > It is reasonable to suggest a universal test app that will assist in
> > the quality assurance of web2py. But I wonder if this will always have
> > 100% test coverage, given that bugs may appear even when writing test
> > cases. This is still a good idea compared to not having a test suite.
>
> > However, I think I would have a greater sense of security if I am able
> > to test the apps I have written against the nightly/trunk build.
>
> > On Oct 31, 1:46 am, Thadeus Burgess  wrote:
>
> > > Where should the list of apps come from? I think this is the biggest
> > > question.
>
> > > --
> > > Thadeus
>
> > > On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess 
> > > wrote:
>
> > > > Someone writes a script to automate the process. Have a list of apps 
> > > > that
> > > > we want to be sure are tested and working. The script will download 
> > > > web2py
> > > > testing, copy the apps to the downloaded version, fire a process fork to
> > > > start that web2py, use urllib or httplib to navigate to each of the apps
> > > > pages to verify that things are working. If a response code of 500 is 
> > > > ever
> > > > received then go get the error ticket and store it somewhere central
> > > > including which app it came from.
>
> > > > --
> > > > Thadeus
>
> > > > On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng 
> > > > wrote:
>
> > > >> On Oct 30, 7:05 am, mdipierro  wrote:
> > > >> > Normally it goes to the nightly build, perhaps not exactly the latest
> > > >> > but something very close. The bug in question has been there for 
> > > >> > about
> > > >> > one week. The problem is that nobody tests the nightly build.
>
> > > >> > Massimo
>
> > > >> I would love to have a way to test non stable builds easily with my
> > > >> existing apps. How does one do so besides downloading the trunk/
> > > >> nightly build, and then exporting the apps from stable web2py and then
> > > >> import to the trunk/nightly web2py?
>
>


Re: [web2py] Re: Remove link in MENU for current url

2010-10-30 Thread Michael Wolfe
Completely optional.

On Sat, Oct 30, 2010 at 3:02 AM, annet  wrote:
> Does this mean that the current menu's behaviour will change, or is
> this patch optional?
>
> Currently, I just style active links differently, and that works fine.
> I have seen people who work with different browsers on different OS
> use the active menu link to refresh the current page. Basically
> because the menu link is closer to where the mouse pointer is, and
> because the menu link is always on the same position in the window.
> Safari has its refresh "button" to the right of the URL, in Firefox
> it's the first button in a row of three to the left of the URL.
>
>
> Kind regards,
>
> Annet.


Re: [web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Manu
Hi ,

  Not playing in the same league as everyone here , but definitely
think that providing better unit tests + ui tests will definitely
serve many purposes . First will ensure that release goes smoother and
also will be a distinctive advantage over concurrence ( not sure if
anyone else has some sort of ui testing framework ). It can also serve
as simple example of the many features web2py offers ( more or less
what we all have read once in the quick examples section).

So i am voting a big YES on this


[web2py] Re: Calling a function that exists in another controller

2010-10-30 Thread ron_m
You could put the code in a module and use local_import in both
controllers.

On Oct 30, 11:52 am, Luther Goh Lu Feng  wrote:
> Which syntax should I use to call in controllerA.py a private function
> __foo() defined in controllerB.py?
>
> I understand that one recommendation is to implement an XML-RPC
> service. But I wonder if this is an overkill as __foo() is just 5
> lines. Or should I go with execution environment 
> (http://www.web2py.com/book/default/chapter/04#Execution-Environment)?It
> seems that in email threads and the book, there is a note of caution
> associated with execution environment.
>
> What are the issues/dangers when using execution environment?


Re: [web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread Jonathan Lundell
On Oct 30, 2010, at 4:24 PM, mart wrote:
> 
> Last point, and I know I am persistently annoying with this, but
> mercurial, IMHO, sucks, sucks a lot. Personally I would use nothing
> less then the best out there, Perforce, specially if considering
> automated testing (again IMHO, but at least a fairly well supported
> statement :)).

Not digress too far, but as a long-time Perforce user, I'm pretty much 
committed (!) to using hg for my future projects. If we were discussing p4 vs 
svn, I'd agree, but I confess to being a little baffled by the "hg sucks a lot" 
assertion.



[web2py] Using tuple in db() gives Key Error

2010-10-30 Thread thylacine222
Hi, I'm running this code right now:
querylist = []
for term in request.vars:
if term != 'n':
   querylist.append("(db.%s.%s.contains('%s'))" %
(filname, term, request.vars[term]))
queryterm = (' & '.join(querylist),)
search = db(*queryterm).select()

The term in queryterm works perfectly if I use it manually on the
database administration page, but when I run this code, I get "Key
Error:foo" where foo is a field that I'm querying.

Is there any easier way to do this? I'm not sure why I keep getting
this error.


[web2py] web2py as a cross-platform mobile application platform

2010-10-30 Thread pallav
Hi

My company is working on a platform for mobile application development
along the lines of PhoneGap and Rhosync. The idea is to have a web2py
server running on the mobile device (Android, iPhone, etc.) locally,
and have a browser component that is used for UI. The UI would be
developed in HTML/CSS/javascript (the new jQuery mobile library looks
like a good option to include)

We will release the framework open-source (to us the framework is just
a means to an end) but would appreciate some help getting started.
This could potentially be very good for web2py in return because cross-
platform mobile app frameworks are a relatively new but huge market.
Running the server on the device will allow several advantages,
including:
1. Access to native device hardware (camera, Bluetooth, WiFi, GPS,
etc.)
2. Access to the application even when disconnected
3. Speedy UI for the user

Our first target platform is Windows Mobile 5. I have searched through
the forums on here, and although it seems that web2py should work on
there, nobody seems to have claimed success. The closest I found was
this old thread:
http://groups.google.com/group/web2py/browse_thread/thread/a85e511bc85baa31/34da24aedfcf2096?lnk=gst&q=windows+ce#34da24aedfcf2096

Has anyone here had success running web2py on Windows Mobile recently?
If not, I will try to get something running early this week and post
here with results/questions.

Thanks


[web2py] Re: Calling a function that exists in another controller

2010-10-30 Thread ron_m
Oops to clarify put the function in a file under the modules
directory. While in development mode the local_import has a reload
option so the code gets reloaded on each request. The default is to
load once on first use which requires server restart if a change is
needed.

On Oct 30, 5:15 pm, ron_m  wrote:
> You could put the code in a module and use local_import in both
> controllers.
>
> On Oct 30, 11:52 am, Luther Goh Lu Feng  wrote:
>
> > Which syntax should I use to call in controllerA.py a private function
> > __foo() defined in controllerB.py?
>
> > I understand that one recommendation is to implement an XML-RPC
> > service. But I wonder if this is an overkill as __foo() is just 5
> > lines. Or should I go with execution environment 
> > (http://www.web2py.com/book/default/chapter/04#Execution-Environment)?It
> > seems that in email threads and the book, there is a note of caution
> > associated with execution environment.
>
> > What are the issues/dangers when using execution environment?
>
>


[web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread mart
Yes, agreed , that may have been a little too strong of an opinion, in
fact, WAS  too strong, so I'll take that back since the intention was
not to offend, so apologies for that one. I'll say instead: I think P4
is much better suited when comes time to integrate to processes/
automation such QA automation, but again, that's just my opinion based
on my own experience.

Mart :)

On Oct 30, 8:17 pm, Jonathan Lundell  wrote:
> On Oct 30, 2010, at 4:24 PM, mart wrote:
>
>
>
> > Last point, and I know I am persistently annoying with this, but
> > mercurial, IMHO, sucks, sucks a lot. Personally I would use nothing
> > less then the best out there, Perforce, specially if considering
> > automated testing (again IMHO, but at least a fairly well supported
> > statement :)).
>
> Not digress too far, but as a long-time Perforce user, I'm pretty much 
> committed (!) to using hg for my future projects. If we were discussing p4 vs 
> svn, I'd agree, but I confess to being a little baffled by the "hg sucks a 
> lot" assertion.


[web2py] Re: Using tuple in db() gives Key Error

2010-10-30 Thread mdipierro
Should be

querylist = []
for term in request.vars:
   if term != 'n':
querylist.append(db[filename]
[term]contains(request.vars[term]))
queryterm = reduce(lambda a,b:a&b, querylist)
search = db(queryterm).select()

queries should not be strings but objects. It works with strings but
it going away with the new DAL. The book does not say you can do that.

On 30 oct, 16:01, thylacine222  wrote:
> Hi, I'm running this code right now:
>     querylist = []
>     for term in request.vars:
>         if term != 'n':
>                querylist.append("(db.%s.%s.contains('%s'))" %
> (filname, term, request.vars[term]))
>     queryterm = (' & '.join(querylist),)
>     search = db(*queryterm).select()
>
> The term in queryterm works perfectly if I use it manually on the
> database administration page, but when I run this code, I get "Key
> Error:foo" where foo is a field that I'm querying.
>
> Is there any easier way to do this? I'm not sure why I keep getting
> this error.


[web2py] Re: web2py as a cross-platform mobile application platform

2010-10-30 Thread mdipierro
I have used it more than one year ago, something around version
1.59.*. Let us know what does not work and we can help fix it.

On 30 oct, 16:21, pallav  wrote:
> Hi
>
> My company is working on a platform for mobile application development
> along the lines of PhoneGap and Rhosync. The idea is to have a web2py
> server running on the mobile device (Android, iPhone, etc.) locally,
> and have a browser component that is used for UI. The UI would be
> developed in HTML/CSS/javascript (the new jQuery mobile library looks
> like a good option to include)
>
> We will release the framework open-source (to us the framework is just
> a means to an end) but would appreciate some help getting started.
> This could potentially be very good for web2py in return because cross-
> platform mobile app frameworks are a relatively new but huge market.
> Running the server on the device will allow several advantages,
> including:
> 1. Access to native device hardware (camera, Bluetooth, WiFi, GPS,
> etc.)
> 2. Access to the application even when disconnected
> 3. Speedy UI for the user
>
> Our first target platform is Windows Mobile 5. I have searched through
> the forums on here, and although it seems that web2py should work on
> there, nobody seems to have claimed success. The closest I found was
> this old 
> thread:http://groups.google.com/group/web2py/browse_thread/thread/a85e511bc8...
>
> Has anyone here had success running web2py on Windows Mobile recently?
> If not, I will try to get something running early this week and post
> here with results/questions.
>
> Thanks


[web2py] Re: Using tuple in db() gives Key Error

2010-10-30 Thread DenesL

In order to get a query object you have to use the field objects and
not string representations of them, so you can not do
"(db.%s.%s.contains('%s'))" %(filname, term, request.vars[term]))

that should be
db[filname][term].contains(request.vars[term])

and since queries can be ANDed together, you can write

rv=dict([(k,v) for k,v in rvars.iteritems() if k<>'n'])
q=reduce(lambda a,b: (db.test[a].contains(rv[a])) &
(db.test[b].contains(rv[b])),rv)
search=db(q).select()

Denes.


On Oct 30, 5:01 pm, thylacine222  wrote:
> Hi, I'm running this code right now:
>     querylist = []
>     for term in request.vars:
>         if term != 'n':
>                querylist.append("(db.%s.%s.contains('%s'))" %
> (filname, term, request.vars[term]))
>     queryterm = (' & '.join(querylist),)
>     search = db(*queryterm).select()
>
> The term in queryterm works perfectly if I use it manually on the
> database administration page, but when I run this code, I get "Key
> Error:foo" where foo is a field that I'm querying.
>
> Is there any easier way to do this? I'm not sure why I keep getting
> this error.


Re: [web2py] Re: web2py 1.88.1 is OUT

2010-10-30 Thread rochacbruno
At my company we started to use this 

http://www.reviewboard.org/

Integrated with hg

I suggest to start using this integrated with the main web2py repository. 

Enviado via iPhone

Em 30/10/2010, às 21:33, mart  escreveu:

> BTW - have you seen Mondrian? - is built on Perforce.
> 
> http://video.google.com/videoplay?docid=-8502904076440714866#
> 
> Mart
> 
> 
> On Oct 30, 7:24 pm, mart  wrote:
>> Hey,
>> 
>> Would it make sense not to pull the apps that get built against #head
>> revision (unless the goal is to test the apps themselves) and
>> preferably just pull the code line it self @ #head revision? (follow
>> up on this in next paragraph) And also, I don't know where things
>> stand wrt bug tracking, but an important consideration are the bug
>> fixes ("does this build contain the fix for Bug X?"). Typically when
>> bugs get resolved/closed, they get verified on a clean slate, then
>> once validated & blessed (or rejected), the fix can be made public.
>> 
>> I think the process is pretty close to what Thadeus mentioned, but
>> would add the integration to bug tracking (this data is usually made
>> part of the release notes specifically instead of a description typed
>> in @ commit time). if the desire is automation (smoke tests) that I
>> would store the raw data of the "generic app" in some dedicated
>> tables, then re-populate the all-encompassing app with current data.
>> By always grabbing latest_row, you keep the previous data for the
>> previous build/release intact and in the correct place (so you don't
>> need to change the test process from release to release, and you have
>> the the build process insert a new set of records @ build time
>> referencing the current build. With this, you also have
>> reproducibility if needed.
>> 
>> Last point, and I know I am persistently annoying with this, but
>> mercurial, IMHO, sucks, sucks a lot. Personally I would use nothing
>> less then the best out there, Perforce, specially if considering
>> automated testing (again IMHO, but at least a fairly well supported
>> statement :)). web2py is Open source, Perforce does give additional
>> user licenses to open source projects (I'm sure Massimo would only
>> need to make the request (which is online @ perforce .com btw). I
>> mention that here because, good testing processes should be well
>> integrated to source control. and for the web2py user, offering time
>> for testing, a local instance of the perforce server can be installed,
>> absolutely free of charge (with a max of 2 user licenses per server -
>> more than enough for "remote workers" who can very easily keep in sync
>> with the "main web2py" server (I work from home (Quebec, Canada), work
>> for an American based company (HQ in Sunnyvale) - and that is how I do
>> my work, with my local p4D. works like a charm). Anyways, enough of
>> that, just thought I'd find another reason to slide that in ;)
>> 
>> regards,
>> Mart :)
>> 
>> On Oct 30, 2:58 pm, Luther Goh Lu Feng  wrote:
>> 
>>> It is reasonable to suggest a universal test app that will assist in
>>> the quality assurance of web2py. But I wonder if this will always have
>>> 100% test coverage, given that bugs may appear even when writing test
>>> cases. This is still a good idea compared to not having a test suite.
>> 
>>> However, I think I would have a greater sense of security if I am able
>>> to test the apps I have written against the nightly/trunk build.
>> 
>>> On Oct 31, 1:46 am, Thadeus Burgess  wrote:
>> 
 Where should the list of apps come from? I think this is the biggest
 question.
>> 
 --
 Thadeus
>> 
 On Sat, Oct 30, 2010 at 12:46 PM, Thadeus Burgess 
 wrote:
>> 
> Someone writes a script to automate the process. Have a list of apps that
> we want to be sure are tested and working. The script will download web2py
> testing, copy the apps to the downloaded version, fire a process fork to
> start that web2py, use urllib or httplib to navigate to each of the apps
> pages to verify that things are working. If a response code of 500 is ever
> received then go get the error ticket and store it somewhere central
> including which app it came from.
>> 
> --
> Thadeus
>> 
> On Sat, Oct 30, 2010 at 9:25 AM, Luther Goh Lu Feng 
> wrote:
>> 
>> On Oct 30, 7:05 am, mdipierro  wrote:
>>> Normally it goes to the nightly build, perhaps not exactly the latest
>>> but something very close. The bug in question has been there for about
>>> one week. The problem is that nobody tests the nightly build.
>> 
>>> Massimo
>> 
>> I would love to have a way to test non stable builds easily with my
>> existing apps. How does one do so besides downloading the trunk/
>> nightly build, and then exporting the apps from stable web2py and then
>> import to the trunk/nightly web2py?
>> 
>> 


[web2py] Setting web2py-component-command

2010-10-30 Thread Luther Goh Lu Feng
I wish to run a script after a component is ajax loaded. To achieve
that, I attempted to set the web2py-component-command as follows:

==

comment_component = function(){
t = $('#comment_text__row textarea').val();
{{response.headers['web2py-component-command']="console.log('yay')"}}
web2py_component('/roverus/comment/create.load?current_conversation='
+ current_conversation,'conversation');
}
setInterval("comment_component()", 5000);

==

However "console.log('yay')" does not run.

I also set web2py-component-command in the related function as
follows:

==
function web2py_ajax_page(method,action,data,target) {
  {{response.headers['web2py-component-
command']="console.log('yay2')"}} <-added line
  jQuery.ajax({'type':method,'url':action,'data':data,
'beforeSend':function(xhr) {
  xhr.setRequestHeader('web2py-component-
location',document.location);
  xhr.setRequestHeader('web2py-component-element',target);},
'complete':function(xhr,text){
  var html=xhr.responseText;
  var content=xhr.getResponseHeader('web2py-component-content');
  var command=xhr.getResponseHeader('web2py-component-command');
  var flash=xhr.getResponseHeader('web2py-component-flash');
  var t = jQuery('#'+target);
  if(content=='prepend') t.prepend(html);
  else if(content=='append') t.append(html);
  else if(content!='hide') t.html(html);
  web2py_trap_form(action,target);
  web2py_ajax_init();
  if(command) eval(command);
  if(flash) jQuery('.flash').html(flash).slideDown();
  }
});
}

==

This too does not work.

Can anyone enlighten me if I misunderstood the syntax, or is there
another way I can get this working? Thanks in advance.


[web2py] Passing pointer to session, requestion, etc objects to module

2010-10-30 Thread b00m_chef
How does one go about passing a pointer to the session and request
objects from your app to a module in said app. Basically, in a module,
I need to be able to manipulate all those objects without having to
return and re-assign them.

If I simply pass all the session, request, response, etc objects to my
module object in the constructor and then assign all to self.bla, then
I only get copies of those objects...I can't change them after.

Is the above possible?

Simple example of what I want to do is to be able to do
session.forget() in my module.


[web2py] Re: Calling a function that exists in another controller

2010-10-30 Thread Luther Goh Lu Feng
Thanks!

On Oct 31, 8:23 am, ron_m  wrote:
> Oops to clarify put the function in a file under the modules
> directory. While in development mode the local_import has a reload
> option so the code gets reloaded on each request. The default is to
> load once on first use which requires server restart if a change is
> needed.
>
> On Oct 30, 5:15 pm, ron_m  wrote:
>
>
>
>
>
>
>
> > You could put the code in a module and use local_import in both
> > controllers.
>
> > On Oct 30, 11:52 am, Luther Goh Lu Feng  wrote:
>
> > > Which syntax should I use to call in controllerA.py a private function
> > > __foo() defined in controllerB.py?
>
> > > I understand that one recommendation is to implement an XML-RPC
> > > service. But I wonder if this is an overkill as __foo() is just 5
> > > lines. Or should I go with execution environment 
> > > (http://www.web2py.com/book/default/chapter/04#Execution-Environment)?It
> > > seems that in email threads and the book, there is a note of caution
> > > associated with execution environment.
>
> > > What are the issues/dangers when using execution environment?