[web2py] Cached select

2015-05-13 Thread Fabrice Dhenry
Hi,

Is there a proper way to use cached select outside the web2py context.
I'm using DAL in a desktop app development that do not require the full 
stack web2py framework.
The cache module seems to be bound to the global object "request" and I 
failed to figure out how to use it.

What I have tried:
 
from gluon.dal import DAL,Field
from gluon import cache


tables definitions etc...

...

def getObjectParent(self,aRow):
db=self.db 

#0.13838965
query=(db.object_object_relationship.object_B_id==aRow)\
&(db.object_object_relationship.f_type=='parent_child')\
&(db.object_object_relationship.object_A_id==db.Pt_object.id)   


return 
db(query).select(db.Pt_object.ALL,cacheable=True,cache=(cache.CacheInRam,3600),)

--->
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File 
"C:\Users\fabrice\workspace\simplePLM\src\simplePLM\core\gluon\packages\dal\pydal\adapters\base.py",
 
line 1237, in select
time_expire)
TypeError: __init__() takes at most 2 arguments (4 given)

Many thanks for any help,

Best regards 

Fabrice

-- 
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.


Re: [web2py] Re: web2py dal not creating database

2015-05-13 Thread Ivan Terreno
Ohhh...its great!!!... you fixed my problem!!!

El domingo, 13 de noviembre de 2011, 20:41:53 (UTC-3), rochacbruno escribió:
>
> as you are using mysql. try to delete everything you has in /databases 
> folder  (the .table files) backup it.
>
> then try again with table definitions and migrate=True
>
> http://zerp.ly/rochacbruno
> Em 13/11/2011 21:33, "Jimmy Stewpot" > 
> escreveu:
>
>> Hi,
>>
>> I have nothing set in my model at all for migrate so I assume that it's 
>> True by being ommited.
>>
>> It has got me stumped.. I have not had problems like this in the past 
>> with my previous testing.
>>
>>
>> - Original Message -
>> From: "Bruno Rocha" >
>> To: web...@googlegroups.com 
>> Sent: Sunday, 13 November, 2011 5:53:52 PM
>> Subject: Re: [web2py] Re: web2py dal not creating database
>>
>> what is in your: define_table(..., migrate=? ) and db = DAL(, 
>> migrate_enabled=? )
>>
>>
>> It needs to be setted to True or ommited to create the tables.
>>
>>
>> On Sun, Nov 13, 2011 at 4:14 AM, Jimmy Stewpot < mai...@oranged.to 
>>  > wrote:
>>
>>
>> Hi,
>>
>> Thanks for the quick response..
>>
>> I have the DB created in mysql. The user has rights (using the root 
>> user).. still no luck.
>>
>> I've turned on query logging in mysql, the app queries are all working as 
>> expected but it won't create the model.
>>
>> Regards,
>>
>> Jimmy
>>
>>
>>
>>
>>
>>
>>
>>
>> - Original Message -
>> From: "Anthony" < abas...@gmail.com  >
>> To: web...@googlegroups.com 
>> Sent: Sunday, 13 November, 2011 3:54:58 PM
>> Subject: [web2py] Re: web2py dal not creating database
>>
>> web2py will only create the db for you if you're using SQLite -- 
>> otherwise you have to create the db (once the db is created, though, web2py 
>> will create tables for you). See 
>> http://web2py.com/book/default/chapter/06#Connection-Strings .
>>
>>
>> Anthony
>>
>> On Saturday, November 12, 2011 11:10:18 PM UTC-5, Jimmy Stewpot wrote:
>>
>> Hello,
>>
>> I have been playing around with web2py for about a month.. I have
>> finally got to the point where I wanted to test the packing of my app
>> to test the install on another system. However when I load the app
>> into web2py on the new system the database is never created. I've even
>> gone so far as to use the root mysql database user to see where any
>> possible issues could arise.. I can't see any errors except a ticket
>> which says..
>>
>> ProgrammingError: (1146, u"Table 'app03.auth_user' doesn't exist")
>>
>> I loaded the app via the administrative interface over the loopback..
>> The sqllog has nothing interesting it.. I've restarted mysql, apache,
>> the management interface with no success.
>>
>> Any advice would be greatly appreciated.
>>
>> Regards,
>>
>> Jimmy.
>>
>>
>>
>>
>> --
>>
>>
>>
>>
>>
>>
>> Bruno Rocha
>> [ http://rochacbruno.com.br ]
>>
>

-- 
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] Google plus login on web2py

2015-05-13 Thread Juozas Masiulis
How should the google plus login be implemented on web2py?  Janrain does 
not work with google plus, and 
gluon/contrib/login_methods/oauth20_account.py provides an example only for 
facebook, but I have no idea on how to implement it  with google. Google 
provides examples for flask, but they are not helpfull for web2py.

-- 
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] Using cache outside web2py (with DAL)

2015-05-13 Thread Fabrice Dhenry
Hi,

I'm looking for a way to use cached select facilities outside web2py 
context.

I use DAL as a standalone package for a desktop application which does not 
require the full stack web2py framework.

The cache module seems to be bound to the globals object "request".

what I tired to do so far:

from gluon.dal import DAL,Field
from gluon import cache

...
table def ... etc...

def getObjectParent(self,aRow):
db=self.db 

#0.13838965
query=(db.object_object_relationship.object_B_id==aRow)\
&(db.object_object_relationship.f_type=='parent_child')\
&(db.object_object_relationship.object_A_id==db.Pt_object.id)   


return 
db(query).select(db.Pt_object.ALL,cacheable=True,cache=(cache.CacheInRam,3600),)


--->time_expire)
TypeError: __init__() takes at most 2 arguments (4 given)


Many thanks for any help,

Best regards,

Fabrice.

-- 
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] Icon on input fields

2015-05-13 Thread Rafael Ribeiro
Hi, i would like to generate inputs with SQLFORM like this:

  
Label

  
  

  


and the define the icon "fa fa-bell-o" as a custom variable in the model


is it possible? 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] An Existing web2py app can i upload to web2py Environment using Upload & install packed application

2015-05-13 Thread chandrabhushana rao
Hi,
 
I have an web2py application in my local system i want to upload that 
application into web2py environment and run and do some modifications that 
application 
but i am trying to upload my application zip folder in to web2py 
environment using the Upload & install packed application option present in 
web2py admin interface 
the web page is crashed and that file is not uploaded in to the web2py 
environment.
 
any one give me the suggestions to do this thanks in advance
 
Thanks,
Chandra

-- 
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.


Re: [web2py] Re: Export to csv which is not taking label from model file, where Grid takes.

2015-05-13 Thread Anthony
Yeah, I'm not sure you can use Rows.export_to_csv_file (at least, I don't 
think the colnames argument will help, as that simply specifies which 
columns you want to include -- it's purpose is not to rename columns). I 
suppose you could instead suppress the column names altogether, and then 
prepend your own column names to the returned object. Or just create your 
own custom CSV writer.

Anthony

On Wednesday, May 13, 2015 at 9:24:59 AM UTC-4, Prasad Muley wrote:
>
> Hi Anthony,
>
>I've used the custom CSV exporter.  I tried to use *colnames* 
> parameters 
> of export_to_csv_file But got an error (mentioned earlier). Am I missing 
> anything in following code??
>
>
> class CSVExporter(object):
> """This class is used when grid's table contains reference key id.
>Exported CSV should contain reference key name of reference
>key not ids"""
> file_ext = "csv"
> content_type = "text/csv"
>
> def __init__(self, rows):
> self.rows = rows
>
> def export(self):
> if self.rows:
> s = StringIO()
> colnames = []
> for colname in self.rows.colnames:
> colnames.append(colname.split('.')[-1].replace('_', ' 
> ').upper())
> print "DEBUG: colnames", colnames
> self.rows.export_to_csv_file(s, represent=True,
>  colnames=colnames)
> return s.getvalue()
> else:
> return ''
>
>
> It successfully prints column name
> DEBUG: ['FNAME', 'LNAME']
>
> I got following error 
>
> 127.0.0.1.2015-05-13.18-52-30.6eb87877-1bb1-49e0-9f05-8508333fa967
>  'Row' object has no attribute '_extra'
>
> On Wed, May 13, 2015 at 6:08 PM, Anthony  wrote:
>
>> You can create your own CSV exporter:
>>
>> SQLFORM.grid(...,
>>  exportclasses=dict(csv=(MyExporterCSV, 'CSV',
>>  T('Comma-separated export of 
>> visible columns.'
>>
>> The MyExporterCSV class can inherit from gluon.sqlhtml.ExporterCSV 
>> . 
>> You can tweak the "export" method to change the column names as you like.
>>
>> Anthony
>>
>>
>> On Tuesday, May 12, 2015 at 1:07:40 PM UTC-4, Sujata Aghor wrote:
>>>
>>>
>>> Hi,
>>> In my model file I have defined table and Label for the fields like this 
>>> - 
>>> db.define_table('mytable',
>>> Field('fname', 'string', length=12, writable=False,
>>>   notnull=True, label='First Name'),
>>>Field('lname', 'string', length=12, writable=False,
>>>   notnull=True, label='Last Name'),
>>> ...
>>>
>>> 1. In case of Grids, table headers are coming from  model file (shown 
>>> above) No extra code has been written to show the labels from the model 
>>> file.
>>>
>>> 2. So I was expecting the same headers would come to CSV file also, but 
>>> surprisingly when I export to CSV we dont get these labels. (I tried by 
>>> doing CSV=true in case of grid and still gets mytable.fname)
>>>
>>> 3. From documentation, I found Grid has additional parameter. i.e 
>>> headers I tired to use that parameter to see if it works in export. So I 
>>> defined headers as below :
>>> headers = {'db.mytable.fname': 'First Name',
>>>'db.mytable.lname': 'Last Name'
>>>   }
>>>
>>> However export to CSV is still showing headers as db.mytable.fname
>>>
>>> Kindly guide!
>>> I suspect this is BUG in web2py export to csv which is not taking label 
>>> from model file.
>>>
>>> Thanks in Advance!!!
>>>
>>  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/tJafWvYxcdw/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Thanks and Regards
> Prasad M. Muley
>  

-- 
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] Re: Using "for"

2015-05-13 Thread Derek
yea lets look at that...

for i in hola...

that sets i to 'h' then 'o' then 'l' and finally 'a' and prints each letter 
to the console.
then 'return locals()'
i will be 'a' because that's what it was set to last.

get it?

so if you want hola or aloha...
controller:
i = 'aloha'
return i
view:
{{=i}}
or as Mass suggested, 


On Tuesday, May 12, 2015 at 2:46:45 PM UTC-7, KevC wrote:
>
> Hi!
>
> I got a problem, I wanna print a list or string on a 'view' using  a 'for' 
> but the view only show me the last number or letter. For example:
>
> My controller...
>
> for i in 'hola':
>  print i
>  return locals()
>
>
> My view...
>
> {{=i}}
>
> The view only show me the letter 'a'.
> Other example:
>
> a = [1,2,3]
> for i in a:
>  print i
>  return locals()
>
> My view...
>
> {{=i}}
>
> The view only show me the number 3.
>
> I got a mistake? Somebody help me.
> I used the console and It's ok, print all list and string.
>
> My best 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] Give hidden form field an id attribute

2015-05-13 Thread John Lofgren
How can I assign an id attribute to a hidden form field?

I've create a form with a hidden field 'interval' like this:

f=SQLFORM(db.mytable, hidden=dict(interval='year'))

I want to manipulate the value of that field in Javascript, so want to 
assign a known id to the field in order to reference it. I've tried the 
following, but the id isn't coming out in the XML:

>>> f.hidden_fields().element('input[name=interval]').update(_id=
'form_interval')

>>> f.hidden_fields().element('input[name=interval]').xml()
'

>>> f.hidden_fields().element('input[name=interval]')['_id'] = 
'form_interval'
>>> f.hidden_fields().element('input[name=interval]').xml()
''

I have assigned id's to other fields in the form using 
f.custom.widget..update(_id='form_myid'). How can I give the hidden 
field an id?

Thanks,
John

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Lisandro
Ok, if you need me to try anything in the server, let me know. 
I will be out from office until friday, but I still can connect and do some 
test. 

Thanks again for your help!

El miércoles, 13 de mayo de 2015, 15:37:38 (UTC-3), Niphlod escribió:
>
> there's a problem, I think. 
> max_empty_runs=5 means "do 5 loops, if you didn't pick or assign any 
> tasks, die". 
> you said your workers are started by a cron job every 2 minutes (god knows 
> why, but that's your choice).
> your instantiation doesn't touch the heartbeat parameter, which is by 
> default 3 seconds.
> this means that there is a "timeframe" of a taddle bit more than 15 
> seconds to pick up "ready to process tasks". 
> Which, you said, are all there and ready to be processed.
> A worker gets to rule out if he's an elegible "master" every 5 cycles (the 
> "ticker" who dispatches tasks).
> The problem I'm about to highlight is subtle... when a worker needs to 
> rule out if he's an elegible master, he does also the "pruning" of dead 
> workers.
> First of all, as soon as it's started, a worker does this thing (i.e. at 
> the very first loop). This means that if your workers are started every 2 
> minutes, and there are ready to process tasks, at the very first round the 
> worker would prune "the last worker that died doing nothing"
> Now, if the last worker didn't process any task and shutted down, he'd be 
> pruned as long as the last_heartbeat is 9 seconds (line 1015), because he'd 
> still be marked as an ACTIVE worker.
> This doesn't add up with what you're experiencing... a worker with 
> max_empty_runs=5 started every 2 minutes would effectively have a worker 
> pick up the tasks as soon as it's started.
>
> This shouldn't happen..
>
> DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=False)
> DEBUG:web2py.scheduler.medios#27764:freeing workers that have not 
> sent heartbeat
> INFO:web2py.scheduler.medios#27764:nothing to do
> DEBUG:web2py.scheduler.medios#27764:sleeping...
> DEBUG:web2py.scheduler.medios#27764:empty runs 1/6
> INFO:web2py.scheduler.medios#27764:TICKER: I'm a ticker
> DEBUG:web2py.scheduler.medios#27764:looping...
> DEBUG:web2py.scheduler.medios#27764:Assigning tasks...
> INFO:web2py.scheduler.medios#27764:TICKER: workers are 1
> INFO:web2py.scheduler.medios#27764:TICKER: tasks are 0
>
>
> tl;dr: glad that you sorted out, but I'm going to test things as they are 
> in your environment to try to reproduce the erratic behaviour.
>

-- 
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] Re: AttributeError: 'DAL' object has no attribute

2015-05-13 Thread Paolo Valleri
Which web2py version are you using?
Can you post a complete example that reproduces the issue?

Paolo

On Wednesday, May 13, 2015 at 7:14:30 PM UTC+2, goome wrote:
>
> hello , i have this action in defaul.py
> """
> @auth.requires_login()
> def lista_fornitori():
>   fornitori = 
> legacy_db().select(legacy_db.fornitori.ALL,orderby=legacy_db.fornitori.BrandName.upper())
>   return dict(fornitori = fornitori)
> ""
> and this work perfectly giving me the list of records in table 'fornitori'
>
> Now in another action i need to retrieve the same list for creating a 
> select,
> but this time the same code
> fornitori = legacy_db().select(legacy_db.fornitori.ALL)
> fails with error
> AttributeError: 'DAL' object has no attribute 'fornitori'
>
> why in this action DAL does not find the table fornitori? What could be 
> the problem.
> The 2 actions are both in default.py
>
> The beginning of thje second actions:
> def sel_fornitore():
>   fornitori = legacy_db(legacy_db.fornitori.ALL).select()
>
> i also tried from shell with the same error.
> What i am missing?
>
>

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Niphlod
there's a problem, I think. 
max_empty_runs=5 means "do 5 loops, if you didn't pick or assign any tasks, 
die". 
you said your workers are started by a cron job every 2 minutes (god knows 
why, but that's your choice).
your instantiation doesn't touch the heartbeat parameter, which is by 
default 3 seconds.
this means that there is a "timeframe" of a taddle bit more than 15 seconds 
to pick up "ready to process tasks". 
Which, you said, are all there and ready to be processed.
A worker gets to rule out if he's an elegible "master" every 5 cycles (the 
"ticker" who dispatches tasks).
The problem I'm about to highlight is subtle... when a worker needs to rule 
out if he's an elegible master, he does also the "pruning" of dead workers.
First of all, as soon as it's started, a worker does this thing (i.e. at 
the very first loop). This means that if your workers are started every 2 
minutes, and there are ready to process tasks, at the very first round the 
worker would prune "the last worker that died doing nothing"
Now, if the last worker didn't process any task and shutted down, he'd be 
pruned as long as the last_heartbeat is 9 seconds (line 1015), because he'd 
still be marked as an ACTIVE worker.
This doesn't add up with what you're experiencing... a worker with 
max_empty_runs=5 started every 2 minutes would effectively have a worker 
pick up the tasks as soon as it's started.

This shouldn't happen..

DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=False)
DEBUG:web2py.scheduler.medios#27764:freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 1/6
INFO:web2py.scheduler.medios#27764:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27764:looping...
DEBUG:web2py.scheduler.medios#27764:Assigning tasks...
INFO:web2py.scheduler.medios#27764:TICKER: workers are 1
INFO:web2py.scheduler.medios#27764:TICKER: tasks are 0


tl;dr: glad that you sorted out, but I'm going to test things as they are 
in your environment to try to reproduce the erratic behaviour.

-- 
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] Re: conditional in smartgrid that refer to the boolean type of field

2015-05-13 Thread Dave S


On Wednesday, May 13, 2015 at 1:19:31 AM UTC-7, 黄祥 wrote:
>
> *work*
> editable = auth.has_membership('Manager') and (lambda row : 
> row.is_authorized == False)
>
> *not work (no error occured, the result is not expected)*
> editable = (lambda row : row.is_authorized == False) and 
> auth.has_membership('Manager')
>
> why the first is work yet the second result is not expected?
>
>
Is that a matter of short-circuit evaluation?  In the first example, if the 
user isn't in group "Manager" , the lambda might not even be run.  In the 
second example, the lambda is always run.  I'm not sure if that's the 
issue, but I'd consider it a possibility.

/dps

-- 
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] AttributeError: 'DAL' object has no attribute

2015-05-13 Thread goome
hello , i have this action in defaul.py
"""
@auth.requires_login()
def lista_fornitori():
  fornitori = 
legacy_db().select(legacy_db.fornitori.ALL,orderby=legacy_db.fornitori.BrandName.upper())
  return dict(fornitori = fornitori)
""
and this work perfectly giving me the list of records in table 'fornitori'

Now in another action i need to retrieve the same list for creating a 
select,
but this time the same code
fornitori = legacy_db().select(legacy_db.fornitori.ALL)
fails with error
AttributeError: 'DAL' object has no attribute 'fornitori'

why in this action DAL does not find the table fornitori? What could be the 
problem.
The 2 actions are both in default.py

The beginning of thje second actions:
def sel_fornitore():
  fornitori = legacy_db(legacy_db.fornitori.ALL).select()

i also tried from shell with the same error.
What i am missing?

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Lisandro
Sorry to bother with so many messages, but I think this is going somewhere. 

I've found the problem: it's the max_empty_runs parameter.
I changed it to 10 (I was using it in 3) and it started working: the 
scheduler started executing the task accordingly to the period speficied in 
the task. 
Then I changed it back to 3, and again the problem, the task wasn't 
executed. 
I've found that the limit is 7. Any number below 7 causes the problem. 7 or 
more is ok. 
Heartbet is the default value. 

I made a simple test. Having a task queued, I run the worker with 
max_empty_runs=6 and then =7.

Here is the log with max_empty_runs=6:

starting single-scheduler for "webmedios"...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=True)
DEBUG:web2py.scheduler.medios#27764:thread building own DAL object
DEBUG:web2py.scheduler.medios#27764:looping...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27764:defining tables (migrate=False)
DEBUG:web2py.scheduler.medios#27764:freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 1/6
INFO:web2py.scheduler.medios#27764:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27764:looping...
DEBUG:web2py.scheduler.medios#27764:Assigning tasks...
INFO:web2py.scheduler.medios#27764:TICKER: workers are 1
INFO:web2py.scheduler.medios#27764:TICKER: tasks are 0
DEBUG:web2py.scheduler.medios#27764:Tasks assigned...
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 2/6
DEBUG:web2py.scheduler.medios#27764:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 3/6
DEBUG:web2py.scheduler.medios#27764:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 4/6
DEBUG:web2py.scheduler.medios#27764:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 5/6
DEBUG:web2py.scheduler.medios#27764:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27764:looping...
INFO:web2py.scheduler.medios#27764:nothing to do
DEBUG:web2py.scheduler.medios#27764:sleeping...
DEBUG:web2py.scheduler.medios#27764:empty runs 6/6
INFO:web2py.scheduler.medios#27764:empty runs limit reached, killing myself
INFO:web2py.scheduler.medios#27764:die!


And here the log with max_empty_runs=7:

starting single-scheduler for "webmedios"...

DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27801:defining tables (migrate=True)
DEBUG:web2py.scheduler.medios#27801:thread building own DAL object
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#27801:defining tables (migrate=False)
DEBUG:web2py.scheduler.medios#27801:freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 1/7
INFO:web2py.scheduler.medios#27801:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:Assigning tasks...
DEBUG:web2py.scheduler.medios#27801:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:TICKER: workers are 1
INFO:web2py.scheduler.medios#27801:TICKER: tasks are 0
DEBUG:web2py.scheduler.medios#27801:Tasks assigned...
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 2/7
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 3/7
DEBUG:web2py.scheduler.medios#27801:looping...
DEBUG:web2py.scheduler.medios#27801:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:empty runs 4/7
DEBUG:web2py.scheduler.medios#27801:looping...
INFO:web2py.scheduler.medios#27801:nothing to do
DEBUG:web2py.scheduler.medios#27801:sleeping...
DEBUG:web2py.scheduler.medios#27801:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#27801

Re: [web2py] Re: web2ruby possible?

2015-05-13 Thread José Ricardo Borba
+1.
web2py rocks...

2015-05-13 8:36 GMT-03:00 Leonel Câmara :

> I want whatever it is you guys are smoking!
>
> --
> 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.
>



-- 
José Ricardo Borba

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Lisandro
Recreating the scheduler tables doesn't work.

I've found a little difference between the logs on the server (where 
scheduler doesn't work) and the logs on localhost (where it does work). 
This line is present only on the server log:

DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)

The server is running PostgreSQL 9.1.15 + psycopg 2.4.5 + web2py 2.10.3
Localhost is running PostgreSQL 9.3.6 + psycopg 2.4.5 + web2py 2.10.4


Here is the complete log on server:

starting single-scheduler for "webmedios"...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#24872:defining tables (migrate=True)
DEBUG:web2py.scheduler.medios#24872:thread building own DAL object
DEBUG:web2py.scheduler.medios#24872:looping...
DEBUG:pyDAL:Your database version does not support the JSON data type (using 
TEXT instead)
DEBUG:web2py.scheduler.medios#24872:defining tables (migrate=False)
INFO:web2py.scheduler.medios#24872:nothing to do
DEBUG:web2py.scheduler.medios#24872:sleeping...
DEBUG:web2py.scheduler.medios#24872:empty runs 1/3
DEBUG:web2py.scheduler.medios#24872:freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.medios#24872:TICKER: I'm a ticker
DEBUG:web2py.scheduler.medios#24872:looping...
DEBUG:web2py.scheduler.medios#24872:Assigning tasks...
INFO:web2py.scheduler.medios#24872:TICKER: workers are 1
INFO:web2py.scheduler.medios#24872:TICKER: tasks are 0
DEBUG:web2py.scheduler.medios#24872:Tasks assigned...
DEBUG:web2py.scheduler.medios#24872:sleeping...
DEBUG:web2py.scheduler.medios#24872:empty runs 2/3
DEBUG:web2py.scheduler.medios#24872:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.medios#24872:looping...
INFO:web2py.scheduler.medios#24872:nothing to do
DEBUG:web2py.scheduler.medios#24872:sleeping...
DEBUG:web2py.scheduler.medios#24872:empty runs 3/3
INFO:web2py.scheduler.medios#24872:empty runs limit reached, killing myself
INFO:web2py.scheduler.medios#24872:die!



And here the complete log on localhost:

starting single-scheduler for "webmedios"...
DEBUG:web2py.scheduler.notebook#7049:defining tables (migrate=True)
DEBUG:web2py.scheduler.notebook#7049:thread building own DAL object
DEBUG:web2py.scheduler.notebook#7049:looping...
DEBUG:web2py.scheduler.notebook#7049:defining tables (migrate=False)
DEBUG:web2py.scheduler.notebook#7049:freeing workers that have not sent 
heartbeat
INFO:web2py.scheduler.notebook#7049:TICKER: I'm a ticker
INFO:web2py.scheduler.notebook#7049:nothing to do
DEBUG:web2py.scheduler.notebook#7049:sleeping...
DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
DEBUG:web2py.scheduler.notebook#7049:looping...
DEBUG:web2py.scheduler.notebook#7049:Assigning tasks...
DEBUG:web2py.scheduler.notebook#7049:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.notebook#7049:TICKER: workers are 1
INFO:web2py.scheduler.notebook#7049:TICKER: tasks are 1
DEBUG:web2py.scheduler.notebook#7049:Tasks assigned...
DEBUG:web2py.scheduler.notebook#7049:sleeping...
DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
DEBUG:web2py.scheduler.notebook#7049:recording heartbeat (ACTIVE)
DEBUG:web2py.scheduler.notebook#7049:looping...
DEBUG:web2py.scheduler.notebook#7049:   work to do 2
DEBUG:web2py.scheduler.notebook#7049:new scheduler_run record
INFO:web2py.scheduler.notebook#7049:new task 2 "mytest" demo.mytest
DEBUG:web2py.scheduler.notebook#7049: new task allocated: demo.mytest
DEBUG:web2py.scheduler.notebook#7049:   task starting
DEBUG:web2py.scheduler.notebook#7049:task started
DEBUG:web2py.scheduler.notebook#7049:new task report: COMPLETED
DEBUG:web2py.scheduler.notebook#7049:   result: true
DEBUG:web2py.scheduler.notebook#7049:  task completed or failed
DEBUG:web2py.scheduler.notebook#7049: recording task report in db 
(COMPLETED)
INFO:web2py.scheduler.notebook#7049:task completed (COMPLETED)
DEBUG:web2py.scheduler.notebook#7049:looping...
INFO:web2py.scheduler.notebook#7049:nothing to do
DEBUG:web2py.scheduler.notebook#7049:sleeping...
DEBUG:web2py.scheduler.notebook#7049:empty runs 1/3
DEBUG:web2py.scheduler.notebook#7049:looping...
DEBUG:web2py.scheduler.notebook#7049:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.notebook#7049:nothing to do
DEBUG:web2py.scheduler.notebook#7049:sleeping...
DEBUG:web2py.scheduler.notebook#7049:empty runs 2/3
DEBUG:web2py.scheduler.notebook#7049:looping...
DEBUG:web2py.scheduler.notebook#7049:recording heartbeat (ACTIVE)
INFO:web2py.scheduler.notebook#7049:nothing to do
DEBUG:web2py.scheduler.notebook#7049:sleeping...
DEBUG:web2py.scheduler.notebook#7049:empty runs 3/3
INFO:web2py.scheduler.notebook#7049:empty runs limit reached, killing myself
INFO:web2py.scheduler.notebook#7049:die!


What do you think? Where should I continue looking for the problem?


El miércoles, 13 de mayo de 2015, 9:20:06 (UTC-3), Lisandro escribió:
>
> Niphlod, I really appreciate your time on this. 
>
> I left th

[web2py] Re: Customizing registration fields for linkedin login

2015-05-13 Thread John Costantino
Yes, that is correct. I added extra fields using the 
auth.settings.extra_fields['']. 
So the table is able to support the extra ones I need. My issue is more so 
with making sure that when logging with the linkedin API. I need to be sure 
to get the rest of the information from the API, such as the public-url, 
and then map those to the correct extra fields which where set by myself in 
the auth.users table. 

On Tuesday, May 12, 2015 at 5:56:58 PM UTC-4, 黄祥 wrote:
>
> had you modified the auth_users table?
>
> ref:
>
> http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth
>
> best regards,
> stifan
>

-- 
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.


Re: [web2py] Re: Export to csv which is not taking label from model file, where Grid takes.

2015-05-13 Thread Prasad Muley
Hi Anthony,

   I've used the custom CSV exporter.  I tried to use *colnames* parameters
of export_to_csv_file But got an error (mentioned earlier). Am I missing
anything in following code??


class CSVExporter(object):
"""This class is used when grid's table contains reference key id.
   Exported CSV should contain reference key name of reference
   key not ids"""
file_ext = "csv"
content_type = "text/csv"

def __init__(self, rows):
self.rows = rows

def export(self):
if self.rows:
s = StringIO()
colnames = []
for colname in self.rows.colnames:
colnames.append(colname.split('.')[-1].replace('_', '
').upper())
print "DEBUG: colnames", colnames
self.rows.export_to_csv_file(s, represent=True,
 colnames=colnames)
return s.getvalue()
else:
return ''


It successfully prints column name
DEBUG: ['FNAME', 'LNAME']

I got following error

127.0.0.1.2015-05-13.18-52-30.6eb87877-1bb1-49e0-9f05-8508333fa967
 'Row' object has no attribute '_extra'

On Wed, May 13, 2015 at 6:08 PM, Anthony  wrote:

> You can create your own CSV exporter:
>
> SQLFORM.grid(...,
>  exportclasses=dict(csv=(MyExporterCSV, 'CSV',
>  T('Comma-separated export of visible
> columns.'
>
> The MyExporterCSV class can inherit from gluon.sqlhtml.ExporterCSV
> .
> You can tweak the "export" method to change the column names as you like.
>
> Anthony
>
>
> On Tuesday, May 12, 2015 at 1:07:40 PM UTC-4, Sujata Aghor wrote:
>>
>>
>> Hi,
>> In my model file I have defined table and Label for the fields like this
>> -
>> db.define_table('mytable',
>> Field('fname', 'string', length=12, writable=False,
>>   notnull=True, label='First Name'),
>>Field('lname', 'string', length=12, writable=False,
>>   notnull=True, label='Last Name'),
>> ...
>>
>> 1. In case of Grids, table headers are coming from  model file (shown
>> above) No extra code has been written to show the labels from the model
>> file.
>>
>> 2. So I was expecting the same headers would come to CSV file also, but
>> surprisingly when I export to CSV we dont get these labels. (I tried by
>> doing CSV=true in case of grid and still gets mytable.fname)
>>
>> 3. From documentation, I found Grid has additional parameter. i.e headers
>> I tired to use that parameter to see if it works in export. So I defined
>> headers as below :
>> headers = {'db.mytable.fname': 'First Name',
>>'db.mytable.lname': 'Last Name'
>>   }
>>
>> However export to CSV is still showing headers as db.mytable.fname
>>
>> Kindly guide!
>> I suspect this is BUG in web2py export to csv which is not taking label
>> from model file.
>>
>> Thanks in Advance!!!
>>
>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/tJafWvYxcdw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks and Regards
Prasad M. Muley

-- 
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] Re: Export to csv which is not taking label from model file, where Grid takes.

2015-05-13 Thread Anthony
You can create your own CSV exporter:

SQLFORM.grid(...,
 exportclasses=dict(csv=(MyExporterCSV, 'CSV',
 T('Comma-separated export of visible 
columns.'

The MyExporterCSV class can inherit from gluon.sqlhtml.ExporterCSV 
. You 
can tweak the "export" method to change the column names as you like.

Anthony

On Tuesday, May 12, 2015 at 1:07:40 PM UTC-4, Sujata Aghor wrote:
>
>
> Hi,
> In my model file I have defined table and Label for the fields like this - 
> db.define_table('mytable',
> Field('fname', 'string', length=12, writable=False,
>   notnull=True, label='First Name'),
>Field('lname', 'string', length=12, writable=False,
>   notnull=True, label='Last Name'),
> ...
>
> 1. In case of Grids, table headers are coming from  model file (shown 
> above) No extra code has been written to show the labels from the model 
> file.
>
> 2. So I was expecting the same headers would come to CSV file also, but 
> surprisingly when I export to CSV we dont get these labels. (I tried by 
> doing CSV=true in case of grid and still gets mytable.fname)
>
> 3. From documentation, I found Grid has additional parameter. i.e headers 
> I tired to use that parameter to see if it works in export. So I defined 
> headers as below :
> headers = {'db.mytable.fname': 'First Name',
>'db.mytable.lname': 'Last Name'
>   }
>
> However export to CSV is still showing headers as db.mytable.fname
>
> Kindly guide!
> I suspect this is BUG in web2py export to csv which is not taking label 
> from model file.
>
> Thanks in Advance!!!
>

-- 
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] Re: best practice for internal function

2015-05-13 Thread Anthony
>From the book :

*Functions that take arguments or start with a double underscore are not 
publicly exposed and can only be called by other functions*.

So this will also work:

def __testfunction():
return 'whatever'

Anthony

On Wednesday, May 13, 2015 at 6:44:50 AM UTC-4, Niphlod wrote:
>
> that this function is also available from outside (ajax) and not just 
>> within my controllers
>
>
>
> def testfunction(dummy=None):
>  return dict()
>
> in a controller can't be called as a function from a web request.
>
> tl;dr: a function defined with any number of arguments isn't callable in a 
> web request.
>

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Lisandro
Niphlod, I really appreciate your time on this. 

I left the task queued and I went to sleep. The same only task that the 
previous example (I only changed the period to 300 seconds instead of 30, 
and left repeats=0 to make it loop). The worker is starting every 2 minutes 
(from linux cron). 

This morning, when I check the scheduler_run table, I see that the task was 
successfully executed, but only some times, not every 5 minutes (300 
seconds), but every some random period, much larger than 5 minutes. This is 
the start/stop time of the runs in the scheduler_run table:
 2015-05-13 00:57:08
 2015-05-13 03:21:07
 2015-05-13 03:54:08
 2015-05-13 04:03:07
 2015-05-13 04:39:08
 2015-05-13 06:09:07
 2015-05-13 06:33:08
 2015-05-13 06:36:07
 2015-05-13 06:45:08
 2015-05-13 07:33:08
 2015-05-13 07:57:07
 2015-05-13 08:33:07

Notice that the last run was about 20 minutes ago. The task ran succesfully 
at 8.33, and the scheduler set next_run_time to 8.36.
Now it's 9.00 and the task haven't executed yet. Though, I checked the 
scheduler_worker table, and I can see the last heartbeat was at 9.00. 
Also notice that some runs occur with very little time difference, and 
others don't.

If I start the worker manually with -D 0 option, I see the same log posted 
in the previous post.
It would seem as if the scheduler wasn't seeing the task. But every once in 
a while, it picks up the task.

I don't have any other task scheduled, nor any other workers starting. 
Also, I don't have any other cron task scheduled on the server that could 
be interfering. 

I checked the connection to the database, and it's ok, I'm connecting to 
the correct db. Actually it's the only db on my server that has the 
scheduler tables (I've manually logged in to the other dbs to check the 
scheduler tables weren't being created there).

I would like to try to remove completely the scheduler tables and let 
web2py re-create them. I don't know, just a try. 
I'm not shure how to do it. I think I would manually drop the tables from 
the database, and then manually remove the corresponding files under 
databases/ folder. Is this the correct approach? I can't think of another 
test to do here, I'm really in a dead end :/



El miércoles, 13 de mayo de 2015, 5:31:28 (UTC-3), Niphlod escribió:
>
> the scheduler doesn't depend on nginx, uwsgi and such. 
> it's an external process that communicates with the app with the database 
> as the only mean of communication. 
> If you queue something and you verify that is in the scheduler_task table, 
> and the scheduler doesn't see it, it's because it's pointing to a different 
> database.
>
>

-- 
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.


Re: [web2py] Re: best practice for internal function

2015-05-13 Thread Manuele Pesenti
Il 13/05/15 12:52, Alex ha scritto:
> perfect! This seems like a good solution. In most cases I have at
> least one parameter anyway.
Another option is to put them inside a model sub-directory called with
the same name as the controller.
The content of this folder will be read only calling that controller.

Make your choice :)

M.

-- 
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] Re: web2ruby possible?

2015-05-13 Thread Leonel Câmara
I want whatever it is you guys are smoking!

-- 
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] Re: best practice for internal function

2015-05-13 Thread Alex
perfect! This seems like a good solution. In most cases I have at least one 
parameter anyway.

-- 
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] Re: best practice for internal function

2015-05-13 Thread Niphlod

>
> that this function is also available from outside (ajax) and not just 
> within my controllers



def testfunction(dummy=None):
 return dict()

in a controller can't be called as a function from a web request.

tl;dr: a function defined with any number of arguments isn't callable in a 
web request.

-- 
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] best practice for internal function

2015-05-13 Thread Alex
Hi,

sometimes I need a function which I only use in one controller (file) and 
nowhere else (e.g. a function for form validation). Are there any 
recommendations where I could/should put those functions? Previously I put 
them in a model file but this is probably not optimal since the model file 
is available everywhere. Now I put the function in the controller file 
itself but here the problem is that this function is also available from 
outside (ajax) and not just within my controllers. Another option would be 
a module but this is rather complicated for those small functions. Any 
suggestions?

thanks,
Alex

-- 
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.


Re: [web2py] web2ruby possible?

2015-05-13 Thread John
+1

воскресенье, 11 сентября 2011 г., 23:35:56 UTC+3 пользователь rochacbruno 
написал:
>
> I am more interested in some web2go http://golang.org/ 

-- 
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] Re: What's the proper way of using scheduler for multiple apps with one only db?

2015-05-13 Thread Niphlod
the scheduler doesn't depend on nginx, uwsgi and such. 
it's an external process that communicates with the app with the database 
as the only mean of communication. 
If you queue something and you verify that is in the scheduler_task table, 
and the scheduler doesn't see it, it's because it's pointing to a different 
database.

-- 
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] Re: conditional in smartgrid that refer to the boolean type of field

2015-05-13 Thread 黄祥
*work*
editable = auth.has_membership('Manager') and (lambda row : 
row.is_authorized == False)

*not work (no error occured, the result is not expected)*
editable = (lambda row : row.is_authorized == False) and 
auth.has_membership('Manager')

why the first is work yet the second result is not expected?

best regards,
stifan

-- 
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.


Re: [web2py] Re: web2pyslices down

2015-05-13 Thread Philip Kilner

+1

If the original domain is on sale for a sensible sum, it might be worth 
buying and redirecting, but using a sub-domain seems a better solution 
in the long term.



On 11/05/15 10:36, Michele Comitini wrote:

why not using slices.web2py.com ? same 2nd
level domain as web2py and less problems for maintenance...



--

Regards,

PhilK


'a bell is a cup...until it is struck'

--
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.