Re: [web2py] wiki 1st question: problem with an anchor

2011-07-25 Thread Martin Weissenboeck
Thanks Jonathan, it works!

If I want to have a link inside file abc to anchor [[a]] I have to use
[[mylink #a]] - that's ok!

But how link from file def to abc#a?
I have tried [[mylink file:abc#a]] - this links to file://abc%23a

What is the correct syntax?
Regards, Martrin

2011/7/24 Jonathan Lundell 

>
> On Jul 23, 2011, at 10:53 PM, Martin Weissenboeck wrote:
>
> I have written a text page "abc" with web2py wiki containing a label [[a]].
> There are two links in default/index.html:
>
>- http://127.0.0.1:8000/test/plugin_wiki/page/abc#a";>Link
>1
>- {{=A('Link
>2',_href=URL('test','plugin_wiki','page',args=['abc#a']))}}
>
> Link 1 opens "http://127.0.0.1:8000/test/plugin_wiki/page/abc*#*a"; and
> works fine.
> Link 2 tries "http://127.0.0.1:8000/test/plugin_wiki/page/abc*%23*a"; and
> the result is *"invalid request*".
> Web2py does not like "%23" instead of "#" as a part an url?
>
>
> You want URL(…, anchor='a').
>


[web2py] Tr.lời: Re: JSON & 1.97.1

2011-07-25 Thread toan75

Error when call the databales function directly and/or call 
call/json/datatables
(I try again universal_caller function from old version (1.96.4), it works 
fine.)
 


Traceback (most recent call last):
  File "D:\web2py197\gluon\restricted.py", line 192, in restricted
exec ccode in environment
  File "D:/web2py197/applications/sonn/controllers/plugin_admin.py" 
, 
line 1027, in 
  File "D:\web2py197\gluon\globals.py", line 137, in 
self._caller = lambda f: f()
  File "D:/web2py197/applications/sonn/controllers/plugin_admin.py" 
, 
line 26, in call
return service()
  File "D:\web2py197\gluon\tools.py", line 3918, in __call__
return self.serve_json(request.args[1:])
  File "D:\web2py197\gluon\tools.py", line 3734, in serve_json
s = universal_caller(self.json_procedures[args[0]],*args[1:],**d)
  File "D:\web2py197\gluon\tools.py", line 3404, in universal_caller
pos_args = n[0:-len(defaults)]
TypeError: object of type 'NoneType' has no len()




[web2py] Re: Tr.lời: Re: JSON & 1.97.1

2011-07-25 Thread Massimo Di Pierro
This was fixed in trunk some time ago

On Jul 25, 2:24 am, toan75  wrote:
> Error when call the databales function directly and/or call
> call/json/datatables
> (I try again universal_caller function from old version (1.96.4), it works
> fine.)
>
> Traceback (most recent call last):
>   File "D:\web2py197\gluon\restricted.py", line 192, in restricted
>     exec ccode in environment
>   File "D:/web2py197/applications/sonn/controllers/plugin_admin.py" 
> , 
> line 1027, in 
>   File "D:\web2py197\gluon\globals.py", line 137, in 
>     self._caller = lambda f: f()
>   File "D:/web2py197/applications/sonn/controllers/plugin_admin.py" 
> , 
> line 26, in call
>     return service()
>   File "D:\web2py197\gluon\tools.py", line 3918, in __call__
>     return self.serve_json(request.args[1:])
>   File "D:\web2py197\gluon\tools.py", line 3734, in serve_json
>     s = universal_caller(self.json_procedures[args[0]],*args[1:],**d)
>   File "D:\web2py197\gluon\tools.py", line 3404, in universal_caller
>     pos_args = n[0:-len(defaults)]
> TypeError: object of type 'NoneType' has no len()


[web2py] Re: export data to OOO and Excel

2011-07-25 Thread selecta
Have a look at
http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/views/generic.xls
http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/views/generic.xlsx

they use tablib (which includes xlwt, ...)
http://docs.tablib.org/en/latest/index.html


[web2py] About the About page

2011-07-25 Thread António Ramos
Hello, just a suggestion

I need more pages like the about page.
Pages that are static and not related to views or controllers or models.

The about page functionality shoud be more generic and allow for other pages
to be available in the app

Maybe a WYSIWYG for creating this pages(welcome page, app manual page,etc).



Thank you
António


Re: [web2py] Re: export data to OOO and Excel

2011-07-25 Thread António Ramos
How about a video tutorial exporting to excel?



2011/7/25 selecta 

> Have a look at
>
> http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/views/generic.xls
>
> http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/views/generic.xlsx
>
> they use tablib (which includes xlwt, ...)
> http://docs.tablib.org/en/latest/index.html


[web2py] MongoDB supported by DAL

2011-07-25 Thread Francisco Costa
When will MongoDBAdapter finalize so we can use it with DAL?


[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Will
does it or how does it support record representation for linked
tables ?
The record has a 'product' field linked to a 'db.product' with an id.
and name field, and the name appeared in PowerTable with the following
code in db.py .
The representation that worked fine in PowerTables  is only displaying
the product id in PowerGrid instead of the product name.

( in the DB i'm displaying in the Grid, a field is linked to another
db.products with an id field and a name (=nom) field : )
...
Field("product", db.products,represent=lambda f:
db.products[f].nom, requires = IS_IN_DB(db, db.products, '%(nom)s'),
writable=False),
...

By the way, it looks great and I couldn't wait to apply it today after
you said in my previous topic it would enter the beta during the
weekend.

Thanks.


[web2py] Re: About the About page

2011-07-25 Thread cjrh
On Jul 25, 10:50 am, António Ramos  wrote:
> Maybe a WYSIWYG for creating this pages(welcome page, app manual page,etc).

plugin_wiki?


Re: [web2py] Re: Tr.lời: Re: JSON & 1.97.1

2011-07-25 Thread Vasile Ermicioi
may be is time for a new official version ?


Re: [web2py] Re: About the About page

2011-07-25 Thread António Ramos
Oops,
you are right!

2011/7/25 cjrh 

> On Jul 25, 10:50 am, António Ramos  wrote:
> > Maybe a WYSIWYG for creating this pages(welcome page, app manual
> page,etc).
>
> plugin_wiki?
>


[web2py] Re: Tr.lời: Re: JSON & 1.97.1

2011-07-25 Thread Massimo Di Pierro
yes. will post soon.

On Jul 25, 5:13 am, Vasile Ermicioi  wrote:
> may be is time for a new official version ?


[web2py] cron problem

2011-07-25 Thread Manuele Pesenti

dear all,
I have a strange problem with cron it seams it does not respect what I 
have eritten in crontab... this is my crontab:


30 6 * * *  root *cron/fetch_m_data
0 7 * * *  root *default/send_mail_msg
30 14 * * *  root *cron/fetch_x_data
0 21 * * *  root *cron/fetch_m_data
0 23 * * *  root *cron/fetch_x_data

and every function called at the end send me an email so I can 
monitorize what happens... the result is that I receive emails every day 
who say that:


at 3:00 AM fetch_m_data is performed
at 5:00 AM fetch_x_data is performed
at 12:30 fetch_m_data is performed
at 20:30 fetch_m_data is performed again
send_mail_msg is never performed (it sends another message)

can you help me?

thanks a lot

Manuele


[web2py] Ticket issued: unrecoverable

2011-07-25 Thread António Ramos
Hello, when i try to acces my server admin remotely with FQDN and not by ip
i get this error



*Ticket issued: unrecoverable*


Why?

thank you


[web2py] upload - S3 storage

2011-07-25 Thread Nils Olofsson
Hi all,

 Before I go off and make an  attempt at creating a S3 upload
function, I was just wondering if anyone has a working version ?

I read the discussion on this and for me I need a way of storing
uploaded images on S3 to share between a few  VPS on Amazon's EC2.

The only other way to accomplish the same thing would be to use rsync,
which is not ideal.

I want to stay within the functionality of web2py SQLforms, maybe by
having the field type 'uploadS3' so web2py would know that the file is
going to be uploaded to amazons S3 service.

Is this a good approach ?

So far I've only used the functionality of web2py, I never had to
change or customize it, so any help or pointer would be appreciated.

Regards,

Nils


[web2py] Strange form behaviour.

2011-07-25 Thread annet
To get rid of the colon in the forms I do the following:

form=SQLFORM(...)
for label in form.elements('label'):
label.components = label.components[-2]


This works for:

form=auth()
form.SQLFORM(...)
form=SQLFORM.factory(...)

However, in case of form=crud.update(...) I get the following error
ticket


Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
restricted.py", line 188, in restricted
exec ccode in environment
  File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
init/controllers/admincms.py", line 524, in 
  File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
globals.py", line 96, in 
self._caller = lambda f: f()
  File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
tools.py", line 2298, in f
return action(*a, **b)
  File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
init/controllers/admincms.py", line 380, in logo
label.components = label.components[-2]
IndexError: list index out of range


This error somehow has something to do with deletable being set to
True or False i.e this works:

form=crud.update(table=db.tagline,...,deletable=False)
for label in form.elements('label'):
label.components = label.components[-2]

... and this doesn't work:

form=crud.update(table=db.tagline,...,deletable=True)
for label in form.elements('label'):
label.components = label.components[-2]


Is there a solutions for this problem?


Kind regards,

Annet


[web2py] Re: Strange form behaviour.

2011-07-25 Thread Massimo Di Pierro
The error is in your code

for label in form.elements('label'):
label.components = label.components[-2]

because the delete row an a empty label.

for label in form.elements('label'):
if len(label.components)>=2:
label.components = label.components[-2]

anyway, what is that line for?

On Jul 25, 7:14 am, annet  wrote:
> To get rid of the colon in the forms I do the following:
>
> form=SQLFORM(...)
> for label in form.elements('label'):
>     label.components = label.components[-2]
>
> This works for:
>
> form=auth()
> form.SQLFORM(...)
> form=SQLFORM.factory(...)
>
> However, in case of form=crud.update(...) I get the following error
> ticket
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
> init/controllers/admincms.py", line 524, in 
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> globals.py", line 96, in 
>     self._caller = lambda f: f()
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/gluon/
> tools.py", line 2298, in f
>     return action(*a, **b)
>   File "/Library/Python/2.5/site-packages/web2py_1.87.3/applications/
> init/controllers/admincms.py", line 380, in logo
>     label.components = label.components[-2]
> IndexError: list index out of range
>
> This error somehow has something to do with deletable being set to
> True or False i.e this works:
>
> form=crud.update(table=db.tagline,...,deletable=False)
> for label in form.elements('label'):
>     label.components = label.components[-2]
>
> ... and this doesn't work:
>
> form=crud.update(table=db.tagline,...,deletable=True)
> for label in form.elements('label'):
>     label.components = label.components[-2]
>
> Is there a solutions for this problem?
>
> Kind regards,
>
> Annet


[web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread Massimo Di Pierro
never seen this before. can you try trunk?

On Jul 25, 6:44 am, António Ramos  wrote:
> Hello, when i try to acces my server admin remotely with FQDN and not by ip
> i get this error
>
> *Ticket issued: unrecoverable*
>
> Why?
>
> thank you


[web2py] Re: cron problem

2011-07-25 Thread Massimo Di Pierro
Please open a ticket. Does it behave better is 30 6 * and 30 14* are
replaced by 0 6 * and 0 14 *?

On Jul 25, 6:22 am, Manuele Pesenti  wrote:
> dear all,
> I have a strange problem with cron it seams it does not respect what I
> have eritten in crontab... this is my crontab:
>
> 30 6 * * *  root *cron/fetch_m_data
> 0 7 * * *  root *default/send_mail_msg
> 30 14 * * *  root *cron/fetch_x_data
> 0 21 * * *  root *cron/fetch_m_data
> 0 23 * * *  root *cron/fetch_x_data
>
> and every function called at the end send me an email so I can
> monitorize what happens... the result is that I receive emails every day
> who say that:
>
> at 3:00 AM fetch_m_data is performed
> at 5:00 AM fetch_x_data is performed
> at 12:30 fetch_m_data is performed
> at 20:30 fetch_m_data is performed again
> send_mail_msg is never performed (it sends another message)
>
> can you help me?
>
> thanks a lot
>
>         Manuele


Re: [web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread António Ramos
Sorry, i´m no expert.

What do you mean?
try trunk?

Sorry
António

2011/7/25 Massimo Di Pierro 

> never seen this before. can you try trunk?
>
> On Jul 25, 6:44 am, António Ramos  wrote:
> > Hello, when i try to acces my server admin remotely with FQDN and not by
> ip
> > i get this error
> >
> > *Ticket issued: unrecoverable*
> >
> > Why?
> >
> > thank you
>


Re: [web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread António Ramos
this is the link
http://apps.cires.pt:10800/Lims/Default/index
if you try
http://194.65.91.152:10800/Lims/Default/index
 it works ok

António

Em 25 de julho de 2011 13:37, António Ramos  escreveu:

> Sorry, i´m no expert.
>
> What do you mean?
> try trunk?
>
> Sorry
> António
>
> 2011/7/25 Massimo Di Pierro 
>
>> never seen this before. can you try trunk?
>>
>> On Jul 25, 6:44 am, António Ramos  wrote:
>> > Hello, when i try to acces my server admin remotely with FQDN and not by
>> ip
>> > i get this error
>> >
>> > *Ticket issued: unrecoverable*
>> >
>> > Why?
>> >
>> > thank you
>>
>
>


[web2py] Extend default user/group model

2011-07-25 Thread Simone Fiorenzoni
Hi to all,

when I create a new application, the user/group db model  is created
automatically.
How can I extend it? Should I redefine it?
I would like to add some fields and some foreign keys to users or
group.

Thanks to all! (... and sorry for my english)


Re: [web2py] Re: cron problem

2011-07-25 Thread Manuele Pesenti

On 25/07/2011 14:33, Massimo Di Pierro wrote:

Please open a ticket. Does it behave better is 30 6 * and 30 14* are
replaced by 0 6 * and 0 14 *?


can you tell me how to open a ticket?

the fact is that the same application runs correctly in my local laptop 
(Debian testing) and not on the production server (CentOS 5.6).
I installed the app on a new web2py installation (both 1.96.4 and 
1.97.1) but nothing changes... the daemon runs under mod_proxy, is there 
some cron information saved outside web2py installation directory? maybe 
that is the result of other oldest w2p installation?


thanks again

Manuele


Re: [web2py] upload - S3 storage

2011-07-25 Thread nils
HI,

Just looking at dal.py and there is a SQLCustomType, I was wondering
if the functionality i would require could be added via  this class?,
Would this be the way to go ?

Nils


On Mon, Jul 25, 2011 at 1:04 PM, Nils Olofsson  wrote:
> Hi all,
>
>  Before I go off and make an  attempt at creating a S3 upload
> function, I was just wondering if anyone has a working version ?
>
> I read the discussion on this and for me I need a way of storing
> uploaded images on S3 to share between a few  VPS on Amazon's EC2.
>
> The only other way to accomplish the same thing would be to use rsync,
> which is not ideal.
>
> I want to stay within the functionality of web2py SQLforms, maybe by
> having the field type 'uploadS3' so web2py would know that the file is
> going to be uploaded to amazons S3 service.
>
> Is this a good approach ?
>
> So far I've only used the functionality of web2py, I never had to
> change or customize it, so any help or pointer would be appreciated.
>
> Regards,
>
> Nils


Re: [web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread António Ramos
Its working.
Was a DNS problem.
Sorry

Em 25 de julho de 2011 13:51, António Ramos  escreveu:

> this is the link
> http://apps.cires.pt:10800/Lims/Default/index
> if you try
> http://194.65.91.152:10800/Lims/Default/index
>  it works ok
>
> António
>
> Em 25 de julho de 2011 13:37, António Ramos escreveu:
>
> Sorry, i´m no expert.
>>
>> What do you mean?
>> try trunk?
>>
>> Sorry
>> António
>>
>> 2011/7/25 Massimo Di Pierro 
>>
>>> never seen this before. can you try trunk?
>>>
>>> On Jul 25, 6:44 am, António Ramos  wrote:
>>> > Hello, when i try to acces my server admin remotely with FQDN and not
>>> by ip
>>> > i get this error
>>> >
>>> > *Ticket issued: unrecoverable*
>>> >
>>> > Why?
>>> >
>>> > thank you
>>>
>>
>>
>


[web2py] Re: Extend default user/group model

2011-07-25 Thread Anthony
See http://web2py.com/book/default/chapter/08#Customizing-Auth. Make sure 
you define your custom tables after you instantiate Auth, but before you 
call auth.define_tables().
 
Anthony

On Monday, July 25, 2011 7:23:05 AM UTC-4, Simone Fiorenzoni wrote:

> Hi to all, 
>
> when I create a new application, the user/group db model  is created 
> automatically. 
> How can I extend it? Should I redefine it? 
> I would like to add some fields and some foreign keys to users or 
> group. 
>
> Thanks to all! (... and sorry for my english)



[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Anthony
I updated the book -- added args='db' to the URL() call. Does that make it 
work?
 
Anthony

On Monday, July 25, 2011 2:28:26 AM UTC-4, jc wrote:

> Maybe the fix is just remove it from the manual, since the 
> instructions in the manual don't work. 
>
> On Jul 24, 9:40 am, Massimo Di Pierro  
> wrote: 
> > P.S. I would not suggest using this for anything else by appadmin. 
> > 
> > On Jul 24, 3:39 am, Massimo Di Pierro  
> > wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > The fact is that is how it works but the manual may be incorrect. 
> > 
> > > linkto is used for appadmin and appadmin wants to know which od is 
> > > involved in the query,for example 
> > 
> > > db.table.field==1 
> > 
> > > so linkto has to be of the form URL('action',args='db') 
> > 
> > > It has been so for two years. It cannot be changed without breaking 
> > > appadmin. 
> > 
> > > Massimo 
> > 
> > > On Jul 22, 11:05 am, DenesL  wrote: 
> > 
> > > > Yes, I can reproduce it running web2py 1.97.1 from source on Windows. 
>
> > 
> > > > >>> link=URL('list_records') 
> > > > >>> print link 
> > 
> > > > /test/default/list_records>>> form = SQLFORM(db.person,1,linkto=link) 
>
> > > > >>> print form.element('#dog__owner__row') 
> > 
> > > >  class="w2p_fw"> > > > class="reference" href="/test/default/list_records/dog? 
> > > > query=list_records.dog.owner%3D%3D1">dog.owner > > > class="w2p_fc"> 
> > 
> > > > sqlhtml.py line 845 does not seem right on getting db: 
> > > > db = linkto.split('/')[-1] 
> > 
> > > > but is seems strange that nobody has complained about it before since 
>
> > > > that has been in place for a few releases back. 
> > 
> > > > Denes. 
> > 
> > > > On Jul 21, 1:18 pm, Massimo Di Pierro  
> > > > wrote: 
> > 
> > > > > I cannot reproduce this. Can anybody else? 
> > 
> > > > > On Jul 18, 8:13 pm, tcab  wrote: 
> > 
> > > > > > Ok - added issue ashttp://
> code.google.com/p/web2py/issues/detail?id=340 
> > 
> > > > > > On Jul 15, 9:45 am, Anthony  wrote: 
> > 
> > > > > > > Please submit an issue on Google Code:
> http://code.google.com/p/web2py/issues/list 
> > 
> > > > > > > On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote: 
> > > > > > > > I get this too - a spurious "list_records." prepended to the 
> query. 
> > > > > > > > Latest web2py 1.97.1 
> > 
> > > > > > > > -Andy 
> > 
> > > > > > > > On Jul 12, 10:08 pm, jc  wrote: 
> > > > > > > > > Hi, 
> > > > > > > > > Trying to uselinkto, so following example in web2py book< 
> > > > > > > >
> http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...> 
> > > > > > > > first, 
> > > > > > > > > to try to understand. 
> > 
> > > > > > > > > I have copied the example with person and dog tables, in 
> particular in 
> > > > > > > > def 
> > > > > > > > > display_form(): I have 
> > 
> > > > > > > > > link = URL('list_records') 
> > > > > > > > > form = SQLFORM(db.person, record, deletable=True, 
> > > > > > > > >   upload=url,linkto=link, labels = 
> {'dog.owner':"This 
> > > > > > > > > person's dogs"}) 
> > 
> > > > > > > > > as described in the book. 
> > 
> > > > > > > > > The books says the link generated will be 
> > > > > > > > > "/test/default/list_records/dog?query=dog.owner%3D5" but in 
> fact the link 
> > 
> > > > > > > > > which appears when I visit /test/default/display_form/1 is 
> > > > > > > > > 
>  "/test/default/list_records/dog?query=list_records.dog.owner%3D%3D1", 
> > > > > > > > i.e. 
> > > > > > > > > there is a spurious list.records and a spurious %3D. Not 
> surprisingly the 
> > 
> > > > > > > > > link doesn't work. Can anybody tell me what I am doing 
> wrong? 
> > 
> > > > > > > > > Thanks.



Re: [web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread Kenneth Lundström

What kind of a problem was it?


Kenneth


Its working.
Was a DNS problem.
Sorry

Em 25 de julho de 2011 13:51, António Ramos > escreveu:


this is the link
http://apps.cires.pt:10800/Lims/Default/index
if you try
http://194.65.91.152:10800/Lims/Default/index
 it works ok

António

Em 25 de julho de 2011 13:37, António Ramos mailto:ramstei...@gmail.com>> escreveu:

Sorry, i´m no expert.

What do you mean?
try trunk?

Sorry
António

2011/7/25 Massimo Di Pierro mailto:massimo.dipie...@gmail.com>>

never seen this before. can you try trunk?

On Jul 25, 6:44 am, António Ramos mailto:ramstei...@gmail.com>> wrote:
> Hello, when i try to acces my server admin remotely with
FQDN and not by ip
> i get this error
>
> *Ticket issued: unrecoverable*
>
> Why?
>
> thank you








[web2py] How to debug HTTP 500 error on GAE?

2011-07-25 Thread Wikus van de Merwe
I'm using the latest GAE 1.5.2 and web2py 1.96.4. When I run the application 
with:
python2.5 /opt/gae-python-sdk/dev_appserver.py --port 8001 ./web2py
and open http://localhost:8001 in a browser I get the HTTP 500 internal 
server error.

There is no message in the appserver console output, there is also no error 
file in
web2py/applications/init/errors. I've also deployed the app to GAE as test 
version
to check if there would be some info in the log, but there was none.

How can I debug this? There must be a reason why web2py is generating the 
error
but I don't know where to look for clues.




Re: [web2py] Re: blob attach field issue with 1.97.1

2011-07-25 Thread Richard Vézina
Hello Massimo,

Still can't figure out where the problem comes from...

Your help would be appreciate.

Richard

On Fri, Jul 22, 2011 at 9:43 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Can you please try:
>
> Field('field1','upload',uploadfield='field1_blob'),
>
> Field('field1_blob','blob',deafult='',writable=False,readable=False),
>
> this should work even if you omit the blob field.
>
> On Jul 22, 8:30 am, Richard  wrote:
> > My email won't get into my mail box... And I get no answer... So
> > excuse the duplication if you get it twice...
> >
> > Hello,
> >
> > I get errors on update. 2 differents errors are return depending if
> > the file is attach before update or at the update of the form.
> >
> > Model definition field
> > Field('field1','upload',uploadfield='field1_blob'),
> > Field('field1_blob','blob'),
> >
> > Error1 (file already attached when record was create) :
> >
> > Traceback (most recent call last):
> >
> >   File "/version_197-1/web2py/gluon/restricted.py", line 192, in
> > restricted
> >
> > exec ccode in environment
> >
> >   File "/version_197-1/web2py/applications/sgddms/controllers/
> > test.py", line 1338, in 
> >
> >   File "/version_197-1/web2py/gluon/globals.py", line 137, in 
> >
> > self._caller = lambda f: f()
> >
> >   File "/version_197-1/web2py/gluon/tools.py", line 2448, in f
> >
> > return action(*a, **b)
> >
> >   File "/version_197-1/web2py/applications/sgddms/controllers/
> > test.py", line 465, in update
> >
> > if form.accepts(request.vars, session):
> >
> >   File "/version_197-1/web2py/gluon/sqlhtml.py", line 1203, in accepts
> >
> > self.table._db(self.table._id == self.record.id).update(**fields)
> >
> >   File "/version_197-1/web2py/gluon/dal.py", line 5403, in update
> >
> > fields = self.db[tablename]._listify(update_fields,update=True)
> >
> >   File "/version_197-1/web2py/gluon/dal.py", line 4679, in _listify
> >
> > raise SyntaxError, 'Field %s does not belong to the table' % name
> >
> > SyntaxError: Field field1__delete does not belong to the table
> >
> > Error2 (file is attached when record was verify on a update form an
> > already created record) :
> >
> > Traceback (most recent call last):
> >
> >   File "/version_197-1/web2py/gluon/restricted.py", line 192, in
> > restricted
> >
> > exec ccode in environment
> >
> >   File "/version_197-1/web2py/applications/sgddms/controllers/
> > test.py", line 1338, in 
> >
> >   File "/version_197-1/web2py/gluon/globals.py", line 137, in 
> >
> > self._caller = lambda f: f()
> >
> >   File "/version_197-1/web2py/gluon/tools.py", line 2448, in f
> >
> > return action(*a, **b)
> >
> >   File "/version_197-1/web2py/applications/sgddms/controllers/
> > test.py", line 465, in update
> >
> > if form.accepts(request.vars, session):
> >
> >   File "/version_197-1/web2py/gluon/sqlhtml.py", line 1203, in accepts
> >
> > self.table._db(self.table._id == self.record.id).update(**fields)
> >
> >   File "/version_197-1/web2py/gluon/dal.py", line 5403, in update
> >
> > fields = self.db[tablename]._listify(update_fields,update=True)
> >
> >   File "/version_197-1/web2py/gluon/dal.py", line 4679, in _listify
> >
> > raise SyntaxError, 'Field %s does not belong to the table' % name
> >
> > SyntaxError: Field field1_newfilename does not belong to the table
> >
> > Is there something to change with the model definition for attachement
> > with 1.97.1 or is it a issue?
> >
> > Thanks
> >
> > Richard
>


Re: [web2py] Re: Ticket issued: unrecoverable

2011-07-25 Thread António Ramos
Our domain is CIRES.pt
we have an internal dns for cires where we did not create the
app.cires.ptrecord.
i created the app.cires.pt only in my external dns.

When i tested for app.cires.pt the web2py "server" pc tried to resolve
internaly and gave that error.

I saw in the log of web2py this error

*ERROR:web2py:Traceback (most recent call last):*
*File "gluon/main.py", line 395 , in wsgibase*
*gaierror:(11001,'getaddrinfo failed')*

so i suspected of DNS problems.
I changed the web2py server pc dns servers to 8.8.8.8 and voilá, problem
solved.

Hope this helps

António





2011/7/25 Kenneth Lundström 

>  What kind of a problem was it?
>
>
> Kenneth
>
>
>  Its working.
>  Was a DNS problem.
> Sorry
>
> Em 25 de julho de 2011 13:51, António Ramos escreveu:
>
>> this is the link
>>  http://apps.cires.pt:10800/Lims/Default/index
>> if you try
>> http://194.65.91.152:10800/Lims/Default/index
>>  it works ok
>>
>>  António
>>
>> Em 25 de julho de 2011 13:37, António Ramos escreveu:
>>
>>  Sorry, i´m no expert.
>>>
>>>  What do you mean?
>>> try trunk?
>>>
>>>  Sorry
>>> António
>>>
>>> 2011/7/25 Massimo Di Pierro 
>>>
 never seen this before. can you try trunk?

 On Jul 25, 6:44 am, António Ramos  wrote:
 > Hello, when i try to acces my server admin remotely with FQDN and not
 by ip
 > i get this error
 >
 > *Ticket issued: unrecoverable*
 >
 > Why?
 >
 > thank you

>>>
>>>
>>
>
>


[web2py] JQuery Mobile plugin . No date picker ?

2011-07-25 Thread António Ramos
no datepicker in jquery mobile plugin?


thank you

António


[web2py] REPRODUCED : blob attach field issue with 1.97.1

2011-07-25 Thread Richard
Hello,

I report a problem last week... I finally be able to reproduce... It
needs form.accept() to reproduce the problem...

I attach a app that reproduce the problem.

Thanks

Richard

PS.: I will attach the app when the mail get on the list.


[web2py] DAL left join problems

2011-07-25 Thread Cliff
This query works as expected in the sqlite command line client:

SELECT first_name, course_id FROM auth_user LEFT JOIN
training_requirements ON auth_user.id = training_requirements.user_id
WHERE course_id=8 OR course_id IS NULL;

It returns one and only one row for each record in auth_user and the
course_id where there is one and a null value where there is not.

Here's how I write the DAL select:

myrows = db((db.training_requirements.course_id==8) or
(db.training_requirements.course_id==None)).select(
db.auth_user.first_name,
db.training_requirements.course_id,
left=db.training_requirements.on(
 
db.training_requirements.user_id==db.auth_user.id
   ))

This query only returns those rows where
training_requirements.course_id is equal to 8, whereas the native
sqlite query returned rows that met either of the two criteria.

What am I doing wrong?  Or does the DAL not handle a query like this?


[web2py] web2py for freelance work

2011-07-25 Thread spiffytech
I'm picking out a framework to use for freelance web development. Does
anyone use web2py in that sort of situation? How does it fare? Do you
find anything particularly limiting or particularly easy? How do
clients respond when you tell them you're building the site in Python
(not PHP), and that you're building it in one of the less-common
frameworks?


[web2py] Re: upload - S3 storage

2011-07-25 Thread Nils Olofsson
Hi,

This is what I have done so far, really rough.

I have extended the Field class and added some extra functions.

I called the class s3upload and I created function within the class
called s3_store and s3_retrieve.
I was just wondering if upon creating these classes. I.E creating the
same functionality as the default store/retrieve will this work out of
the box if i replace in the Field ('photo','s3upload') or is there
other things i need to be looking at ?

This is assuming that all the bugs of uploading and retrieving will be
sorted :)

Regards,

Nils


On Jul 25, 2:10 pm, nils  wrote:
> HI,
>
> Just looking at dal.py and there is a SQLCustomType, I was wondering
> if the functionality i would require could be added via  this class?,
> Would this be the way to go ?
>
> Nils
>
>
>
>
>
>
>
> On Mon, Jul 25, 2011 at 1:04 PM, Nils Olofsson  
> wrote:
> > Hi all,
>
> >  Before I go off and make an  attempt at creating a S3 upload
> > function, I was just wondering if anyone has a working version ?
>
> > I read the discussion on this and for me I need a way of storing
> > uploaded images on S3 to share between a few  VPS on Amazon's EC2.
>
> > The only other way to accomplish the same thing would be to use rsync,
> > which is not ideal.
>
> > I want to stay within the functionality of web2py SQLforms, maybe by
> > having the field type 'uploadS3' so web2py would know that the file is
> > going to be uploaded to amazons S3 service.
>
> > Is this a good approach ?
>
> > So far I've only used the functionality of web2py, I never had to
> > change or customize it, so any help or pointer would be appreciated.
>
> > Regards,
>
> > Nils


[web2py] Re: DAL left join problems

2011-07-25 Thread Cliff
Found it, but don't know what to do about it.

Here is what the DAL is spitting out:

SELECT  auth_user.first_name, training_requirements.course_id FROM
auth_user LEFT JOIN training_requirements ON
(training_requirements.user_id = auth_user.id) WHERE
(((training_requirements.course_id = 8) OR
(training_requirements.course_id IS NULL)) AND
(training_requirements.request_tenant = '1'));

The tail end of the query should be like this:
AND((training_requirements.request_tenant = '1') |
(training_requirements.request_tenant IS NULL))

What I really want to do is check the auth_user entries against the
request tenant.  Training_requirements is just a link table and I
don't really see a need to protect those records since the objects on
both ends of the link get protection.

I really don't want to start writing native SQL to work around this.


Re: [web2py] Re: DAL left join problems

2011-07-25 Thread Richard Vézina
Could you post your models...

You can make view at DB level and define a web2py model of your view... It
help to get things done sometime and you can come back later and build
web2py query correctly.

Richard

On Mon, Jul 25, 2011 at 1:45 PM, Cliff  wrote:

> Found it, but don't know what to do about it.
>
> Here is what the DAL is spitting out:
>
> SELECT  auth_user.first_name, training_requirements.course_id FROM
> auth_user LEFT JOIN training_requirements ON
> (training_requirements.user_id = auth_user.id) WHERE
> (((training_requirements.course_id = 8) OR
> (training_requirements.course_id IS NULL)) AND
> (training_requirements.request_tenant = '1'));
>
> The tail end of the query should be like this:
> AND((training_requirements.request_tenant = '1') |
> (training_requirements.request_tenant IS NULL))
>
> What I really want to do is check the auth_user entries against the
> request tenant.  Training_requirements is just a link table and I
> don't really see a need to protect those records since the objects on
> both ends of the link get protection.
>
> I really don't want to start writing native SQL to work around this.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread DenesL
Nope.

>>> link = URL('list_records', args='db')
>>> link
'/test/default/list_records/db'

The link for id = 1 will be e.g.:
http://127.0.0.1:8000/test/test/list_records/db/dog?query=db.dog.owner%3D%3D1

where the query part looks better but it still fails:

Traceback (most recent call last):
  File "C:\w2p\web2py_1.97.1_src\gluon\restricted.py", line 192, in
restricted
exec ccode in environment
  File "C:/w2p/web2py_1.97.1_src/applications/test/controllers/
test.py", line 89, in 
  File "C:\w2p\web2py_1.97.1_src\gluon\globals.py", line 137, in

self._caller = lambda f: f()
  File "C:/w2p/web2py_1.97.1_src/applications/test/controllers/
test.py", line 34, in list_records
rr = db(db.dog.id == dogid).select()
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 5394, in select
return self.db._adapter.select(self.query,fields,attributes)
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 1168, in select
sql = self._select(query,fields,attributes)
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 1078, in _select
sql_w = ' WHERE ' + self.expand(query)
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 937, in expand
return expression.op(expression.first, expression.second)
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 886, in EQ
return '(%s = %s)' %
(self.expand(first),self.expand(second,first.type))
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 943, in expand
return self.represent(expression,field_type)
  File "C:\w2p\web2py_1.97.1_src\gluon\dal.py", line 1280, in
represent
return str(int(obj))
ValueError: invalid literal for int() with base 10: 'db'



On Jul 25, 10:09 am, Anthony  wrote:
> I updated the book -- added args='db' to the URL() call. Does that make it
> work?
>
> Anthony
>
>
>
>
>
>
>
> On Monday, July 25, 2011 2:28:26 AM UTC-4, jc wrote:
> > Maybe the fix is just remove it from the manual, since the
> > instructions in the manual don't work.
>
> > On Jul 24, 9:40 am, Massimo Di Pierro 
> > wrote:
> > > P.S. I would not suggest using this for anything else by appadmin.
>
> > > On Jul 24, 3:39 am, Massimo Di Pierro 
> > > wrote:
>
> > > > The fact is that is how it works but the manual may be incorrect.
>
> > > > linkto is used for appadmin and appadmin wants to know which od is
> > > > involved in the query,for example
>
> > > > db.table.field==1
>
> > > > so linkto has to be of the form URL('action',args='db')
>
> > > > It has been so for two years. It cannot be changed without breaking
> > > > appadmin.
>
> > > > Massimo
>
> > > > On Jul 22, 11:05 am, DenesL  wrote:
>
> > > > > Yes, I can reproduce it running web2py 1.97.1 from source on Windows.
>
> > > > > >>> link=URL('list_records')
> > > > > >>> print link
>
> > > > > /test/default/list_records>>> form = SQLFORM(db.person,1,linkto=link)
>
> > > > > >>> print form.element('#dog__owner__row')
>
> > > > >  > class="w2p_fw"> > > > > class="reference" href="/test/default/list_records/dog?
> > > > > query=list_records.dog.owner%3D%3D1">dog.owner > > > > class="w2p_fc">
>
> > > > > sqlhtml.py line 845 does not seem right on getting db:
> > > > > db = linkto.split('/')[-1]
>
> > > > > but is seems strange that nobody has complained about it before since
>
> > > > > that has been in place for a few releases back.
>
> > > > > Denes.
>
> > > > > On Jul 21, 1:18 pm, Massimo Di Pierro 
> > > > > wrote:
>
> > > > > > I cannot reproduce this. Can anybody else?
>
> > > > > > On Jul 18, 8:13 pm, tcab  wrote:
>
> > > > > > > Ok - added issue ashttp://
> > code.google.com/p/web2py/issues/detail?id=340
>
> > > > > > > On Jul 15, 9:45 am, Anthony  wrote:
>
> > > > > > > > Please submit an issue on Google Code:
> >http://code.google.com/p/web2py/issues/list
>
> > > > > > > > On Friday, July 15, 2011 1:33:22 AM UTC-4, tcab wrote:
> > > > > > > > > I get this too - a spurious "list_records." prepended to the
> > query.
> > > > > > > > > Latest web2py 1.97.1
>
> > > > > > > > > -Andy
>
> > > > > > > > > On Jul 12, 10:08 pm, jc  wrote:
> > > > > > > > > > Hi,
> > > > > > > > > > Trying to uselinkto, so following example in web2py book<
>
> >http://www.web2py.com/book/default/chapter/07#Links-to-Referencing-Re...>
> > > > > > > > > first,
> > > > > > > > > > to try to understand.
>
> > > > > > > > > > I have copied the example with person and dog tables, in
> > particular in
> > > > > > > > > def
> > > > > > > > > > display_form(): I have
>
> > > > > > > > > > link = URL('list_records')
> > > > > > > > > > form = SQLFORM(db.person, record, deletable=True,
> > > > > > > > > >                   upload=url,linkto=link, labels =
> > {'dog.owner':"This
> > > > > > > > > > person's dogs"})
>
> > > > > > > > > > as described in the book.
>
> > > > > > > > > > The books says the link generated will be
> > > > > > > > > > "/test/default/list_records/dog?query=dog.owner%3D5" but in
> > fact the link
>
> > > > > > > > > > which appears when I visit /test/default/display_form/1 is
>
> >  "/test/default/list_records/d

Re: [web2py] web2py for freelance work

2011-07-25 Thread Ismael Serratos
Hi spiffytech in my experience:

1.- Yes I use it, mostly for intranet apps.
2.- Well... difficult question...
3.- It's really easy (if the customer has its own server), if not, you have
to look for a good one.
4.- If the customer knows something about programming he says 'wow', if the
customer knows about old school system development, I mean, Java, Struts,
ASP (not asp.net), or plain PHP, he just says: "NO", and if the customer
doesn't know too much about development and he asks you to see the source,
He isn't going to believe you that that's the code (because is so clean and
cute, and almost all people think about a good system with large code and a
nightmare of java frameworks)
5.- Almost every customer doesn't care about what you use, they care about
having a good solution in a short time.

So in general I recommend you to use web2py for freelance or not for
freelance jobs. It's a nice framework, in fact a beautiful one.

On Mon, Jul 25, 2011 at 12:26 PM, spiffytech  wrote:

> I'm picking out a framework to use for freelance web development. Does
> anyone use web2py in that sort of situation? How does it fare? Do you
> find anything particularly limiting or particularly easy? How do
> clients respond when you tell them you're building the site in Python
> (not PHP), and that you're building it in one of the less-common
> frameworks?


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread DenesL
The original book had:



When editing an existing person, the appadmin UPDATE form shows a link
to a page that lists the dogs that belong to the person. This behavior
can be replicated using the linkto argument of the SQLFORM. linkto has
to point to the URL of a new action that receives a query string from
the SQLFORM and lists the corresponding records. Here is an example:

def display_form():
   record = db.person(request.args(0)) or redirect(URL('index'))
   url = URL('download')
   link = URL('list_records')
   form = SQLFORM(db.person, records, deletable=True, upload=url,
linkto=link)
   if form.accepts(request.vars, session):
  response.flash = 'form accepted'
   elif form.errors:
  response.flash = 'form has errors'
   return dict(form=form)



So the questions are:
- Why was this changed?.
- Does anybody use it this way?.


[web2py] Re: web2py for freelance work

2011-07-25 Thread Anthony
See http://www.experts4solutions.com/.

On Monday, July 25, 2011 1:26:16 PM UTC-4, spiffytech wrote:

> I'm picking out a framework to use for freelance web development. Does 
> anyone use web2py in that sort of situation? How does it fare? Do you 
> find anything particularly limiting or particularly easy? How do 
> clients respond when you tell them you're building the site in Python 
> (not PHP), and that you're building it in one of the less-common 
> frameworks?



Re: [web2py] web2py for freelance work

2011-07-25 Thread Kenneth Lundström
> I'm picking out a framework to use for freelance web development. 
Does anyone use web2py in that sort of situation? How does it fare? Do 
you find anything particularly limiting or particularly easy? How do 
clients respond when you tell them you're building the site in Python 
(not PHP), and that you're building it in one of the less-common frameworks?


The first project I was in was supposed to be done in Drupal (PHP). Guy 
in charge of the project changed to web2py for some reason unknown to 
me. I think the change was good, but it was a little bit hard to tell 
the customer about the change without asking first.


After that I havn´t discussed the framework with customers, so far no 
one has been intrested in the it.



Kenneth



[web2py] References and markmin

2011-07-25 Thread Martin Weissenboeck
Hi,

the markmin manual says about references

Citations and References

Citations are treated as internal links in html and proper citations in
latex if there is a final section called "References".
But I want to use the German word "Literaturverzeichnis" instead of
"References".- what shall I do?

And if I want to have a title "# xxx" and not a section "## xxx"?

Regards, Martin


[web2py] Re: DAL left join problems

2011-07-25 Thread Cliff
I think the answer may be to manually insert the request_tenant field
where I want it.

I really only want it in the tables that represent objects, not in the
many-to-many linking tables.
Thanks, Richard.

I got it working.

The table structure is really pretty simple.  It's lifted from a
working PHP app that I currently have in production.

I'm using the generic user_auth table with a few fields added for
middle names, generation indicators and so on.

The training_requirements table is a simple linking table.

On Jul 25, 2:01 pm, Richard Vézina 
wrote:
> Could you post your models...
>
> You can make view at DB level and define a web2py model of your view... It
> help to get things done sometime and you can come back later and build
> web2py query correctly.
>
> Richard
>
>
>
>
>
>
>
> On Mon, Jul 25, 2011 at 1:45 PM, Cliff  wrote:
> > Found it, but don't know what to do about it.
>
> > Here is what the DAL is spitting out:
>
> > SELECT  auth_user.first_name, training_requirements.course_id FROM
> > auth_user LEFT JOIN training_requirements ON
> > (training_requirements.user_id = auth_user.id) WHERE
> > (((training_requirements.course_id = 8) OR
> > (training_requirements.course_id IS NULL)) AND
> > (training_requirements.request_tenant = '1'));
>
> > The tail end of the query should be like this:
> > AND((training_requirements.request_tenant = '1') |
> > (training_requirements.request_tenant IS NULL))
>
> > What I really want to do is check the auth_user entries against the
> > request tenant.  Training_requirements is just a link table and I
> > don't really see a need to protect those records since the objects on
> > both ends of the link get protection.
>
> > I really don't want to start writing native SQL to work around this.


[web2py] web2py GAE and memory usage

2011-07-25 Thread howesc
Hi all,

i'm wondering if anyone has thoughts on how memory management works 
with regards to the the DAL and GAE.

i have some "taskqueue" tasks on GAE that are invoked via GAE cron to 
aggregate data for me on a daily basis.  these operations can work on 500 or 
more records per invocation.  sometimes i get messages in my logs like:

Exceeded soft process size limit with 211.586 MB after servicing 1 requests 
total

now i know i do a big query, but at the end of the request that object 
should go out of scope and be destroyed right?  and why would 500 records 
take up that much space?  are there technniques that i can use to not take 
up that much ram (other than query smaller sets, which doesn't seem to help 
if i do 5 queries of 100 and it takes more time)

thanks for your thoughts!

christian



[web2py] Re: Database auditing - comments please

2011-07-25 Thread nick name
Newer version attached, has been tested in one specific app which brought up 
some issues with tables that have references to them (these have been 
fixed).

Now patches instance instead of class (so web2py's normal reloading works 
equally well)

Massimo / Jonathan - could you comment on the probability that something 
like this would be added to the main web2py distribution? At the very least, 
hooks that one could use to implement such audit/authorization/logging 
functionality without having to patch adapters?

I'd be happy to contribute a patch for this, if you give me an indication of 
how you'd like to see it implemented, if at all.

#
# General audit support for web2py:
#  When a table is set to be "audited", a shadow table is defined for
#  it, with 3 additional fields: "oid" (for original id), "audit_time", "audit_user", "audit_type" (insert/update/delete)
# on insert: after insert, the new record is copied to audit table
# on update: after update, the new records are copied to the audit table
# on delete: before deleting, records are copied to the audit table with audit_delete=true
# 
# no new/additional transactions. that is, rollback will also roll back the audit; commit
# will also commit the audit.

# TODO: deactivate "on delete cascade" actions -> turn them to "restrict" or even drop the reference?
# TODO: add "idtype" to adapter - a type that can be used to store id - a "weak" reference
# TODO: is there a char(1) record type? audit_type would benefit from that

class AuditError(RuntimeError): 
pass

from gluon.dal import Set as SetClassToIgnore

AUDIT_OID = Field("audit_oid", "integer") # -> switch to idtype/weak reference
AUDIT_TIME = Field("audit_time", "datetime")
AUDIT_USER = Field("audit_user", "string") # or auth_user
AUDIT_TYPE  = Field("audit_type", "integer") # 1=insert, 2=update, 3=delete 
AUDIT_FIELDS = [AUDIT_OID, AUDIT_TIME, AUDIT_USER, AUDIT_TYPE]

AUDIT_TYPE_INSERT = 1
AUDIT_TYPE_UPDATE = 2
AUDIT_TYPE_DELETE = 3
AUDIT_TEMPLATE = 'audit_%s'

def audited_record(shadow, record, audit_type):
"""Make a record into the audit record with a given type in place"""
record[AUDIT_OID.name] = record.id
del record['id'] # audit records gets their own id
del record['update_record'] # since we retrieve id, we get this ?!!?
del record['delete_record'] # since we retrieve id, we get this ?!?!
for k, v in record.items():
if isinstance(v, SetClassToIgnore): # since we retrieve id, we get these for all referencing tables
del record[k]
record[AUDIT_TIME.name] = request.now
record[AUDIT_USER.name] = 'unknown'
record[AUDIT_TYPE.name] = audit_type
shadow.insert(**record)


def audited_insert(self, table, fields):
shadow = self.shadow.get(table._tablename)
if not shadow: return self.unaudited_insert(table, fields)

rid = self.unaudited_insert(table, fields)
if isinstance(rid, int): # either int or Reference
record = table[int(rid)] # retrieve just inserted record
audited_record(shadow, record, AUDIT_TYPE_INSERT)
return rid
raise AuditError, "Cannot audit inserts to table %s"%table

# TODO: how do we audit a change to id? should we block it?
def audited_update(self, tablename, query, fields):
shadow = self.shadow.get(tablename)
if not shadow: return self.unaudited_update(tablename, query, fields)
db = self.db
table = db[tablename]

# find which records are about to be updated by this 
rows = self.select(query, ['id'], {})
rows = [x['id'] for x in rows] # we only care about the ids.

count = self.unaudited_update(tablename, query, fields) # do the update
# retrieve updated records
rows = self.select(table.id.belongs(rows), [str(field) for field in table], {})
for record in rows:
audited_record(shadow, record, AUDIT_TYPE_UPDATE)
return count

def audited_delete(self, tablename, query):
shadow = self.shadow.get(tablename)
if not shadow: return self.unaudited_delete(table, query)
db = self.db
table = db[tablename]

# retrieve records about to be deleted
rows = self.select(query, [str(field) for field in table], {})

count = self.unaudited_delete(tablename, query) # do the delete
# retrieve updated records
for record in rows:
audited_record(shadow, record, AUDIT_TYPE_DELETE)
return count

# using magic described in:
# http://stackoverflow.com/questions/1015307/python-bind-an-unbound-method
def patch_adapter(a):
if hasattr(a, 'shadow'): return
print 'patching adapter %s' % id(a)
a.shadow = {} # patch instance every time
a.unaudited_insert = a.insert
a.unaudited_delete = a.delete
a.unaudited_update = a.update
a.insert = audited_insert.__get__(a, a.__class__)
a.update = audited_update.__get__(a, a.__class__)
a.delete = audited_delete.__get__(a, a.__class__)

# remove field constraints when creating audit table.
# TODO - switch all

[web2py] Re: upload - S3 storage

2011-07-25 Thread pbreit
Creating a custom filed type seems unnecessary. "upload" fields end up just 
being filenames. Perhaps you could have a compute field that uploads the 
image to S3. Retrieving should just be a simple URL reference.

[web2py] Re: upload - S3 storage

2011-07-25 Thread pbreit
And you might want to have a look at "boto" for a Python interface to 
Amazon.

[web2py] Re: Extend default user/group model

2011-07-25 Thread pbreit
Also, "extra_fields" was recently added:

- auth.settings.extra_fields['auth_user'].append(Field('country')) 
allows to extend auth_* tables without need of definiting a custom 
auth_* table. Must be placed before auth.define_tables() 


[web2py] Re: About the About page

2011-07-25 Thread pbreit
I'm not totally sure what you are looking for but adding static pages is 
pretty easy.

I usually put them in default.py so they are at the top level but you could 
put them anywhere.

A one liner in a controller file:

def about(): return dict()

And whatever you want in a view file.


Re: [web2py] The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Kenneth Lundström

Really awsome Bruno,

I´m trying to implement it on our companys intranet and got one question 
and one suggestion.


Is it possible to use T() on headers? Something like:
headers=[['f_name',T('Name')]]

Highlightning rows, sometimes it would be good to highlight some 
specific rows?



Kenneth


Great work, it will be/is very useful for many of us!
Thanks,
Miguel

On Fri, Jul 22, 2011 at 11:35 PM, Bruno Rocha > wrote:


Hi,

I present you PowerGrid Plugin (now in beta 0.1)
[http://labs.blouweb.com/PowerGrid/]

What is it?

A plugin to show, manage and paginate data
It works with paginated JSON callbacks, you can use web2py DAL's
Query or Table, or you can create your own callback returning the
desired JSON or JSONP

What is has in special?
- Based on Jquery templates
- Server side pagination loads records on demand
- Ajax Caching option
- Programable in pure Python & web2py
- You can pass JS callbacks to the event handlers
- Can show images with Virtual Fields
- has button system
- totally integrated with CRUD
- Easy to integrate with Auth
- Can be used to manage a site content (a CMS admin page)
- can be used to create any kind of paginated data view

Changelog:
- Some issues solved
- Tested in Windows, Linux, I.E, Opera, Chrome, FF
- Better default layout

Beta:
- Needs tests with different datasources
- Need to be tested on GAE
- Need to test multiple on the same page
- Need to test wotking with another UI libs

EXAMPLES:
images - http://labs.blouweb.com/PowerGrid/default/withimages
dataGRid - http://labs.blouweb.com/PowerGrid/default/onlydata
Buttons - http://labs.blouweb.com/PowerGrid/default/buttons
Scrolling - http://labs.blouweb.com/PowerGrid/default/scroll
Customization:
http://labs.blouweb.com/PowerGrid/default/nocontrol /
http://labs.blouweb.com/PowerGrid/default/noadd /
http://labs.blouweb.com/PowerGrid/default/nosearch
Default search system:

http://labs.blouweb.com/PowerGrid/default/defaultsearch?what=Ferrari&where=manufacturer


SubGrids: http://labs.blouweb.com/PowerGrid/default/gridinpopup
JavaScript callbacks:
http://labs.blouweb.com/PowerGrid/default/jscallbacks
Custom templates:
http://labs.blouweb.com/PowerGrid/default/blog (a blog created
with it)


DOCUMENTATION:
Is being writen in home page
http://labs.blouweb.com/PowerGrid/default/index (in the grid)
source example app is well commented with options.

IT USES:
http://labs.blouweb.com/PowerGrid/default/about


Comments:
http://labs.blouweb.com/PowerGrid/default/support


Get it:
http://labs.blouweb.com/PowerGrid/default/get


!!! BETA VERSION, SOME THINGS CAN CRASH, THE SERVER IS A BIT SLOW,
IT WILL BE VERY MORE QUICKLY IN A GOOD SERVER OR GAE !!!

Thanks if you can test and report on BitBucker or omments page.


Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais:
http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]






Re: [web2py] The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Bruno Rocha
2011/7/25 Kenneth Lundström 

> headers=[['f_name',T('Name')]


I think you can use headers=[['f_name',str(T('Name'))]

The highlight can be easuly implemented with JavaScript and CSS.


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Massimo Di Pierro
> - Why was this changed?.

this was changed 2 years ago because the syntax of appadmin changed
from raw SQL to DAL.

> - Does anybody use it this way?.

nobody. That is why we changed it. The documentation is incorrect.
Strangely this was changed BEFORE the documentation was published.

On Jul 25, 1:28 pm, DenesL  wrote:
> The original book had:
>
> 
>
> When editing an existing person, the appadmin UPDATE form shows a link
> to a page that lists the dogs that belong to the person. This behavior
> can be replicated using the linkto argument of the SQLFORM. linkto has
> to point to the URL of a new action that receives a query string from
> the SQLFORM and lists the corresponding records. Here is an example:
>
> def display_form():
>    record = db.person(request.args(0)) or redirect(URL('index'))
>    url = URL('download')
>    link = URL('list_records')
>    form = SQLFORM(db.person, records, deletable=True, upload=url,
> linkto=link)
>    if form.accepts(request.vars, session):
>       response.flash = 'form accepted'
>    elif form.errors:
>       response.flash = 'form has errors'
>    return dict(form=form)
>
> 
>
> So the questions are:
> - Why was this changed?.
> - Does anybody use it this way?.


[web2py] Re: References and markmin

2011-07-25 Thread Massimo Di Pierro
This is poorly documented. Look at the bottom of the markmin2latex.
You can pass your own latex header and footer. They can redefine the
title of References. I do not remember how to do it in latex

On Jul 25, 2:14 pm, Martin Weissenboeck  wrote:
> Hi,
>
> the markmin manual says about references
>
> Citations and References
>
> Citations are treated as internal links in html and proper citations in
> latex if there is a final section called "References".
> But I want to use the German word "Literaturverzeichnis" instead of
> "References".- what shall I do?
>
> And if I want to have a title "# xxx" and not a section "## xxx"?
>
> Regards, Martin


Re: [web2py] The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Kenneth Lundström
I published my first new version of our intranet on our production 
server and now I´m getting:


Traceback(most recent call last):
  File"/data/domains/web2py/gluon/restricted.py",line181,inrestricted
execccodeinenvironment
  File"/data/domains/web2py/applications/economy/models/plugin_PowerGrid.py"  
,line40,in
fromgluon.custom_importimporttrack_changes
ImportError:cannotimportname track_changes


I copied everything from dev server to production server. On dev it was 
working. Any ideas?


> I think you can use headers=[['f_name',str(T('Name'))]

This works. Thanks.


 The highlight can be easuly implemented with JavaScript and CSS.


The idea was that the trigger was the data, if e.g. a rows' sum is 0 it 
would be highlighted.


Kenneth




Re: [web2py] The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Kenneth Lundström

Sorry, I found the error already. A stupid error.

Our production server was laging behind on updates, was using 1.95.1, 
but not anymore. And now Powergrid is working.



Kenneth

I published my first new version of our intranet on our production 
server and now I´m getting:


Traceback(most recent call last):
   File"/data/domains/web2py/gluon/restricted.py",line181,inrestricted
 execccodeinenvironment
   File"/data/domains/web2py/applications/economy/models/plugin_PowerGrid.py"  
,line40,in
 fromgluon.custom_importimporttrack_changes
ImportError:cannotimportname track_changes

I copied everything from dev server to production server. On dev it 
was working. Any ideas?


> I think you can use headers=[['f_name',str(T('Name'))]

This works. Thanks.

> The highlight can be easuly implemented with JavaScript and CSS.

The idea was that the trigger was the data, if e.g. a rows' sum is 0 
it would be highlighted.


Kenneth






[web2py] Re: cron problem

2011-07-25 Thread Rowdy

Manuele Pesenti wrote:

dear all,
I have a strange problem with cron it seams it does not respect what I 
have eritten in crontab... this is my crontab:


30 6 * * *  root *cron/fetch_m_data
0 7 * * *  root *default/send_mail_msg
30 14 * * *  root *cron/fetch_x_data
0 21 * * *  root *cron/fetch_m_data
0 23 * * *  root *cron/fetch_x_data

and every function called at the end send me an email so I can 
monitorize what happens... the result is that I receive emails every day 
who say that:


at 3:00 AM fetch_m_data is performed
at 5:00 AM fetch_x_data is performed
at 12:30 fetch_m_data is performed
at 20:30 fetch_m_data is performed again
send_mail_msg is never performed (it sends another message)

can you help me?

thanks a lot

Manuele



Greeting.

Different time zone perhaps?

fetch_m_data is expected to run at 06:30, but runs at 12:30 (= +6 hours).

fetch_x_data is expected to run at 14:30 but fetch_m_data runs at 20:30 
(= +6 hours) (was this a typo - supposed to be fetch_x_data running at 
20:30?).


fetch_m_data is expected to run at 21:00, but runs at 03:00 (= +6 hours).

Can't comment on send_mail_msg, but I would expect it to run at 13:00.

Might be somewhere to start looking, especially if it works on one 
machine but not another.


Rowdy



[web2py] A model of local and remote files

2011-07-25 Thread Alexander Cabezas
Anyone can help me.

I want to create a model in web2py to save local files and remote
files. How can I create a model to support both uploads or types of
records?

Anyone can help me.


Re: [web2py] The web2py grid/crud plugin you've always dreamed about!

2011-07-25 Thread Bruno Rocha
BTW:
You can remove or comment these two lines:


from gluon.custom_import import track_changes


track_changes()



This is usefull only on my development environment.



PowerGrid works only in web2py 1.97+, because it uses 'current' to
deal with session, request, response and T



I made some improvements, hope to release new beta version soon.



Thanks.


2011/7/25 Kenneth Lundström 

>  Sorry, I found the error already. A stupid error.
>
> Our production server was laging behind on updates, was using 1.95.1, but
> not anymore. And now Powergrid is working.
>
>
> Kenneth
>
>
>  I published my first new version of our intranet on our production server
> and now I´m getting:
>
> Traceback (most recent call last):
>   File "/data/domains/web2py/gluon/restricted.py", line 181, in restricted
> exec ccode in environment
>   File "/data/domains/web2py/applications/economy/models/plugin_PowerGrid.py" 
> , 
> line 40, in 
> from gluon.custom_import import track_changes
> ImportError: cannot import name track_changes
>
>
> I copied everything from dev server to production server. On dev it was
> working. Any ideas?
>
> > I think you can use headers=[['f_name',str(T('Name'))]
>
> This works. Thanks.
>
> > The highlight can be easuly implemented with JavaScript and CSS.
>
> The idea was that the trigger was the data, if e.g. a rows' sum is 0 it
> would be highlighted.
>
> Kenneth
>
>
>
>


-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] please check out the nightly built

2011-07-25 Thread Massimo Di Pierro
I am planning to release a 1.98.1 on Sunday.
Many tickets have been closed.
Please check out the nightly built on 
http://web2py.com/examples/default/download
and report any issue.

Massimo


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Anthony
On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote: 
>
> > - Why was this changed?. 
>
> this was changed 2 years ago because the syntax of appadmin changed 
> from raw SQL to DAL. 
>
> > - Does anybody use it this way?. 
>
> nobody. That is why we changed it. The documentation is incorrect. 
> Strangely this was changed BEFORE the documentation was published.

 
What should the documentation say?
 
Anthony
 


[web2py] Re: Running web2py on Jython

2011-07-25 Thread Chris Clark
On Jul 23, 2:08 pm, Richard  wrote:
> Hi Chris,
>
> I for one am glad that you reanimated this thread :-)
>
> Your findings probably led to hg commit #2119 which has the commit
> comment "possible __builtin__ fix for jython, thanks Chris Clark".
> This raised some hopes, but the current hg tip still doesn't work on
> Jython yet (at least for me). It needs more love still. Hopefully the
> situation will improve soon.

For those interested in Jython support take a look at
http://code.google.com/p/web2py/issues/detail?id=341

Massimo has been taking a look but the more eyes the better :-) If you
can help out with debugging that would be appreciated!

At the moment it now starts, and the welcome/admin page appears to
work.

Running the example application does not work at the moment, nor the
issues system. The application creation wizard runs .. but fails on
the last step with "Failure to create application", I can;t work out
where it is failing for this one. So some things are working (a number
of years ago it wasn't possible to get this far).

Chris


[web2py] Is the classic green and black layout still available?

2011-07-25 Thread G
Hi,
I think the former green and black default layout looks very nice, so
I'd like to use it, but it doesn't seem to be available in the recent
versions, nor on the page to download new layouts. Is this layout
still available somewhere?
Here is an image showing what I mean 
http://web2py.com/book/static/book_images_png/plugin_wiki_crud.png

Thanks,
G


Re: [web2py] Is the classic green and black layout still available?

2011-07-25 Thread Bruno Rocha
http://www.web2py.com/examples/static/1.82.1/web2py_src.zip

On Mon, Jul 25, 2011 at 10:08 PM, G  wrote:

> Hi,
> I think the former green and black default layout looks very nice, so
> I'd like to use it, but it doesn't seem to be available in the recent
> versions, nor on the page to download new layouts. Is this layout
> still available somewhere?
> Here is an image showing what I mean
> http://web2py.com/book/static/book_images_png/plugin_wiki_crud.png
>
> Thanks,
> G




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] web2py DAL

2011-07-25 Thread xuifeng
DAL connect mssql use Pyodbc  ,but this module can't call procedure
with out parameter 。


[web2py] Re: upload - S3 storage

2011-07-25 Thread howesc
pbreit might be right - you would still end up uploading the file to your 
server, and then saving to s3.  (though if your server was ec2 there might 
be a way to mount an s3 bucket, not sure though).

i also agree on looking at the boto interface: 
http://code.google.com/p/boto/  i'm using an older version of the library 
(just cause i have been too lazy to disturb running code) quite 
successfully.

cfh


[web2py] Re: web2py for freelance work

2011-07-25 Thread howesc
i do all my work as freelance work, and have done 98% of it in web2py in the 
last 2-3 years.  it works like a champ, and is really easy to quickly build 
well-written code that i can easily support 2 years later.  i can't say that 
for other frameworks i have worked on.  also because web2py is open source 
when it's not working right i can read the source and figure out what i did 
wrong (or occasionally report a bug)

the "i've never heard of web2py" or, "noone uses python" statements are hard 
to deal with - generally gets into religious like battles.  the most 
successful approach i have to this is i respond like "have you ever used 
gmail or google docs?"  and then i inform them that most of google's stuff 
(at least initially) is python.

good luck!

christian


[web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-25 Thread howesc
yikes!!  i can't say that i ever had an error without log messages.  
somethings to look for:

 - do you have a logging configuration file that is hiding log messages?
 - is your web2py routes (routes.py or the other routing mechanism) causing 
a problem?
 - is your app.yaml not mapping the URLs to web2py?

cfh


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-25 Thread Massimo Di Pierro
I am not sure this is something we want to encourage outside appadmin.
It should be corrected but it should say this is for appadmin.

On Jul 25, 5:57 pm, Anthony  wrote:
> On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote:
>
> > > - Why was this changed?.
>
> > this was changed 2 years ago because the syntax of appadmin changed
> > from raw SQL to DAL.
>
> > > - Does anybody use it this way?.
>
> > nobody. That is why we changed it. The documentation is incorrect.
> > Strangely this was changed BEFORE the documentation was published.
>
> What should the documentation say?
>
> Anthony


[web2py] Re: export data to OOO and Excel

2011-07-25 Thread Vineet
@selecta,
thanks for directing to 'tablib'.
It is also a good choice.
I am assessing whether to use 'excel-python' or 'tablib'.
:-|

On Jul 25, 1:52 pm, António Ramos  wrote:
> How about a video tutorial exporting to excel?
>
> 2011/7/25 selecta 
>
>
>
> > Have a look at
>
> >http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/view...
>
> >http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/view...
>
> > they use tablib (which includes xlwt, ...)
> >http://docs.tablib.org/en/latest/index.html- Hide quoted text -
>
> - Show quoted text -