Re: [web2py] Re: Web2Py on lighthttpd fastcgi - The definitive answer.

2010-08-25 Thread François Delpierre
YES !

This did it.

There is just a typo about the path to web2py.
After testing all parameters separately, I found that my problem was comming
from the missing line :

include_shell "/usr/share/lighttpd/create-mime.assign.pl"

Thanks a lot !

Regards,


On Wed, Aug 25, 2010 at 10:50 PM, mdipierro  wrote:

> I will look into it. perhaps a typo in the book. I did not try
> lighttpd myself.
> Does this help?
>
> http://web2pyslices.com/main/slices/take_slice/57
>
> On Aug 25, 12:46 pm, Pivert  wrote:
> > Hi,
> >
> > This is for 4h30 that I'm trying to install web2py on my dedicated
> > ubuntu server 10.04, and I'm really pissed off.
> >
> > What I want :
> > Have my remote server installed with lighttpd & fastcgi to server a
> > fresh install of web2py on port 80, with web2py in /var/www/web2py.
> >
> > What I did :
> > I bought the pdf book, and starded there, but without luck : web2py is
> > working through fastcgi, but no color, like of there is no css
> > applied. I then started to test ALL examples found on google about
> > lighttpd config. ALL of them are buggy and immediately refused by
> > lighttpd at startup. Including the one in the web2py ebook. The
> > lighttpd.conf from ebook is refused because line 28 uses a = sign,
> > while it should probably be an =~.
> >
> > Current result :
> > Web2Py is working through lighttpd, but no css applied. Only
> > black&white, no background, ...
> >
> > My Questions :
> > - Please send us a basic lighttpd.conf that will successfully server
> > web2py through /tmp/fcgi.sock.
> > - Why does the eBook contins the line :
> >  server.error-handler-404 = "/test.fcgi"
> >  while /test.fcgi does not exists.
> >
> > Thanks.
>


[web2py] How can I create a file in an upload field, and add lines to it ?

2012-04-14 Thread François Delpierre
Hi,

I have a table with two upload fields. I need to transform the file from 
the first upload field, and create it in the second upload field.
What is the best way to do it, and possibly avoid to first create the file 
in memory before writing it to the disk.

It looks like I can generate the random file name in the DB with such a 
store command :
db.t_card_posting.f_destfile.store(fileObject,filename)

But the problem is that at this stage, I do not yet have any file object. 

Regards,


[web2py] Re: How can I create a file in an upload field, and add lines to it ?

2012-04-14 Thread François Delpierre
Could this be the best solution ? 

mysecurefilename = 
db.t_card_posting.f_destfile.store(tempfile.TemporaryFile(), 
'my_empty_file.csv')
mf = open('applications/CardPosting/uploads/' + mysecurefilename, 'w')
mf.write('This is my first test line in my empty csv file.')


Le samedi 14 avril 2012 12:51:36 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> I have a table with two upload fields. I need to transform the file from 
> the first upload field, and create it in the second upload field.
> What is the best way to do it, and possibly avoid to first create the file 
> in memory before writing it to the disk.
>
> It looks like I can generate the random file name in the DB with such a 
> store command :
> db.t_card_posting.f_destfile.store(fileObject,filename)
>
> But the problem is that at this stage, I do not yet have any file object. 
>
> Regards,
>


[web2py] Re: filename in dal

2012-04-26 Thread François Delpierre
Thanks for the tip.
But I do not understand the default behavior of Web2Py. 
I would expect to have the original file name displayed, instead of just 
the link named "file".

In order to achieve this, I take your previous typ and I adapt my DAL :

db.mytable.f_sourcefile.represent = lambda rowid,row: \
A(db.mytable.f_sourcefile.retrieve(row.f_sourcefile)[0][:30], 
_href=URL('download', args=rowid))

Is there no easier/cleaner way ?


[web2py] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Hi,

Here is exactly what I would like to have, but it does not compute on 
update :

db.define_table('t_templates',
  Field('f_template', type='upload', label=T('File'),notnull=True), 

  Field('f_revision', type='integer', label=T('Revision'),
  default=1,
  compute=lambda row: row['f_revision']+1 ,
  ),
  )



[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
I have no error message, but I suspect the row to not be populated with the 
['f_revision'] field.

Le mardi 1 mai 2012 13:31:43 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> Here is exactly what I would like to have, but it does not compute on 
> update :
>
> db.define_table('t_templates',
>   Field('f_template', type='upload', label=T('File'),notnull=True),   
> 
>   
>   Field('f_revision', type='integer', label=T('Revision'),
>   default=1,
>   compute=lambda row: row['f_revision']+1 ,
>   ),
>   )
>
>

Re: [web2py] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Thanks Khalil,

I did a try but it did not work, in fact the form.vars.t_revision does not 
exists.
1. Could it be because I'm using SQLFORM.grid ?
2. I was aware that we can paste a list to onvalidation, but never a dict 
( onvalidation={'onsuccess':mycustom} ), is this in the docs ?

I would have prefered to do it in the DAL, but anyway, I tried in the 
controller, and here is a possible solution. This is definitely not simple, 
but it works :
@auth.requires_login() 
   
def manage_templates(): 
  
def increment_rev_number(form): 
  
print('Enter increment_rev_number : form.vars = %s' % 
(str(form.vars)))   
print( db(db.t_templates.id==form.vars.id).select().first() )   
  
db(db.t_templates.id==form.vars.id).update( 
  
f_revision = 
(db(db.t_templates.id==10).select().first()['f_revision'] or 0) + 1 
 
)   
  
db.commit() 
  

  
form = SQLFORM.grid(   
   
db.t_templates, 
  
fields=[   
   
db.t_templates.f_name, 
   
db.t_templates.f_template, 
   
db.t_templates.f_revision, 
   
db.t_templates.f_revdate,   
  
], 
   
csv=False, 
   
details=False, 
   
onvalidation=auth.archive, 
   
onupdate=increment_rev_number, 
   
)   
  
return locals()

I just noticed the solution provided by Anthony, I'll also give it a try. 
Thanks Anthony.




[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Hi Anthony,

The proposal does not work as is. It looks like there is 
no request.vars._formname.
P.S. : There is a small typo : request.vars._formname.startswith(...

However, with strong inspiration of your solution I made some additonal 
tests and found a compute function that perfectly works :

compute=lambda row: db.t_templates(request.vars.id).f_revision + 1 if (
request.vars.id and db.t_templates(request.vars.id).f_revision) else 1,

Super thanks Anthony. I'll use this solution as I prefer to have it on the 
DAL.

Le mardi 1 mai 2012 15:48:06 UTC+2, Anthony a écrit :
>
> I think the row object submitted to the compute function only includes the 
> fields that are part of the update, so it won't include row['f_revision']. 
> Instead, you could get the record id from request.vars and use that to 
> query the current value of the f_revision field:
>
> db.define_table('t_templates', Field('name'),
> Field('f_template', 'upload', label=T('File'), notnull=True),
> Field('f_revision', 'integer', label=T('Revision'),
> compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if 
> (request.vars.id and
> request.vars._formname and request.vars_formname.startswith(
> 't_templates')) else 1))
>
> Anthony
>
> On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>>
>> Hi,
>>
>> Here is exactly what I would like to have, but it does not compute on 
>> update :
>>
>> db.define_table('t_templates',
>>   Field('f_template', type='upload', label=T('File'),notnull=True),  
>>   
>> 
>>   Field('f_revision', type='integer', label=T('Revision'),
>>   default=1,
>>   compute=lambda row: row['f_revision']+1 ,
>>   ),
>>   )
>>
>>

[web2py] [Solved] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
So both solutions are working. One on the form in the controller, one as 
compute in the models when defining the table.

Thanks,

Le mardi 1 mai 2012 21:38:59 UTC+2, François Delpierre a écrit :
>
> Hi Anthony,
>
> The proposal does not work as is. It looks like there is 
> no request.vars._formname.
> P.S. : There is a small typo : request.vars._formname.startswith(...
>
> However, with strong inspiration of your solution I made some additonal 
> tests and found a compute function that perfectly works :
>
> compute=lambda row: db.t_templates(request.vars.id).f_revision + 1 if (
> request.vars.id and db.t_templates(request.vars.id).f_revision) else 1,
>
> Super thanks Anthony. I'll use this solution as I prefer to have it on the 
> DAL.
>
> Le mardi 1 mai 2012 15:48:06 UTC+2, Anthony a écrit :
>>
>> I think the row object submitted to the compute function only includes 
>> the fields that are part of the update, so it won't include 
>> row['f_revision']. Instead, you could get the record id from request.vars 
>> and use that to query the current value of the f_revision field:
>>
>> db.define_table('t_templates', Field('name'),
>> Field('f_template', 'upload', label=T('File'), notnull=True),
>> Field('f_revision', 'integer', label=T('Revision'),
>> compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if 
>> (request.vars.id and
>> request.vars._formname and request.vars_formname.startswith(
>> 't_templates')) else 1))
>>
>> Anthony
>>
>> On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>>>
>>> Hi,
>>>
>>> Here is exactly what I would like to have, but it does not compute on 
>>> update :
>>>
>>> db.define_table('t_templates',
>>>   Field('f_template', type='upload', label=T('File'),notnull=True), 
>>>
>>> 
>>>   Field('f_revision', type='integer', label=T('Revision'),
>>>   default=1,
>>>   compute=lambda row: row['f_revision']+1 ,
>>>   ),
>>>   )
>>>
>>>

[web2py] ProgrammingError: Cannot operate on a closed database. in generator

2012-05-04 Thread François Delpierre
Hi, 

Here is my problem. It looks like the databases closes while in my 
Generator. I also tried to pass the DB with the send() function as 
described in an other post.

In a web page, I have an iframe that calls a function that returns a 
generator to get some kind of "asynchronous" update in the web page.
Here is a simpler example that illustrates the problem :

View :
{{extend 'layout.html'}}
{{=form1}}



Controller :
def processing():
def createGenerator() :
db = None
while db is None:
db = (yield "Thanks for initalizing the DB")
assert db.tables[0] == 'auth_user'
print "The db is available initialized"
def tst():
return ('Event ' + 
str(i*i) + ' : ')
def tst2():
return ('ERROR')
for i in xrange(20):
time.sleep(0.2)
outline = 'My Name 
is : '
yield outline
time.sleep(0.2)
outline = '''
  %s
  ''' % db(db.auth_user).select().first()['first_name']
yield outline
time.sleep(0.2)
mygen = createGenerator()
# I must run at least once the generator before using the send() 
function.
print mygen.next()
mygen.send(db)
return mygen



In the log, we see that first the database is available, then it's closed :

[Fri May 04 11:44:08 2012] [error] Thanks for initalizing the DB
[Fri May 04 11:44:08 2012] [error] The db is available initialized
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] mod_wsgi 
(pid=11492): Exception occurred processing WSGI script 
'/home/www-data/web2py/wsgihandler.py'.
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] Traceback (most 
recent call last):
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/applications/init/controllers/default.py", line 232, 
in createGenerator
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] ''' % 
db(db.auth_user).select().first()['first_name']
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/gluon/dal.py", line 7578, in select
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] return 
adapter.select(self.query,fields,attributes)
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/gluon/dal.py", line 1315, in select
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] rows = 
response(sql)
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/gluon/dal.py", line 1305, in response
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] 
self.execute(sql)
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/gluon/dal.py", line 1392, in execute
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] return 
self.log_execute(*a, **b)
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
"/home/www-data/web2py/gluon/dal.py", line 1386, in log_execute
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] ret = 
self.cursor.execute(*a, **b)
[Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] ProgrammingError: 
Cannot operate on a closed database.


I'm searching for some hours already on how to fix this issue. Or maybe is 
there a better solution to update the page in realtime / asynchronously ?

Regards,




[web2py] Re: ProgrammingError: Cannot operate on a closed database. in generator

2012-05-04 Thread François Delpierre
WhoooO !

Thanks for the answer Niphold, but a bit slower please ;-)

If I understand your answer, my problem with asking web2py to stream a 
generator is not working anymore since I changed from the provided web 
server to Apache.
BTW, I tried by removing the database accesses, and it does not behave as 
expected on Apache server, while in embedded web2py server it just works. 
(I posted the code below).

So, basically I have 2 problems :
1. WSGI that breaks the streaming of generators.
2. Access to db in SQLite that is dying (not sure why...), and producing 
the Closed Database error.

I'm looking for a very simple method, mainly used for an intranet 
application, with probably no concurency. (Less than 10 uses per day.)
Using a generator in web2py was to my eyes a nice way to avoid any AJAX.

So, what should I do??

For my problem 1, should I go back to Web2Py embedded server, and continue 
with a generator, or should I turn to an other solution. Is there any 
simple solution with a simple xmlhttprequest & consise example? Should I 
have a blocking controller that is being called by an XMLHTTPRequest with 
the comet/long polling technique? Is there samples? Ho to I manage my 
background process? Worker? If worker, how can I communicate with my 
controller? Message Queuing system, pipe, db?
I need a simple solution or have to abandon the idea of a realtime feedback 
in my web page, but it's really too bad.

For my problem 2, SQLite is really perfect for the use I have, it would be 
too bad to have to use a more complex DB, and manage the import/export 
scripts so the data are in the w2p package... with SQLite & a generator, I 
suppose the only way is to reconnect to the DB at every iteration ? Will I 
have the same problem if I implement a Class that will instanciate and keep 
the db open (and add a next() function) ? 

I know it's a lot of question. Thanks for any advise that could help me 
here.

Here is my processing function simplified that works on Web2Py web server, 
but not on Apache with WSGI. :
def processing():
def createGenerator() :
for i in xrange(20):
time.sleep(0.2)
outline = 'My Name is : \n'
yield outline
time.sleep(0.2)
yield outline
time.sleep(0.2)
mygen = createGenerator()
return mygen



Le vendredi 4 mai 2012 11:51:30 UTC+2, François Delpierre a écrit :
>
> Hi, 
>
> Here is my problem. It looks like the databases closes while in my 
> Generator. I also tried to pass the DB with the send() function as 
> described in an other post.
>
> In a web page, I have an iframe that calls a function that returns a 
> generator to get some kind of "asynchronous" update in the web page.
> Here is a simpler example that illustrates the problem :
>
> View :
> {{extend 'layout.html'}}
> {{=form1}}
> 
>
>
> Controller :
> def processing():
> def createGenerator() :
> db = None
> while db is None:
> db = (yield "Thanks for initalizing the DB")
> assert db.tables[0] == 'auth_user'
> print "The db is available initialized"
> def tst():
> return ('Event ' + 
> str(i*i) + ' : ')
> def tst2():
> return (' style="color:red;width:200px;border-style:solid;border-width:1px;">ERROR')
> for i in xrange(20):
> time.sleep(0.2)
> outline = 'My Name 
> is : '
> yield outline
> time.sleep(0.2)
> outline = '''
>  >%s
>   ''' % db(db.auth_user).select().first()['first_name']
> yield outline
> time.sleep(0.2)
> mygen = createGenerator()
> # I must run at least once the generator before using the send() 
> function.
> print mygen.next()
> mygen.send(db)
> return mygen
>
>
>
> In the log, we see that first the database is available, then it's closed :
>
> [Fri May 04 11:44:08 2012] [error] Thanks for initalizing the DB
> [Fri May 04 11:44:08 2012] [error] The db is available initialized
> [Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] mod_wsgi 
> (pid=11492): Exception occurred processing WSGI script 
> '/home/www-data/web2py/wsgihandler.py'.
> [Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] Traceback (most 
> recent call last):
> [Fri May 04 11:44:08 2012] [error] [client 10.242.0.10]   File 
> "/home/www-data/web2py/applications/init/controllers/default.py", line 232, 
> in createGenerator
> [Fri May 04 11:44:08 2012] [error] [client 10.242.0.10] ''' % 
> 

[web2py] SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-09 Thread François Delpierre
Hi,

When I try to select the fields to be displayed as follow :
form = SQLFORM.smartgrid(
db.t_xlsfile,
fields=dict(
t_xlsfile=[
db.t_xlsfile.f_xlsfile,
],
),

I immediately get this strange error :
Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 205, in restricted
exec ccode in environment
  File "/home/www-data/web2py/applications/init/controllers/default.py",line 
425, in 
  File "/home/www-data/web2py/gluon/globals.py", line 173, in 
self._caller = lambda f: f()
  File "/home/www-data/web2py/gluon/tools.py", line 2575, in f
return action(*a, **b)
  File "/home/www-data/web2py/applications/init/controllers/default.py",line 
257, in posting_history
t_xlsfile='Table of Excel files',
  File "/home/www-data/web2py/gluon/sqlhtml.py", line 1989, in smartgrid
user_signature=user_signature,**kwargs)
  File "/home/www-data/web2py/gluon/sqlhtml.py", line 1517, in grid
if field._tablename in tablenames]
AttributeError: 'str' object has no attribute '_tablename'

Any idea ??


[web2py] Re: SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-10 Thread François Delpierre
Houhou !

If works also on the smartgrid :
form = SQLFORM.smartgrid(
db.t_xlsfile,
fields=[
db.t_xlsfile.f_xlsfile,
],
),


smartgrid are really powerful, but still missing some docs... I had some 
difficulties to find also how to get the exact display before I found the 
 singular keyword on the table ;-)

Great,



Thanks,

Le jeudi 10 mai 2012 06:57:00 UTC+2, Massimo Di Pierro a écrit :
>
> Can you try:
>
> form = SQLFORM.grid(
> db.t_xlsfile,
> fields=[
> db.t_xlsfile.f_xlsfile,
> ],
> ),
>
> do you get the same error. Can you try web2py trunk as well?
>
>
> On Wednesday, 9 May 2012 19:08:31 UTC-5, François Delpierre wrote:
>>
>> Hi,
>>
>> When I try to select the fields to be displayed as follow :
>> form = SQLFORM.smartgrid(
>> db.t_xlsfile,
>> fields=dict(
>> t_xlsfile=[
>> db.t_xlsfile.f_xlsfile,
>> ],
>> ),
>>
>> I immediately get this strange error :
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 205, inrestricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
>> 425, in 
>>   File "/home/www-data/web2py/gluon/globals.py", line 173, in 
>> self._caller = lambda f: f()
>>   File "/home/www-data/web2py/gluon/tools.py", line 2575, in f
>> return action(*a, **b)
>>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
>> 257, in posting_history
>> t_xlsfile='Table of Excel files',
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1989, in smartgrid
>> user_signature=user_signature,**kwargs)
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1517, in grid
>> if field._tablename in tablenames]
>> AttributeError: 'str' object has no attribute '_tablename'
>>
>> Any idea ??
>>
>

[web2py] No error_message displayed when using IS_LIST_OF(IS_ALPHANUMERIC()) validator

2012-05-11 Thread François Delpierre
Hi,

I have no error message when I wrongly fill a list with spaces / special 
characters.
However the validator works, as I need to respect it to update the record.

db.define_table('parameter',
Field('allowed_users', type='list:string'),
)
db.parameter.allowed_users.requires = IS_LIST_OF(IS_ALPHANUMERIC())

# I first inserted a row with the default DB administration tool. But no 
error message also there. 

form = crud.update(db.parameter, 1, deletable=False)

I did try quite everything already :
- Redefining error_message at the IS_ALPHANUMERIC level or at the IS_LISTOF.
- defining the validator at the table level
- Removing the "IS_LIST_OF"..

But no success, it 's validating, but no error message displayed. This then 
becomes quite unusable.


[web2py] Re: SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-11 Thread François Delpierre
Sorry Massimo, 
I didn't found any Bug Reporting Tool on the web2py web site or on the 
presentation message of this list.
Where can I report the bug ?

Thanks,

Le jeudi 10 mai 2012 02:08:31 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> When I try to select the fields to be displayed as follow :
> form = SQLFORM.smartgrid(
> db.t_xlsfile,
> fields=dict(
> t_xlsfile=[
> db.t_xlsfile.f_xlsfile,
> ],
> ),
>
> I immediately get this strange error :
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 205, inrestricted
> exec ccode in environment
>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
> 425, in 
>   File "/home/www-data/web2py/gluon/globals.py", line 173, in 
> self._caller = lambda f: f()
>   File "/home/www-data/web2py/gluon/tools.py", line 2575, in f
> return action(*a, **b)
>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
> 257, in posting_history
> t_xlsfile='Table of Excel files',
>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1989, in smartgrid
> user_signature=user_signature,**kwargs)
>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1517, in grid
> if field._tablename in tablenames]
> AttributeError: 'str' object has no attribute '_tablename'
>
> Any idea ??
>


[web2py] [Fixed] SQLFORM.smartgrid : error when setting fields to be displayed as a fields dictionary.

2012-05-11 Thread François Delpierre


Le jeudi 10 mai 2012 02:08:31 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> When I try to select the fields to be displayed as follow :
> form = SQLFORM.smartgrid(
> db.t_xlsfile,
> fields=dict(
> t_xlsfile=[
> db.t_xlsfile.f_xlsfile,
> ],
> ),
>
> I immediately get this strange error :
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 205, inrestricted
> exec ccode in environment
>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
> 425, in 
>   File "/home/www-data/web2py/gluon/globals.py", line 173, in 
> self._caller = lambda f: f()
>   File "/home/www-data/web2py/gluon/tools.py", line 2575, in f
> return action(*a, **b)
>   File "/home/www-data/web2py/applications/init/controllers/default.py",line 
> 257, in posting_history
> t_xlsfile='Table of Excel files',
>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1989, in smartgrid
> user_signature=user_signature,**kwargs)
>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1517, in grid
> if field._tablename in tablenames]
> AttributeError: 'str' object has no attribute '_tablename'
>
> Any idea ??
>


[web2py] How to get the selected menu / active menu ?

2012-05-19 Thread François Delpierre
Hi,

Here is my solution :
If my response.menu is somthing like :

response.menu = [('Menu1', False), ('Menu2', True), ('Menu3', False)]

I can use this in my view to display the active menu :
{{=[x[0] for x in response.menu if x[1]==True][0]}}


It's working well, but is there no better and more efficient way ?

Thanks,


[web2py] Re: How to get the selected menu / active menu ?

2012-05-19 Thread François Delpierre
Thanks Niphlod,

Yes, it's more 'tune my code' is it's perfectly working, and it keeps very 
fast.

The problem with the javascript version is that I want to have the 
Translated name of the menu not just the link.

My previous version is buggy when you're not logged in. So, I had to adapt :

{{ 
l = [x[0] for x in response.menu if x[1]==True]
=l[0] if len(l)>0 else T('Welcome') 
}}

I was just expecting something like reponse.menu.active but it does not 
exists.

Anyway thanks, I'll keep my workaround.

Regards,


Le samedi 19 mai 2012 14:22:23 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> Here is my solution :
> If my response.menu is somthing like :
>
> response.menu = [('Menu1', False), ('Menu2', True), ('Menu3', False)]
>
> I can use this in my view to display the active menu :
> {{=[x[0] for x in response.menu if x[1]==True][0]}}
>
>
> It's working well, but is there no better and more efficient way ?
>
> Thanks,
>


[web2py] Re: How to get the selected menu / active menu ?

2012-05-19 Thread François Delpierre
Thanks Niphlod,

Yes, it's more 'tune my code' is it's perfectly working, and it keeps very 
fast.

The problem with the javascript version is that I want to have the 
Translated name of the menu not just the link.

My previous version is buggy when you're not logged in. So, I had to adapt :

{{ 
l = [x[0] for x in response.menu if x[1]==True]
=l[0] if len(l)>0 else T('Welcome') 
}}

I was just expecting something like reponse.menu.active but it does not 
exists.

Anyway thanks, I'll keep my workaround.

Regards,



[web2py] How to prevent delete of a row with SQLFORM.grid -

2012-05-20 Thread François Delpierre
I must ensure there is always at least one row in a table. (My application 
parameter table)
How can I prohibit delete of the last row of a table ?
As it looks the ondelete is executed AFTER deletion...

Thanks,


[Solved] [web2py] How to prevent delete of a row with SQLFORM.grid -

2012-05-22 Thread François Delpierre

>
> Excellent idea Johann,


You're totally right, I was not looking into this approach.

Here is the working code :
def manage_parameters():   
 
# Make sure user cannot delete the last parameter set. (row)   
 
if db(db.parameter).count() > 1:   
 
deletable = True   
 
else:   

deletable = False   



form = SQLFORM.grid(   
 
db.parameter,   

deletable=deletable,   
 
fields = [ 
 
db.parameter.id,   
 
db.parameter.profile_name,
...

Regards,


[web2py] Re: How to prevent delete of a row with SQLFORM.grid -

2012-05-23 Thread François Delpierre
... working but I have a side effect :

It looks like the "Delete" on a row is just removing the row from the 
screen, without full refresh of the page. So, the last line is always 
"deletable", but in fact it does not deletes.


[web2py] Invalid Circual Reference - misleading error message

2012-06-02 Thread François Delpierre
Hi,

I'm getting (again) stuck with an "Invalid Circual Reference" using Wizard. 
Finally, it looks like I have been able to fix it by just changing the 
order of the table in my wizard, so the table order counts in the wizard. 
We must have listed first all the tables to which we want to refer in the 
table we are defining.


   - The error message should really be adapted in this case, and point to 
   the line where the field is referencing a "non yet fully defined table".
   - We must be able to reorder tables, especially when using the "Edit 
   All" button in the Wizard.


Regards,


[web2py] App does not exist or your are not authorized when deploying layout plugin

2012-06-02 Thread François Delpierre
I just created a simple plugin as described here (Only the view/layout.html 
and a CSS) :
http://comments.gmane.org/gmane.comp.python.web2py/71183

Here is the content of the w2p plugin file :
pivert@skinner:~/Downloads$ tar -ztvf web2py.plugin.layout_name.w2p
-rw-rw francoisd/www-data 6279 2012-05-26 13:27 views/plugin_layout_name
/layout.html
drwxrwx--- francoisd/www-data0 2012-05-28 23:44 static/
plugin_layout_name/css/
-rw-rw francoisd/www-data 5237 2012-05-28 23:43 static/
plugin_layout_name/css/name.css
drwxrwx--- francoisd/www-data0 2012-05-28 23:48 static/
plugin_layout_name/images/
-rw-rw francoisd/www-data 2796 2012-05-22 23:46 static/
plugin_layout_name/images/logo-name.gif
-rw-rw francoisd/www-data  754 2012-05-22 23:46 static/
plugin_layout_name/images/header.gif



And if I deploy from the web admin interface, I have the "App does not 
exist or your are not authorized" error.


Re: [web2py] App does not exist or your are not authorized when deploying layout plugin

2012-06-26 Thread François Delpierre
No, it's not a permission problem.
It seems to happen when I include the view/layout.html file in the w2p file 
by issuing the tar command manually as described by Massimo.
Here is the command I use :

tar zcvf ../web2py.plugins.name_layout.w2p views/layout.html 
views/plugin_layout_name/* static/plugin_layout_name/*

Regards,

-- 





[web2py] Re: App does not exist or your are not authorized when deploying layout plugin

2012-06-26 Thread François Delpierre
Ok, so it means that the solution from Massimo is not working anymore :
http://permalink.gmane.org/gmane.comp.python.web2py/71241

How can I then make plugins that automatically change the layout of the 
application without having to leave web interface ?

That's strange, as one of the downloadable layout does exactly that, and 
works :
pivert@skinner:~/Downloads$ tar -ztvf web2py.plugin.layout_Compromise.w2p 
-rw-r--r-- mdipierro/staff 5559 2010-11-03 17:09 views/layout.html
-rw-r--r-- mdipierro/staff 3359 2010-11-03 17:03 
static/plugin_layouts/superfish.css
-rw-r--r-- mdipierro/staff 3714 2010-11-03 17:03 
static/plugin_layouts/superfish.js
-rw-r--r-- mdipierro/staff 5559 2010-11-03 17:07 
views/plugin_layouts/layouts/Compromise.html
drwxr-xr-x mdipierro/staff0 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/
drwxr-xr-x mdipierro/staff0 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/
-rw-r--r-- mdipierro/staff 6452 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/index.html
-rw-r--r-- mdipierro/staff 13901 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/license.txt
-rw-r--r-- mdipierro/staff 18861 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/preview.png
-rw-r--r-- mdipierro/staff  4856 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/style.css
-rw-r--r-- mdipierro/staff  1631 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/img01.gif
-rw-r--r-- mdipierro/staff   413 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/img02.jpg
-rw-r--r-- mdipierro/staff  2496 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/img03.jpg
-rw-r--r-- mdipierro/staff  9087 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/img04.jpg
-rw-r--r-- mdipierro/staff  2989 2010-10-20 07:09 
static/plugin_layouts/layouts/Compromise/images/img05.gif


-- 





[web2py] Re: App does not exist or your are not authorized when deploying layout plugin

2012-06-27 Thread François Delpierre
Then I do not understand why when I 
deploy web2py.plugin.layout_Compromise.w2p from the web interface it 
overwrites the view/layout.html file!

pivert@skinner:~/Downloads/web2py/applications/Incident_report_2$ ls -lh 
views/layout.html 
-rw-r--r-- 1 pivert pivert 6.2K Jun 26 23:49 views/layout.html
pivert@skinner:~/Downloads/web2py/applications/Incident_report_2$ # I deploy 
the plugin through the web interface
pivert@skinner:~/Downloads/web2py/applications/Incident_report_2$ ls -lh 
views/layout.html 
-rw-r--r-- 1 pivert pivert 5.5K Nov  3  2010 views/layout.html
pivert@skinner:~/Downloads/web2py/applications/Incident_report_2$ 




[web2py] Invalid circual reference

2012-07-04 Thread François Delpierre
Hi,

I'm getting an invalid circual reference very often with the wizard. It's 
seems very buggy. 

Most of the time, this is because I refer to a table that is later in my 
definition list. Changing the order fixes this problem.
But sometimes, I have no idea. I already lost a lot of time with this very 
strange error message. I think this must absolutely be fixed in the next 
Web2Py release. At least display which line, and why.

An other buggy behaviour is that when I have this circual reference error, 
and when I modify one of the field definition, I get the previous 
definition I wrote when submiting. And so every 2 clicks on submit, I get 
the previous one, and every 2 click the last definition.

When I restart the wizard, I even get this error on the auth_user table, so 
it's not possible to go further without directly clicking on the table on 
the left pane of the wizard.

Really, it's buggy.


[web2py] Re: Invalid circual reference

2012-07-05 Thread François Delpierre
I'll have a look to build the steps to reproduce the problem, however I 
wonder if the problem could not occur when I change the name (and type) of 
the first field of a table, that is 'name' by default.

[web2py] SQLFORM.smartgrid: TSV & CSV export with hidden cols only shows visible cols

2013-01-23 Thread François Delpierre
When using the CSV export with hidden cols or the TSV export with hidden 
cols, I have none of the hidden columns in the view.
Here is the SQLFORM being used:

def index():
form = SQLFORM.smartgrid(
  db.t_bsc,
  onupdate=auth.archive,
  linked_tables=['t_bsc', 't_device', 't_device2ip', 't_ip', 
't_ip2port', 't_port' ,],
  fields=[
db.t_bsc.f_name,
db.t_bsc.f_service_type,
db.t_bsc.f_service_category,
db.t_bsc.f_business_units,
db.t_bsc.f_service_owner,
db.t_bsc.f_business_priority,
db.t_device.f_hostname,
db.t_device.f_role,
db.t_device.f_pci_scope,
  ],
  maxtextlength=40,
  links={'t_bsc':[{'header':'Service Notifications', 
'body':service_notif}]},
)
plugin=plugin_multiselect(db.t_bsc.f_supporting_svc)
return locals()

And when I make an export, even with hidden columns, I have only the 
following fields:

t_bsc.f_namet_bsc.f_service_typet_bsc.f_service_categoryt_bsc.f_business_unitst_bsc.f_service_ownert_bsc.f_business_priorityt_bsc.id

while there are many other fields.

Tested with version: Current (2.3.2 stable)

This looks like a bug.

Thanks,

-- 





[web2py] Re: How do I use web2py to make a simple GUI?

2013-01-23 Thread François Delpierre
Hi Kaare,

I'm not sure I fully understand your need. But, if all you need is a simple 
web app to make a calculation from some fields and get one or more answers, 
Web2Py is probably the right tool for doing it. One of your wish is to have 
this app correctly displaying on your mobile phone browser. For this point, 
Web2Py will provide some quite good templates that should do the trick, 
then it's not about Web2Py anymore, it's more about your knowledge of html 
& css. What I would recommend in your situation, is to make a very small 
proof of concept:
- Setup a Web2Py, with ability to connect from your phone.
- From your PC, build a very small app, using the wizard, and just one 
additional table (additional to the default user table), with the fields 
you need to compute, and one or more for the result(s). This should not 
take more than few minutes. 
- Register and test the app from your PC.
- Then test from your mobile, at least of the display & speed.
If you're satisfied with what you see, Web2Py is the best tool to do it.

If now you want some specific look & feel, or even animations in buttons or 
other part of the web page, learning Web2py is just a detail compared to 
the time you will need to learn JavaScript & libraries use to do it.

P.S. If interested with Web2Py, read the book (Printed version ideally). 
For sure you will get a short return on investment.

Regards,

-- 





[web2py] Re: SQLFORM.smartgrid: TSV & CSV export with hidden cols only shows visible cols

2013-01-24 Thread François Delpierre
Thanks Alan,

Just tried the nightly build, and it's not (yet) fixed.

Regards,

-- 





[web2py] websocket_messaging.py over ssl

2013-01-24 Thread François Delpierre
websocket_messaging.py looks nice, and the example in the comments 
immediately works in chrome. (not in ff)

But how can I encapsulate that in https or using it through ssl?

Regards,

-- 





[web2py] How can I disable the delete confirmation in SQLFORM.grid ?

2013-01-29 Thread François Delpierre


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Cannot label id field

2013-02-09 Thread François Delpierre
Hi,

Let's see the definition:

db.define_table('t_bsc',
Field('id', type='integer', label=T('Service Code')),
Field('f_name', type='string',
  label=T('Service name'),
  comment=T('The name of the customer facing service as known to 
your customer.')),

But in my smartgrid, I still see the label Id instead of 'Service Code' for 
the id field...
Is this a bug?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How can I disable the delete confirmation in SQLFORM.grid ?

2013-02-09 Thread François Delpierre
Ok, so it's not included in the grid options.
changing it in web2py.js would disable the confirmation globally, that's a 
bit dangerous for other tables. I would prefer to do it only for 1 
particular table.

Or maybe creating a web2py_noconfirm.js included in a layout_noconfirm.html 
?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Unique Constraint not working for : Field(type='upload', unique=True)

2013-02-09 Thread François Delpierre
Hi,

I got a quite similar result by working on the validation at the form level:

if form1.process().accepted:
session.flash = 'File uploaded'
redirect(URL('check_xls_file', args=form1.vars.id, user_signature=
True))
elif form1.errors:
response.flash = 'File rejected'


And in the check_xls_file function:

# Check that a file with the same name has not been already posted.
t = db.t_xlsfile
xlsfilename = t.f_xlsfile.retrieve(t_xlsfile_row.f_xlsfile)[0]
if xlsfilename in [t.f_xlsfile.retrieve(row.f_xlsfile)[0] for row in db(
t.id < t_xlsfile_row.id).select(t.f_xlsfile)]:
session.flash = T('Sorry, you already posted a file with that name 
: %s' % (xlsfilename,))
db.rollback()
redirect(URL('index'))

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Most Missing features in Web2Py

2013-03-01 Thread François Delpierre
I'm using Web2Py for 6 months now, and I'm very happy with it.But here are 
the most missing features I found in Web2Py. Most of those missing features 
concerns grids/smartgrids.

   - inline_editing parameter for SQLFORM.(smart)grid to allow inline 
   edition of some or all fields (ajax), without the need to go on a dedicated 
   Edit page for every change.
   - Bulk editing: select some of the lines, and change one of the field to 
   the same value. Very usefull when contraint IS_IN_... .
   - when a string field has the requires=IS_IN_SET(...) constraint, I 
   would expect to have those predefined choices in the search form also, (and 
   possibly keep one option for the free text search.)
   - Allow wildcards for simple searchs, but also regular expression if 
   search string withing ! or / marks.
   - Allow a different representation in table than in view, in order to be 
   able to have short fields in table when a mapping function is defined. For 
   instance, if in the view forms we have company department field with 
   requires=IS_IN_SET('Information Technology', 'Accounting & Finance', 'Human 
   Resources'), and if I defined the appropriate mapping function, I would 
   like to see IT, A&F and HR in the table view, to be able to display more 
   columns.
   - Option to disable the "Delete confirmation" from the smartgrid 
   definition. (for only one form)
   - Export computed fields, either as text, either as html, or maybe 
   default to export links, and provide a links_export similar to links but 
   used for exporting data. Set links_export to None to prevent exporting 
   links fields.
   - Autocompletion / help in the online code editor.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to order by IP address? Or how to write an orderby function?

2013-03-04 Thread François Delpierre
Hi,

How can I orderby IP address?
Can I write my own sort function?
How?

The following code:
db.t_device2ip.f_ip_id.requires = IS_IN_DB(db,'t_ip.id','%(f_ip_addr)s: 
%(f_dns_name)s',multiple=False, orderby = 't_ip.f_ip_addr')

Sort as if IP was a string. (well in fact it is.. but that's not the result 
I want to see..)

Thanks,

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How can I disable the delete confirmation in SQLFORM.grid ?

2013-03-04 Thread François Delpierre
Yes Anthony, I think such an option is missing, as usually you just want to 
disable that for few grids...

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Cannot label id field

2013-03-04 Thread François Delpierre
Thanks Derek and Richard.
I got it to work by using:
db.t_bsc.id.label=T('Service Code')

After the the table definition, instead of inside of it.
Thanks also for the id type. I was not aware of that type.

Thanks,

On Monday, 11 February 2013 20:43:24 UTC+1, Richard wrote:
>
>
>
> I just look again at the model of François and I think there is a mistake, 
> because id field should not be of type integer when you explicitly define 
> them in your model
>
> type='id' is the proper type, so maybe he has 2 differents columns named 
> id or his model doesn't really works.
>
> Ref.: http://web2py.com/books/default/chapter/29/06#DAL,-Table,-Field
>
> Richard
>
>
> On Mon, Feb 11, 2013 at 1:55 PM, Derek >wrote:
>
>> Seems to work for me.
>>
>> db.define_table('customers',
>> Field('name', 'string',length=50, requires=IS_NOT_EMPTY()),
>>...
>> Field('country','string',length=3),
>> Field('active','boolean'),format='%(name)s', singular='customer', 
>> plural='customers')
>> db.customers.id.label=T('TEST ID')
>>
>> On web2py 2.3.2
>>
>> On Saturday, February 9, 2013 3:42:50 AM UTC-7, François Delpierre wrote:
>>>
>>> Hi,
>>>
>>> Let's see the definition:
>>>
>>> db.define_table('t_bsc',
>>> Field('id', type='integer', label=T('Service Code')),
>>> Field('f_name', type='string',
>>>   label=T('Service name'),
>>>   comment=T('The name of the customer facing service as known to 
>>> your customer.')),
>>>
>>> But in my smartgrid, I still see the label Id instead of 'Service Code' 
>>> for the id field...
>>> Is this a bug?
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to select(count<1, groupby=db.person) or how to find persons with no dogs/less than x dogs.

2012-12-13 Thread François Delpierre
So, for instance :
db().select(db.person.name, db.person.id.count(), groupby=db.person.id, 
left=db.dog.on(db.person.id==db.dog.person_id))

will give me the person, and the number of dogs that this person has.
But I only want to get persons with no dogs.

Regards,

-- 





[web2py] Re: How to select(count<1, groupby=db.person) or how to find persons with no dogs/less than x dogs.

2012-12-14 Thread François Delpierre
Excellent !!
That did it.
Thanks a lot.
It would be very nice to have a wiki with all the samples for the DAL. I 
did found this one :
http://web2py.wordpress.com/2010/05/23/some-tricks-to-use-when-dealing-with-databases/
but it didn't help me. I was not thinking about the negation.

Thanks,

-- 





[web2py] Small typos in latest documentation.

2013-01-01 Thread François Delpierre

http://web2py.com/books/default/chapter/29/07#The-process-and-validate-methods
Typo in the list.

http://web2py.com/books/default/chapter/29/04
scheduler.queur_task(


-- 





[web2py] Unique Constraint not working for : Field(type='upload', unique=True)

2013-01-02 Thread François Delpierre
Hi,

The unique constraint is not working in the following Field definition.

Field('f_xlsfile', type='upload', notnull=True,
  requires=[
  IS_UPLOAD_FILENAME(extension='^xlsx?$',
  error_message='Please post .xls or .xlsx Excel files 
only.'),
  IS_LENGTH(1048576*2, 1024, 
  error_message='File size must be between 1kB & 2048kB'),
  ],
  unique=True,
  label=T('Excel file')),

-- 





[web2py] Best way to migrate from sqlite to postgresql (or other db)

2013-10-11 Thread François Delpierre
Hi,

For performance reason I would like to migrate my DB from sqlite to 
postgreSQL DB.
What's the best way to do it.
I spent some time with the export 
/ db.import_from_csv_file(open('somefile.csv', 'rb')) and I just feel like 
I'm loosing my time for 2 hours.
After trying to fix various problems, now I notice that all my keys are 
wrong, so the db.import_from_csv does not keep the id values, and so 
completely break the application.

What is the recommended way to migrate from sqlite to an other DB (without 
breaking the application)?

Thanks,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] (foreign key constraint failed) with onupdate=auth.archive

2015-02-05 Thread François Delpierre
Hi,

I get an Integrity Error everytime I modify a record in the t_route, and I 
don't understand what's wrong. The t_route contains only 1 record, the 
t_route_archive is empty.

What should I do?

The controller:
@auth.requires_login()
def route_manage():
form = SQLFORM.smartgrid(db.t_route,
csv=False,
searchable=False,
details=False,
onupdate=auth.archive
)
return locals()

Here is the model:

db.define_table('t_route',
Field('f_name', type='string',
  label=T('Name')),
Field('f_precedence', type='integer',
  default=100,
  label=T('Precedence')),
Field('f_source', type='reference t_source',
  required=False, label='Source'
  ),
Field('f_mid_filter', type='string',
  label=T('Mid Filter')),
Field('f_pan_filter', type='string',
  label=T('Pan Filter')),
Field('f_destination', type='reference t_destination',
  required=True,
  label=T('Destination')),
Field('f_overflow', label='Overflow', default='overflow',
  requires = IS_IN_SET(('overflow', 'block'))),
Field('f_enabled', type='boolean',
  default=True,
  label=T('Enabled')),
Field('f_version', type='reference t_version',
  label=T('Rule Version')),
auth.signature,
format='%(f_name)s',
singular='Route',
migrate=settings.migrate)

db.define_table('t_route_archive', 
db.t_route,Field('current_record','reference t_route',
readable=False, 
writable=False),
singular='route 
archive')


And the SQLite Schemas:

sqlite> .schema t_route
CREATE TABLE "t_route"(
id INTEGER PRIMARY KEY AUTOINCREMENT,
f_name CHAR(512),
f_precedence INTEGER,
f_source INTEGER REFERENCES t_source (id) ON DELETE CASCADE,
f_mid_filter CHAR(512),
f_pan_filter CHAR(512),
f_destination INTEGER REFERENCES t_destination (id) ON DELETE CASCADE,
f_enabled CHAR(1),
f_rule_version INTEGER REFERENCES t_version (id) ON DELETE CASCADE,
is_active CHAR(1),
created_on TIMESTAMP,
created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on TIMESTAMP,
modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
, f_src INTEGER REFERENCES t_source (id) ON DELETE CASCADE, f_version 
INTEGER REFERENCES t_version (id) ON DELETE CASCADE, f_overflow CHAR(512));
sqlite> .schema t_route_archive
CREATE TABLE "t_route_archive"(
id INTEGER PRIMARY KEY AUTOINCREMENT,
f_name CHAR(512),
f_precedence INTEGER,
f_source INTEGER REFERENCES t_source (id) ON DELETE CASCADE,
f_mid_filter CHAR(512),
f_pan_filter CHAR(512),
f_destination INTEGER REFERENCES destination (id) ON DELETE CASCADE,
f_enabled CHAR(1),
f_rule_version INTEGER REFERENCES t_version (id) ON DELETE CASCADE,
is_active CHAR(1),
created_on TIMESTAMP,
created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on TIMESTAMP,
modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
current_record INTEGER REFERENCES t_route (id) ON DELETE CASCADE
, f_src INTEGER REFERENCES t_source (id) ON DELETE CASCADE, f_version 
INTEGER REFERENCES t_version (id) ON DELETE CASCADE, f_overflow CHAR(512));


Thanks !

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to copy and move a file from the admin interface?

2015-02-18 Thread François Delpierre
Hi,

>From the admin interface, it's easy to create a new file or to delete it, 
but how do I move one to an other folder, or just copy an existing one to a 
new file name?
This is one of the few operation I still need a shell on the server for.


Regards,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Get Ticket issued: unknown instead of the reference link to the error ticket when crashing

2015-05-11 Thread François Delpierre
Hi,

On a Debian 7, with web2py 2.9.12-stable+timestamp.2015.02.13.23.31.09 
(Running on Apache, Python 2.7.3) - WSGI with https

I have a problem I can't figure out.

On a healthy instance of Web2PY, when an error occurs, we have an "Internal 
Error" message, and a Ticket Issued with a link pointing to the stack trace 
at the event of the crash.

On my buggy instance, I have a different behavior when the app crashes or I 
just "raise Exception" in the code:

   - I have the Internal Error page with a "Ticket Issued: unknown" instead 
   of the link to the stack trace that only admin has access to.
   - The error ticket is properly created, as it's available in the 
   errors sub-folder.
   - I can see the error ticket, if I explicitly go to the "Errors" link on 
   top of the page.
   - I also have the error trace in the Apache error.log.

To reproduce the problem, just creating a single table app from the wizard 
triggers it. So it's not application dependent.

I checked with the same Apache config file than the one I have on a working 
server. 
What can be wrong? What should I check?

Thanks,

François

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.