[web2py] Re: Strange error with cookies (to the same domain) accesed through the same router

2016-08-16 Thread Anthony
I'm not sure what the actual problem is, but what leads you to believe it 
has anything to do with cookies?

On Tuesday, August 16, 2016 at 7:08:00 PM UTC-4, Lisandro wrote:
>
> I'm having this strange problem, and I would like to know if it is a 
> web2py bug or is something that I'm missing.
>
> My web2py app is accesed through a domain, and in the model file, I 
> connect to the db and to the session like this:
>
> db = DAL('postgres:.', migrate=False, lazy_tables=True)
> session.connect(request, response, db=db, masterapp='myapp')
>
> It's a bit difficult to explain the problem, so here are the steps to 
> reproduce it:
>
>1. *From a mobile device using Chrome or Firefox*, open this website 
>http://nachoesbo.com (this will ejecute the /default/index).
>
>2. Browse the web nachoesbo.com for a few seconds.
>
>3. Try to access the same web through Chrome or Firefox *in a desktop 
>pc using **the same internet connection*. 
>In this point, the browser will stay "connecting" to domain, and it 
>will hang until timeout. 
>This situation will stay this way until you close the mobile browser 
>(or after a few minutes).
>
>
> I'm really pulling my hair off with this. 
> I'm experiencing the same problem with all of my web2py applications.
> The same problem occurs using a different router and a different ISP.
>
> I've checked the cookies and there is nothing odd. I don't store anything 
> in the cookie, it's just the default behaviour. 
>
> What could I be 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: Web2py and XMPP

2016-08-16 Thread 黄祥
is there any way to send chat message to xmpp from web2py? i've tried 
before but no luck.
e.g.
*controllers/default.py*
def sendjabber():
import xmpp
FROM_JABBER_ID = "from...@fujabber.com"
JABBER_PASS = "from_id_pass"

#JABBER_PORT = "80"
#JABBER_PORT = "443"
#JABBER_PORT = "5222"
#JABBER_PORT = "5223"
#JABBER_PORT = "5269"
#JABBER_PORT = "5280"
JABBER_PORT = "5281"
#JABBER_PORT = "5298"
#JABBER_PORT = "6788"
#JABBER_PORT = "8010"
#JABBER_PORT = ""

JABBER_SERVER = "fujabber.com"
TO_JABBER_ID = "to...@fujabber.com"

jid = xmpp.protocol.JID(FROM_JABBER_ID)
cl = xmpp.Client(jid.getDomain(), debug = [] )

if not cl.connect((JABBER_SERVER, JABBER_PORT) ):
raise IOError('Can not connect to server.')

if not cl.auth(jid.getNode(), JABBER_PASS):
raise IOError('Can not auth with server.')

cl.send(xmpp.protocol.Message(TO_JABBER_ID , "Hello World again", typ = 
'chat') )

cl.disconnect()

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


[web2py] Re: How to access class variable in web2py like we do in flask?

2016-08-16 Thread Ron Chatterjee
Yes Massimo, I am working on it. I want to put a wrapper for webrtc on the 
top and use this to create the channel. 

On Tuesday, August 16, 2016 at 7:56:59 PM UTC-4, Massimo Di Pierro wrote:
>
> can't you just use this? 
> https://github.com/web2py/web2py/blob/master/gluon/contrib/websocket_messaging.py
> It does the same thing and ships with web2py.
>
>
> On Tuesday, 9 August 2016 16:02:58 UTC-5, Ron Chatterjee wrote:
>>
>> I tried to define those classes in db.py to make them global and 
>> accessible. But that didn't work. Not sure if I see any solution to your 
>> answer. Am I missing any hint? lol. But how to use flask app inside web2py? 
>> That would be nice to know:-)
>>
>> On Tuesday, August 9, 2016 at 4:59:37 PM UTC-4, Niphlod wrote:
>>>
>>> The solution lies in knowing web2py's unique execution model (which is 
>>> BY FAR different from Flask's) AND reading the source code. 
>>> When faced with the same problem years ago, finding the solution (was 
>>> already there, as it is now) made me a better coder, so I won't - on 
>>> purpose - propose a cut solution. 
>>>
>>

-- 
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: Customize multiselect widget

2016-08-16 Thread Clara Ferrando
Hello Donald,

Thanks a lot for your detailed answer! I am going to try it; it seems to be
exactly what I need and from your instructions, it should be simple to set
up.
I really appreciate your help! :-)

Best regards,

Clara



On Tue, Aug 16, 2016 at 8:14 PM, Donald McClymont 
wrote:

> I have got something like this working - basically based on the hradio
> widget which was developed by s-cubism
>
> so I define a widget in a module along the following lines:
>
> def hcheckbutton_widget(field, value, **attributes):
> rows = SQLFORM.widgets.checkboxes.widget(field, value).elements('tr')
> inner = []
> for row in rows[:-1]:
> button, label = row.elements('td')[0]
> label.attributes.update(_for=button.attributes['_id'],
> _class='btn btn-xs', _autocomplete="off")
>
> inner.append(SPAN(button, ' ', label,
> _style='padding-right:10px;'))
> return DIV(_class='btn_group', *inner, **attributes)
>
> You would then attach the widget to a field in your model or controller eg:
> db.viewscope.filters.requires = IS_IN_SET(['Scope', 'Category',
> 'AnswerGroup', 'Date', 'Event'], multiple=True)
> db.viewscope.filters.widget = hcheckbutton_widget
>
> So this gives you horizontal buttons with a checkbox next to them - which
> I think is OK as makes display clearer as to what is selected.  Final step
> for me was some javascript on the form to add another class for checked
> buttons and user selection.  The following stuff works if you are happy to
> apply to all checkboxes on the form.  Some scenarios might allow at least
> initial classes to be set when the widget runs - however I change my
> selections after the form is created so it didn't work for me.
>
> So I have the following javascript included in the view and within a
> document ready function:
>
> $('input[type=checkbox]').each(function() {
> if ($(this).prop('checked')) {
> $(this).next().addClass('btn-success');
> }
> });
>
> $('input[type=checkbox]').click(function () {
> $(this).next().toggleClass("btn-success")
> });
>
> This just uses bootstrap 3 btn-success class to get green buttons for the
> selected ones but it doesn't use the javascript function you suggested.
> However hopefully gives you a suggestion of one way to get working.
>
> Regards
> Donald
>
>
>
>
> On Saturday, August 13, 2016 at 4:14:55 PM UTC+1, clara wrote:
>>
>> Hello,
>>
>> I would like to use this tabselect (tabselect widget
>> ) widget instead of
>> the web2py's default multiselect widget.
>>
>>
>> 
>>
>> I have now a simple:
>> form = SQLFORM(db.mytable)
>>
>> to get the form in place and I just want to use this widget for one of
>> the fields.
>>
>> I did some testing with the widget and I know how to initialize it or to
>> retrieve the selected values to update the record. But I am not so sure
>> about how to integrate this in a form.
>>
>> I understand that there are two approaches to get this done but I am
>> really in doubt about which path to follow.
>> - Define a custom widget (seems obscure to me); or
>> - "Build" the form field by field to get my widget in the form. However,
>> I would also need to "append" the widget information to the submit data.
>>
>> I will appreciate any hints or suggestions on this. Best regards,
>>
>> Clara
>>
>>
>>
>>
>>
>>
>>
>>
>> --
> 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/Si1ZJB0Ak0A/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.
>

-- 
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: How to access class variable in web2py like we do in flask?

2016-08-16 Thread Massimo Di Pierro
can't you just use this? 
https://github.com/web2py/web2py/blob/master/gluon/contrib/websocket_messaging.py
It does the same thing and ships with web2py.


On Tuesday, 9 August 2016 16:02:58 UTC-5, Ron Chatterjee wrote:
>
> I tried to define those classes in db.py to make them global and 
> accessible. But that didn't work. Not sure if I see any solution to your 
> answer. Am I missing any hint? lol. But how to use flask app inside web2py? 
> That would be nice to know:-)
>
> On Tuesday, August 9, 2016 at 4:59:37 PM UTC-4, Niphlod wrote:
>>
>> The solution lies in knowing web2py's unique execution model (which is BY 
>> FAR different from Flask's) AND reading the source code. 
>> When faced with the same problem years ago, finding the solution (was 
>> already there, as it is now) made me a better coder, so I won't - on 
>> purpose - propose a cut solution. 
>>
>

-- 
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: Setting process title at web2py startup

2016-08-16 Thread Massimo Di Pierro
Not clear what you mean by what web2py starts. depending on the web server 
there may be more than one process and the web server manages those. My 
guess is that you want it done at the level of the web2py server rocket. In 
which case I would copy web2py.py into main.py and edit the latter.

On Tuesday, 9 August 2016 10:48:10 UTC-5, Michael Ellis wrote:
>
>
> I'm running web2py in conjunction with a suite of other, independent, 
> python processes.  In development I often want to 'ps' or kill the entire 
> suite from the command line.  I've found the Python setproctitle module 
> really useful for prepending a common label to all the process titles.
>
> In each process's __main__ code, I use something like the following:
>
> from setproctitle import setproctitle, getproctitle
> _proclabel = "thisapp" 
> if not getproctitle().startswith(_proclabel): 
> setproctitle(_proclabel + '  ' + getproctitle())
>
>
>
> This puts the label at the front, so I can do things like 
>
>
> ps ax | grep 'thisapp' 
>
> 17162 s000  S  0:00.15 thisapp processes  
>
> 17163 s000  S  0:00.02 thisapp simulation_service  
>
> 17164 s000  S  0:00.06 thisapp statehouse_service  
>
> 17167 s000  S  0:00.08 thisapp serial_interface_service  
>
> 17168 s000  S  0:00.01 thisapp email_service  
>
> 17169 s000  S  0:00.05 thisapp periodic_serial_query_service  
>
> I want to also label the web2py process at startup.  So far, the only way 
> I've found is to include the setproctitle code in an app's  0.py model file 
> and then have my startup script fetch the index page after web2py is up and 
> running.  
>
>
> It would be nicer to be able to put it in script that runs once as 
> web2py.py starts, but there doesn't seem to be a way to do that without the 
> -R option which is recommended on for -S shell invocations of web2py.  
>
>
> I'd rather not hack web2py.py or one of the gluon modules.  Is there a 
> better way?
>
>
> 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] Making web2py AVailable in Softaculous

2016-08-16 Thread Brian Boatright
I've been using nosupportlinuxhosting for a while and with good success. At 
$1 per website per month it's a bargain for project sites and development. 

They use cPanel and one of the features of Cpanel is Softaculous to make 
setting up a LOT of popular web software and frameworks available through a 
few clicks. 

I really don't know what it takes to get Web2py on Softaculous but if we 
could get it added I think it would be good to find a few more users and 
make it more easily available to shared and low cost hosts. 

I don't have the linux chops to get web2py packaged for softaculous but I'm 
sure someone here probably does. 

-- 
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] db.executesql() is taking 10 times longer than it should to run a query in Web2py

2016-08-16 Thread junderhill
 

Greetings.  db.executesql() is taking 10 times longer than it should to run 
a query in Web2py, and I can’t figure out why.  This is causing a huge 
bottleneck in my application.


In the example below, the Web2py times are all over the map, ranging from 
10ms to 500ms, whereas the query runs consistenty in about 30ms in pgAdmin 
III on the same server.


Yes, there’s 27 million rows in the table Word2Word, but so what?  There’s 
an index on every column, and as I said, the query runs consistently in 
pgAdmin III.  See also the query plan below.


Four Core 2 CPUs, 16 GB RAM, nobody on this server but me.


I need help.  I’m completely stumped.  If this requires a paid expert we 
can probably accommodate that if we can get an answer.


Love Web2py.   Thanks,


John D. Underhill

Senior Web Developer

Vocabulary Systems, Inc.

-

Web2py 2.14.3-stable+timestamp.2016.03.26.23.02.02

Running on Apache/2.4.7 (Ubuntu), Python 2.7.6

Postgres 9.3.13

-

. . . 
rows = db(db.Word.normalform == aword.normalform).select(db.Word.id)
. . .
sql = "SELECT Word.normalform, Word.frequency, Word2Word.relscore "
sql = sql + "FROM Word2Word INNER JOIN Word ON (Word2Word.word2 = Word.id) "
sql = sql + "WHERE ((Word2Word.word1 = " + str(rows[0].id) + ") AND "
sql = sql + "(Word.frequency >= " + str(freqlower) + ") AND (Word.frequency 
<= " + str(frequpper) + ")) "
sql = sql + "ORDER BY Word2Word.relscore DESC LIMIT " + str(howmany * 3) + 
";"
rows = db.executesql(sql, as_dict=True, colnames=['Word.normalform', 
'Word.frequency', 'Word2Word.relscore'])
. . .
for x in db._timings:
logger.debug(str(x))


-

2016-08-09 01:25:13,072  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'american');", 0.002079010009765625)

2016-08-09 01:25:13,072  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 132) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.23161005973815918)

2016-08-09 01:25:13,073  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'prospect');", 0.002025842259766)

2016-08-09 01:25:13,073  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 2201) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.5044560432434082)

2016-08-09 01:25:13,074  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'learn');", 0.0010268688201904297)

2016-08-09 01:25:13,074  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 312) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.009122133255004883)

2016-08-09 01:25:13,075  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'edge');", 0.0021839141845703125)

2016-08-09 01:25:13,075  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 918) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.22762799263000488)

2016-08-09 01:25:13,076  -  DEBUG  -  (u"SELECT  Word.id FROM Word WHERE 
(Word.normalform = 'measure');", 0.0020809173583984375)

2016-08-09 01:25:13,077  -  DEBUG  -  (u'SELECT Word.normalform, 
Word.frequency, Word2Word.relscore FROM Word2Word INNER JOIN Word ON 
(Word2Word.word2 = Word.id) WHERE ((Word2Word.word1 = 581) AND 
(Word.frequency >= 45) AND (Word.frequency <= 65)) ORDER BY 
Word2Word.relscore DESC LIMIT 15;', 0.47495388984680176)

-






-- 
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] Bug?: Spanish formatted dates won't store on database(english ones do)

2016-08-16 Thread Luciano Laporta Podazza
Hello,

I'm working on a simple case file project and realized that working with 
english date format has no issues but if I use spanish ones(taking 
advantage of internacionalization) they don't get stored on database.

Here is my controller:
@auth.requires_login()
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html


if you need a simple wiki simply replace the two lines below with:
return auth.wiki()
"""
form = SQLFORM.smartgrid(db.case_file)
return dict(form=form)

Here is my model:

db.define_table('case_file',
Field('auth_user_id', db.auth_user),
Field('case_file_number', 'integer', label=T("Case Number"), requires=
IS_NOT_EMPTY()),
Field('case_file_code', 'integer', label=T("Case Code"), requires=
IS_NOT_EMPTY()),
Field('case_file_letter', 'string', label=T("Case Letter"), requires=
IS_NOT_EMPTY()),
Field('case_file_year', 'date', label=T("Case Year"), requires=
IS_NOT_EMPTY()),
Field('case_file_subject', 'string', label=T("Case Subject"), requires=
IS_NOT_EMPTY()),
)


db.define_table('case_file_history',
Field('case_file_id', db.case_file),
Field('created_by', 'string', label=T("Created By"), requires=
IS_NOT_EMPTY()),
Field('case_file_ingress', 'date', label=T("Case Ingress"), requires=
IS_NOT_EMPTY()),
Field('case_file_egress', 'date', label=T("Case Egress"), requires=
IS_NOT_EMPTY()),
Field('case_file_to', 'string', label=T("Case To"), requires=
IS_NOT_EMPTY()),
Field('case_file_status', 'string', label=T("Case Status"), requires=
IS_NOT_EMPTY()),
)


To recreate this issue, create a new project, use my code and set your 
browser to spanish. It won't store any field of date type on database, but 
if browser is set up in english language, it will.

I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Mac OS X El 
Capitan and sqlite or mysql(issue repeats on both databases).

Any help will be appreciated. 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] Web2py request different behavior on local and online version (server code executes, but returns 404

2016-08-16 Thread Ur. Kr.


On my local version of the application, making the request with the 
following code, executes the code on the server, returning successfully.

$.ajax({
 type: 'POST',
 url: "{{=URL('default', 'serverFunction.json')}}",
 data: {id: id}}); 

However, if I make the request like so (without '.json' after 
serverFunction)

$.ajax({
 type: 'POST',
 url: "{{=URL('default', 'serverFunction')}}",
 data: {id: id}}); 

The server code executes, but returns a 404 error.

On the online version, it returns a 404 error in both cases, executing the 
server code.


Cross-posting from 
here: 
http://stackoverflow.com/questions/38870171/web2py-request-different-behavior-on-local-and-online-version-server-code-execu

-- 
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] New to web2py. Template use cases

2016-08-16 Thread billyhun01
Coming trying out different framework and really love web2py. The template 
language is very simple. how do I use it in different framework?

Trying to replace jinja2 template with web2py template.

import template seem to doesn't work with default jinja2 template language 
the framework assumes.
 

-- 
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] reddit clone application name 'category' is not defined

2016-08-16 Thread Annexx Xaar

Hello sir i have tried all i could, still having errors in the reddit clone 
application.
everything works fine except when i 
implemented  {{=author(user_id)}} under list_posts_by_votes.html
the errors blows when i click on the author of a comment. it does not 
dislay the author's name as it showed in the toturial video.
 



 here's it

1.
2.
3.
4.
5.
6.

Traceback (most recent call last):
  File "C:\Users\nsikan\Desktop\web2py\gluon\restricted.py", line 227, in 
restricted
exec ccode in environment
  File 
"C:\Users\nsikan\Desktop\web2py\applications\mydream\views\default/list_posts_by_votes.html",
 line 117, in 
NameError: name 'category' is not defined

here's deault.py
POSTS_PER_PAGE = 10
def get_category():
category_name = request.args(0)
category = db.category(name = category_name)
if not category:
session.flash = 'page has not been created'
redirect(URL('index'))
return category

def index():
rows = db(db.category).select()
return locals()

def create_post():
category = get_category()
db.post.category.default = category.id
form = SQLFORM(db.post).process(next='view_post/[id]')
return locals()

def edit_post():
id = request.args(0, cast=int)
form = SQLFORM(db.post, id).process(next='view_post/[id]')
return locals()

def list_posts_by_datetime():
response.view='default/list_posts_by_votes.html'
category = get_category()
page = request.args(1, cast=int, default=0)
start = page * POSTS_PER_PAGE
stop = start + POSTS_PER_PAGE
rows = 
db(db.post.category==category.id).select(orderby=~db.post.created_on, 
limitby=(start, stop))
return locals()

def list_posts_by_votes():
category = get_category()
page = request.args(1, cast=int, default=0)
start = page * POSTS_PER_PAGE
stop = start + POSTS_PER_PAGE
rows = db(db.post.category==category.id).select(orderby=~db.post.votes, 
limitby=(start, stop))
return locals()

def list_posts_by_author():
response.view='default/list_posts_by_votes.html'
user_id = request.args(0, cast=int)
page = request.args(1, cast=int, default=0)
start = page * POSTS_PER_PAGE
stop = start + POSTS_PER_PAGE
rows = 
db(db.post.created_by==user_id).select(orderby=~db.post.created_on, 
limitby=(start, stop))
return locals()

def view_post():
id = request.args(0, cast=int)
post = db.post(id) or redirect(URL('index'))
comments = db(db.comm.post==post.id).select(orderby=~db.comm.created_on)
##TODO
return locals()

def vote_callback():
id = request.args(0, cast=int)
direction = request.args(1)
##TODO
return locals()

def comm_vote_callback():
id = request.args(0, cast=int)
direction = request.args(1)
##TODO
return locals()


here's lists_posts_by_votes.html
{{extend 'layout.html'}}

{{if request.function=='list_posts_by_votes':}}
{{=category.name.title()}}
{{=A('sort by datetime', _class='btn', _href=URL('list_posts_by_datetime', 
args=category.name))}}
{{=A('post a new link', _class='btn btn-primary', _href=URL('create_post', 
args=category.name))}}

{{elif request.function=='list_posts_by_datetime':}}
{{=category.name.title()}}
{{=A('sort by votes', _class='btn', _href=URL('list_posts_by_votes', 
args=category.name))}}
{{=A('post a new link', _class='btn btn-primary', _href=URL('create_post', 
args=category.name))}}
{{else:}}
{{=author(user_id)}}
{{pass}}


{{for post in rows:}}


{{=post.votes}} 
 {{ =A(post.title,_href=post.url) if post.url else 
post.title}}
{{=A('comments', _href=URL('view_post', 
args=post.id))}}



{{pass}}

{{if page>0:}}
{{=A('previous', _class='btn', _href=URL(args=(category.name, page-1)))}}
{{pass}}

{{if len(rows)>=10:}}
{{=A('next', _class='btn', _href=URL(args=(category.name, page+1)))}}
{{pass}}


here's db1.py
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
db.define_table('category', Field('name', requires=(IS_SLUG(), 
IS_LOWER(),IS_NOT_IN_DB(db, 'category.name'

db.define_table('post',
Field('category', 'reference category', writable=False, 
readable=False),
Field('title', 'string', requires=IS_NOT_EMPTY()),
Field('url', requires=IS_EMPTY_OR(IS_URL())),
Field('body', 'text', requires=IS_NOT_EMPTY()),
Field('votes', 'integer',default=0 , readable=False, 
writable=False),
auth.signature)#created_on, created_by, modified_by, 
modified_on, is_active

db.define_table('vote',
   Field('post', 'reference post'),
   Field('score', 'integer', default=+1),
   auth.signature)

db.define_table('comm',
   Field('post', 'reference post'),
Field('parent_comm', 'reference comm'),
   Field('votes', 'integer' ),
   Field('body', 'text',  requires=IS_NOT_EMPTY()),
   auth.signature)

db.define_table('comm_vote',

[web2py] Web2Py Navigating table records one at a time

2016-08-16 Thread Meinolf
Hi

I am new to python and web2py. I have a small sqlite table of "career test" 
questions that i need to be presented to a user in form of a quiz, one 
question appearing at a time
Problems:
1. I can't figure out how to safely stop at the last record, it breaks and 
after 3 more clicks, it takes me to "None" white page.
2. I need to capture each instance of the quiz for a specific user without 
them login in, how do i collect the questions with a session identifier?

Below is my code:

def career():
q = db().select(db.quest.ALL, orderby=db.quest.q_id)
answerForm = SQLFORM(db.quiz)
while True:
while not form.process().accepted:
session.counter = len(q)-1
question = q[session.counter]['q_id']
return dict(question=question, answerForm=answerForm)
else:
session.counter -= 1
question = q[session.counter]['q_id']
if session.counter < 0:
question = q[0]['q_id']
return dict(question=question, answerForm=answerForm)



Any ideas on a better approach asap will be highly appreciated.

-- 
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: web3py status

2016-08-16 Thread fabio . filhossi
Neither do I. I really like this name !! 
So, Massimo, has this project been developing yet?


On Monday, January 19, 2015 at 9:45:34 PM UTC-2, JorgeH wrote:
>
> I don't have any problem with the name whatsoever. I like it. 
>
> On Monday, January 19, 2015 at 5:54:58 PM UTC-5, Massimo Di Pierro wrote:
>>
>> I never liked the name either. The original name was Gluon but somebody 
>> threatened to sue me for trademark infringement (which was not the case) 
>> and I had to change it in a hurry. Not a joke.
>>
>> Massimo
>>
>> On Monday, 19 January 2015 12:17:44 UTC-6, Ramos wrote:
>>>
>>> i personally hate the name. In contrast with how much i like the 
>>> framework.
>>>
>>> Its a phrase compacted in a single word. 
>>>
>>> People are confusing its name with python versions.
>>>
>>> Now for a one million dollar question:
>>>
>>> what does it mean:
>>>
>>> Web2py3 ?
>>> web3py2  ?
>>>
>>>
>>>
>>> Regards
>>> António
>>>
>>>
>>>
>>>
>>>
>>>
>>> 2015-01-19 17:05 GMT+00:00 Tito Garrido :
>>>
 I wouldn't change the name at all... Because it is not related to 
 python version lets just stay with web2py :)

 On Mon, Jan 19, 2015 at 1:03 AM, Massimo Di Pierro <
 massimo@gmail.com> wrote:

> py4web?
>
>
> On Sunday, 18 January 2015 15:22:10 UTC-6, Michele Comitini wrote:
>>
>> the 3 in web3py is not related to python3, just as the 2 was not 
>> related to python2.
>>
>> We could skip the 3 and use 4 which is much more meaningful :-)
>>
>> look:
>> web 2(to) py
>> web 4(for) py
>>
>> and compare:
>> web 3(???) py??
>>
>>
>>
>> 2015-01-17 7:22 GMT+01:00 Massimo Di Pierro :
>>
>>> Nothing anytime soon. Stick with web2py if it works for you. It 
>>> works for us. ;-)
>>>
>>>
>>> On Friday, 16 January 2015 09:56:32 UTC-6, Manny Felicio wrote:

 Hi Massimo,

 How are you?

 I will be starting a new project, so far I think for may reasons, I 
 want to use Python and I like the style of your Web2py.  Since, Web3py 
 is 
 already on the air for Python 3 support, Do you think it will be 
 seamless, 
 if let's say, I will use web2py now then when web3py is released I 
 will 
 upgrade my application? I am also thinking when I can get a full grip 
 of 
 Python like what I have in PHP & C++, and as my kids are growing up, I 
 may 
 have time to help with your project for the benefit of all.

 Thank you very much for your support.

 Regards,

 Manny

 On Saturday, October 26, 2013 at 8:53:58 PM UTC-6, Massimo Di 
 Pierro wrote:
>
> I would not say it is the main "problem". It should be easy to do. 
> It was done once already my Mariano for an earlier version.
> It is just that nobody has shown must interest in helping do it. 
> We already use a a python 3 compatible syntax.
> After this is converted it needs testing and I am not sure all 
> drivers work with python 3.
>
> Massimo
>
>
>
>
>
> On Saturday, 26 October 2013 17:06:33 UTC-5, samuel bonill wrote:
>>
>>
>> the main problem is porting dal.py to python 3.x
>>
>> El viernes, 25 de octubre de 2013 21:26:36 UTC-5, elguavas 
>> escribió:
>>>
>>> hi there,
>>>
>>> i've seen peppered throughout this list references to "web3py". 
>>> i seems like it's mostly the unofficial name of of a concept at 
>>> this stage, 
>>> but i also see references to work being pulled into web2py from 
>>> web3py...  
>>> where is this web3py and what's its current state? 
>>>
>>> thanks,
>>> e.
>>>
>>> -- 
>>> 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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
> 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 

[web2py] Re: Customize multiselect widget

2016-08-16 Thread Donald McClymont
I have got something like this working - basically based on the hradio 
widget which was developed by s-cubism

so I define a widget in a module along the following lines:

def hcheckbutton_widget(field, value, **attributes):
rows = SQLFORM.widgets.checkboxes.widget(field, value).elements('tr')
inner = []
for row in rows[:-1]:
button, label = row.elements('td')[0] 
label.attributes.update(_for=button.attributes['_id'],
_class='btn btn-xs', _autocomplete="off")   

inner.append(SPAN(button, ' ', label, _style='padding-right:10px;'))
return DIV(_class='btn_group', *inner, **attributes)

You would then attach the widget to a field in your model or controller eg:
db.viewscope.filters.requires = IS_IN_SET(['Scope', 'Category', 
'AnswerGroup', 'Date', 'Event'], multiple=True)
db.viewscope.filters.widget = hcheckbutton_widget

So this gives you horizontal buttons with a checkbox next to them - which I 
think is OK as makes display clearer as to what is selected.  Final step 
for me was some javascript on the form to add another class for checked 
buttons and user selection.  The following stuff works if you are happy to 
apply to all checkboxes on the form.  Some scenarios might allow at least 
initial classes to be set when the widget runs - however I change my 
selections after the form is created so it didn't work for me.

So I have the following javascript included in the view and within a 
document ready function:

$('input[type=checkbox]').each(function() {
if ($(this).prop('checked')) {
$(this).next().addClass('btn-success');
}
});

$('input[type=checkbox]').click(function () {
$(this).next().toggleClass("btn-success")
});

This just uses bootstrap 3 btn-success class to get green buttons for the 
selected ones but it doesn't use the javascript function you suggested. 
 However hopefully gives you a suggestion of one way to get working.

Regards
Donald




On Saturday, August 13, 2016 at 4:14:55 PM UTC+1, clara wrote:
>
> Hello,
>
> I would like to use this tabselect (tabselect widget 
> ) widget instead of the 
> web2py's default multiselect widget.
>
>
> 
>
> I have now a simple:
> form = SQLFORM(db.mytable)
>
> to get the form in place and I just want to use this widget for one of the 
> fields. 
>
> I did some testing with the widget and I know how to initialize it or to 
> retrieve the selected values to update the record. But I am not so sure 
> about how to integrate this in a form.
>
> I understand that there are two approaches to get this done but I am 
> really in doubt about which path to follow.
> - Define a custom widget (seems obscure to me); or
> - "Build" the form field by field to get my widget in the form. However, I 
> would also need to "append" the widget information to the submit data.
>
> I will appreciate any hints or suggestions on this. Best regards,
>
> Clara
>
>
>
>
>
>
>
>
>

-- 
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] Strange error with cookies (to the same domain) accesed through the same router

2016-08-16 Thread Lisandro
I'm having this strange problem, and I would like to know if it is a web2py 
bug or is something that I'm missing.

My web2py app is accesed through a domain, and in the model file, I connect 
to the db and to the session like this:

db = DAL('postgres:.', migrate=False, lazy_tables=True)
session.connect(request, response, db=db, masterapp='myapp')

It's a bit difficult to explain the problem, so here are the steps to 
reproduce it:

   1. *From a mobile device using Chrome or Firefox*, open this website 
   http://nachoesbo.com (this will ejecute the /default/index).

   2. Browse the web nachoesbo.com for a few seconds.
   
   3. Try to access the same web through Chrome or Firefox *in a desktop pc 
   using **the same internet connection*. 
   In this point, the browser will stay "connecting" to domain, and it will 
   hang until timeout. 
   This situation will stay this way until you close the mobile browser (or 
   after a few minutes).
   
   
I'm really pulling my hair off with this. 
I'm experiencing the same problem with all of my web2py applications.
The same problem occurs using a different router and a different ISP.

I've checked the cookies and there is nothing odd. I don't store anything 
in the cookie, it's just the default behaviour. 

What could I be 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.


Re: [web2py] Re: Reopen a session without cookies

2016-08-16 Thread 黄祥
is it possible to send message to telegram bot from web2py? i've tried but 
no luck
*error*
400 Bad Request
--
nginx/1.6.2
*code*
import requests

def sendtelegram():
BOT = "@test_bot"
text = "test"

url = "https://telegram.me/%s/%%s; % BOT
data = dict(text = text)

return requests.post(url, data = data)

thanks and 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: Deployment question

2016-08-16 Thread Jim Steil
Importing pandas from the web2py shell works just fine.


administrator@ubuntu16-2:/home/www-data/web2py$ sudo python web2py.py -a
password -S connect
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2016
Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Database drivers available: pymysql, imaplib, MySQLdb, sqlite3, pg8000,
pyodbc
WARNING:web2py:import IPython error; use default python shell
Python 2.7.12 (default, Jul  1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import pandas
>>>




On Tue, Aug 16, 2016 at 2:37 PM, Richard Vézina  wrote:

> Which version of web2py?
>
> I just try impor... with command line web2py instance and it works...
>
> I am using web2py 2.14.6
>
> Richard
>
> On Tue, Aug 16, 2016 at 3:34 PM, Jim Steil  wrote:
>
>> Let me restate my issue
>>
>> I can use pandas just fine on ubuntu 16.04.  The problem occurs when I'm
>> importing a module into a web2py controller and that module fails to import
>> on the 'import pandas as pd' line.
>>
>> Just to be clear, pandas works find on the box.  It is when it runs on
>> web2py through the nginx/uwsgi stack that it fails.
>>
>> -Jim
>>
>>
>> On Tue, Aug 16, 2016 at 2:30 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Strange!
>>>
>>> Missing dependency which didn't install because of a broken link?
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 3:22 PM, Jim Steil  wrote:
>>>
 From my system:

 administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
 [sudo] password for administrator:
 ---
 Metadata-Version: 2.0
 Name: pandas
 Version: 0.18.1
 Summary: Powerful data structures for data analysis, time series,and
 statistics
 Home-page: http://pandas.pydata.org
 Author: The PyData Development Team
 Author-email: pyd...@googlegroups.com
 Installer: pip
 License: BSD
 Location: /usr/local/lib/python2.7/dist-packages
 Requires: pytz, python-dateutil, numpy
 Classifiers:
   Development Status :: 5 - Production/Stable
   Environment :: Console
   Operating System :: OS Independent
   Intended Audience :: Science/Research
   Programming Language :: Python
   Programming Language :: Python :: 2
   Programming Language :: Python :: 3
   Programming Language :: Python :: 2.7
   Programming Language :: Python :: 3.4
   Programming Language :: Python :: 3.5
   Programming Language :: Cython
   Topic :: Scientific/Engineering

 I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
 updated using:

 sudo pip install --upgrade pip

 ...before installing pandas which I installed using pip and not an
 ubuntu package.

 -Jim

 btw - really appreciate your help with this...


 On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Maybe try reinstall pip package, or if you use ubuntu package, use pip
> one instead...
>
> On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Can you identify the responsible piece of pandas code that cause the
>> issue? It don't make sens if you can't import pandas as pd in U16.04... I
>> just try and it works...
>>
>>
>> sudo pip show pandas
>> ---
>> Metadata-Version: 1.1
>> Name: pandas
>> Version: 0.18.1
>> Summary: Powerful data structures for data analysis, time series,and
>> statistics
>> Home-page: http://pandas.pydata.org
>> Author: The PyData Development Team
>> Author-email: pyd...@googlegroups.com
>> License: BSD
>> Location: /usr/local/lib/python2.7/dist-packages
>> Requires: python-dateutil, pytz, numpy
>> Classifiers:
>>   Development Status :: 5 - Production/Stable
>>   Environment :: Console
>>   Operating System :: OS Independent
>>   Intended Audience :: Science/Research
>>   Programming Language :: Python
>>   Programming Language :: Python :: 2
>>   Programming Language :: Python :: 3
>>   Programming Language :: Python :: 2.7
>>   Programming Language :: Python :: 3.4
>>   Programming Language :: Python :: 3.5
>>   Programming Language :: Cython
>>   Topic :: Scientific/Engineering
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil 
>> wrote:
>>
>>> Richard
>>>
>>> I have not had it successfully running under ubuntu 16.04 with a
>>> prior version of pandas.  I have it running on Ubuntu 14.04 with the 
>>> same
>>> version of pandas.  It fails on:
>>>
>>> import pandas as pd
>>>
>>> -Jim
>>>
>>> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
>>> 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
Strange!

Missing dependency which didn't install because of a broken link?

Richard

On Tue, Aug 16, 2016 at 3:22 PM, Jim Steil  wrote:

> From my system:
>
> administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
> [sudo] password for administrator:
> ---
> Metadata-Version: 2.0
> Name: pandas
> Version: 0.18.1
> Summary: Powerful data structures for data analysis, time series,and
> statistics
> Home-page: http://pandas.pydata.org
> Author: The PyData Development Team
> Author-email: pyd...@googlegroups.com
> Installer: pip
> License: BSD
> Location: /usr/local/lib/python2.7/dist-packages
> Requires: pytz, python-dateutil, numpy
> Classifiers:
>   Development Status :: 5 - Production/Stable
>   Environment :: Console
>   Operating System :: OS Independent
>   Intended Audience :: Science/Research
>   Programming Language :: Python
>   Programming Language :: Python :: 2
>   Programming Language :: Python :: 3
>   Programming Language :: Python :: 2.7
>   Programming Language :: Python :: 3.4
>   Programming Language :: Python :: 3.5
>   Programming Language :: Cython
>   Topic :: Scientific/Engineering
>
> I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
> updated using:
>
> sudo pip install --upgrade pip
>
> ...before installing pandas which I installed using pip and not an ubuntu
> package.
>
> -Jim
>
> btw - really appreciate your help with this...
>
>
> On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Maybe try reinstall pip package, or if you use ubuntu package, use pip
>> one instead...
>>
>> On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Can you identify the responsible piece of pandas code that cause the
>>> issue? It don't make sens if you can't import pandas as pd in U16.04... I
>>> just try and it works...
>>>
>>>
>>> sudo pip show pandas
>>> ---
>>> Metadata-Version: 1.1
>>> Name: pandas
>>> Version: 0.18.1
>>> Summary: Powerful data structures for data analysis, time series,and
>>> statistics
>>> Home-page: http://pandas.pydata.org
>>> Author: The PyData Development Team
>>> Author-email: pyd...@googlegroups.com
>>> License: BSD
>>> Location: /usr/local/lib/python2.7/dist-packages
>>> Requires: python-dateutil, pytz, numpy
>>> Classifiers:
>>>   Development Status :: 5 - Production/Stable
>>>   Environment :: Console
>>>   Operating System :: OS Independent
>>>   Intended Audience :: Science/Research
>>>   Programming Language :: Python
>>>   Programming Language :: Python :: 2
>>>   Programming Language :: Python :: 3
>>>   Programming Language :: Python :: 2.7
>>>   Programming Language :: Python :: 3.4
>>>   Programming Language :: Python :: 3.5
>>>   Programming Language :: Cython
>>>   Topic :: Scientific/Engineering
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:
>>>
 Richard

 I have not had it successfully running under ubuntu 16.04 with a prior
 version of pandas.  I have it running on Ubuntu 14.04 with the same version
 of pandas.  It fails on:

 import pandas as pd

 -Jim

 On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Massimo's has always said it wasn't secure, I ignore the exact
> reason(s)...
>
> I suggest downgrading pandas with this rational you were using is in
> previous version of pandas and nginx without this problem...
>
> I do use pandas (but not HDF5 Store) and I don't experiment this
> issue... neither in 12.04 or 16.04
>
> Richard
>
> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>
>> In my reading I didn't see that downgrading pandas would help. Am I
>> missing something or did I mislead you with my post?  Downgrading ubuntu
>> would help (which is what we have now, but would like to run the latest
>> ubuntu).
>>
>> But, back to the main question, what are the biggest factors in not
>> recommending rocket for production use?  Does putting haproxy in front of
>> the rocket servers alleviate the concerns?
>>
>> -Jim
>>
>> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>>>
>>> You can't downgrade pandas package?
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:
>>>
 Ron

 It would depend on what OS you're running on the x86 box.  This
 would be a good place to start http://web2py.com/books/
 default/chapter/29/13/deployment-recipes

 Also, if you don't mind, could you re-post this in a new thread so
 this thread could focus on my initial question?

 -Jim


 On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee
 wrote:
>
> On that note, can someone 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
Which version of web2py?

I just try impor... with command line web2py instance and it works...

I am using web2py 2.14.6

Richard

On Tue, Aug 16, 2016 at 3:34 PM, Jim Steil  wrote:

> Let me restate my issue
>
> I can use pandas just fine on ubuntu 16.04.  The problem occurs when I'm
> importing a module into a web2py controller and that module fails to import
> on the 'import pandas as pd' line.
>
> Just to be clear, pandas works find on the box.  It is when it runs on
> web2py through the nginx/uwsgi stack that it fails.
>
> -Jim
>
>
> On Tue, Aug 16, 2016 at 2:30 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Strange!
>>
>> Missing dependency which didn't install because of a broken link?
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 3:22 PM, Jim Steil  wrote:
>>
>>> From my system:
>>>
>>> administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
>>> [sudo] password for administrator:
>>> ---
>>> Metadata-Version: 2.0
>>> Name: pandas
>>> Version: 0.18.1
>>> Summary: Powerful data structures for data analysis, time series,and
>>> statistics
>>> Home-page: http://pandas.pydata.org
>>> Author: The PyData Development Team
>>> Author-email: pyd...@googlegroups.com
>>> Installer: pip
>>> License: BSD
>>> Location: /usr/local/lib/python2.7/dist-packages
>>> Requires: pytz, python-dateutil, numpy
>>> Classifiers:
>>>   Development Status :: 5 - Production/Stable
>>>   Environment :: Console
>>>   Operating System :: OS Independent
>>>   Intended Audience :: Science/Research
>>>   Programming Language :: Python
>>>   Programming Language :: Python :: 2
>>>   Programming Language :: Python :: 3
>>>   Programming Language :: Python :: 2.7
>>>   Programming Language :: Python :: 3.4
>>>   Programming Language :: Python :: 3.5
>>>   Programming Language :: Cython
>>>   Topic :: Scientific/Engineering
>>>
>>> I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
>>> updated using:
>>>
>>> sudo pip install --upgrade pip
>>>
>>> ...before installing pandas which I installed using pip and not an
>>> ubuntu package.
>>>
>>> -Jim
>>>
>>> btw - really appreciate your help with this...
>>>
>>>
>>> On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Maybe try reinstall pip package, or if you use ubuntu package, use pip
 one instead...

 On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Can you identify the responsible piece of pandas code that cause the
> issue? It don't make sens if you can't import pandas as pd in U16.04... I
> just try and it works...
>
>
> sudo pip show pandas
> ---
> Metadata-Version: 1.1
> Name: pandas
> Version: 0.18.1
> Summary: Powerful data structures for data analysis, time series,and
> statistics
> Home-page: http://pandas.pydata.org
> Author: The PyData Development Team
> Author-email: pyd...@googlegroups.com
> License: BSD
> Location: /usr/local/lib/python2.7/dist-packages
> Requires: python-dateutil, pytz, numpy
> Classifiers:
>   Development Status :: 5 - Production/Stable
>   Environment :: Console
>   Operating System :: OS Independent
>   Intended Audience :: Science/Research
>   Programming Language :: Python
>   Programming Language :: Python :: 2
>   Programming Language :: Python :: 3
>   Programming Language :: Python :: 2.7
>   Programming Language :: Python :: 3.4
>   Programming Language :: Python :: 3.5
>   Programming Language :: Cython
>   Topic :: Scientific/Engineering
>
> Richard
>
> On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil 
> wrote:
>
>> Richard
>>
>> I have not had it successfully running under ubuntu 16.04 with a
>> prior version of pandas.  I have it running on Ubuntu 14.04 with the same
>> version of pandas.  It fails on:
>>
>> import pandas as pd
>>
>> -Jim
>>
>> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Massimo's has always said it wasn't secure, I ignore the exact
>>> reason(s)...
>>>
>>> I suggest downgrading pandas with this rational you were using is in
>>> previous version of pandas and nginx without this problem...
>>>
>>> I do use pandas (but not HDF5 Store) and I don't experiment this
>>> issue... neither in 12.04 or 16.04
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>>>
 In my reading I didn't see that downgrading pandas would help. Am I
 missing something or did I mislead you with my post?  Downgrading 
 ubuntu
 would help (which is what we have now, but would like to run the latest
 ubuntu).

 But, back to the main question, what are the biggest 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
You may have a check, here some way of doing it :

http://stackoverflow.com/questions/16294819/how-to-check-if-my-python-has-all-required-packages

http://stackoverflow.com/questions/22213997/programmatically-check-if-python-dependencies-are-satisfied

Would try with pip freeze first...

Richard

On Tue, Aug 16, 2016 at 3:30 PM, Richard Vézina  wrote:

> Strange!
>
> Missing dependency which didn't install because of a broken link?
>
> Richard
>
> On Tue, Aug 16, 2016 at 3:22 PM, Jim Steil  wrote:
>
>> From my system:
>>
>> administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
>> [sudo] password for administrator:
>> ---
>> Metadata-Version: 2.0
>> Name: pandas
>> Version: 0.18.1
>> Summary: Powerful data structures for data analysis, time series,and
>> statistics
>> Home-page: http://pandas.pydata.org
>> Author: The PyData Development Team
>> Author-email: pyd...@googlegroups.com
>> Installer: pip
>> License: BSD
>> Location: /usr/local/lib/python2.7/dist-packages
>> Requires: pytz, python-dateutil, numpy
>> Classifiers:
>>   Development Status :: 5 - Production/Stable
>>   Environment :: Console
>>   Operating System :: OS Independent
>>   Intended Audience :: Science/Research
>>   Programming Language :: Python
>>   Programming Language :: Python :: 2
>>   Programming Language :: Python :: 3
>>   Programming Language :: Python :: 2.7
>>   Programming Language :: Python :: 3.4
>>   Programming Language :: Python :: 3.5
>>   Programming Language :: Cython
>>   Topic :: Scientific/Engineering
>>
>> I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
>> updated using:
>>
>> sudo pip install --upgrade pip
>>
>> ...before installing pandas which I installed using pip and not an ubuntu
>> package.
>>
>> -Jim
>>
>> btw - really appreciate your help with this...
>>
>>
>> On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Maybe try reinstall pip package, or if you use ubuntu package, use pip
>>> one instead...
>>>
>>> On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Can you identify the responsible piece of pandas code that cause the
 issue? It don't make sens if you can't import pandas as pd in U16.04... I
 just try and it works...


 sudo pip show pandas
 ---
 Metadata-Version: 1.1
 Name: pandas
 Version: 0.18.1
 Summary: Powerful data structures for data analysis, time series,and
 statistics
 Home-page: http://pandas.pydata.org
 Author: The PyData Development Team
 Author-email: pyd...@googlegroups.com
 License: BSD
 Location: /usr/local/lib/python2.7/dist-packages
 Requires: python-dateutil, pytz, numpy
 Classifiers:
   Development Status :: 5 - Production/Stable
   Environment :: Console
   Operating System :: OS Independent
   Intended Audience :: Science/Research
   Programming Language :: Python
   Programming Language :: Python :: 2
   Programming Language :: Python :: 3
   Programming Language :: Python :: 2.7
   Programming Language :: Python :: 3.4
   Programming Language :: Python :: 3.5
   Programming Language :: Cython
   Topic :: Scientific/Engineering

 Richard

 On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:

> Richard
>
> I have not had it successfully running under ubuntu 16.04 with a prior
> version of pandas.  I have it running on Ubuntu 14.04 with the same 
> version
> of pandas.  It fails on:
>
> import pandas as pd
>
> -Jim
>
> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Massimo's has always said it wasn't secure, I ignore the exact
>> reason(s)...
>>
>> I suggest downgrading pandas with this rational you were using is in
>> previous version of pandas and nginx without this problem...
>>
>> I do use pandas (but not HDF5 Store) and I don't experiment this
>> issue... neither in 12.04 or 16.04
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>>
>>> In my reading I didn't see that downgrading pandas would help. Am I
>>> missing something or did I mislead you with my post?  Downgrading ubuntu
>>> would help (which is what we have now, but would like to run the latest
>>> ubuntu).
>>>
>>> But, back to the main question, what are the biggest factors in not
>>> recommending rocket for production use?  Does putting haproxy in front 
>>> of
>>> the rocket servers alleviate the concerns?
>>>
>>> -Jim
>>>
>>> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:

 You can't downgrade pandas package?

 Richard

 On Tue, Aug 16, 2016 at 12:35 PM, Jim S 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Jim Steil
Let me restate my issue

I can use pandas just fine on ubuntu 16.04.  The problem occurs when I'm
importing a module into a web2py controller and that module fails to import
on the 'import pandas as pd' line.

Just to be clear, pandas works find on the box.  It is when it runs on
web2py through the nginx/uwsgi stack that it fails.

-Jim


On Tue, Aug 16, 2016 at 2:30 PM, Richard Vézina  wrote:

> Strange!
>
> Missing dependency which didn't install because of a broken link?
>
> Richard
>
> On Tue, Aug 16, 2016 at 3:22 PM, Jim Steil  wrote:
>
>> From my system:
>>
>> administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
>> [sudo] password for administrator:
>> ---
>> Metadata-Version: 2.0
>> Name: pandas
>> Version: 0.18.1
>> Summary: Powerful data structures for data analysis, time series,and
>> statistics
>> Home-page: http://pandas.pydata.org
>> Author: The PyData Development Team
>> Author-email: pyd...@googlegroups.com
>> Installer: pip
>> License: BSD
>> Location: /usr/local/lib/python2.7/dist-packages
>> Requires: pytz, python-dateutil, numpy
>> Classifiers:
>>   Development Status :: 5 - Production/Stable
>>   Environment :: Console
>>   Operating System :: OS Independent
>>   Intended Audience :: Science/Research
>>   Programming Language :: Python
>>   Programming Language :: Python :: 2
>>   Programming Language :: Python :: 3
>>   Programming Language :: Python :: 2.7
>>   Programming Language :: Python :: 3.4
>>   Programming Language :: Python :: 3.5
>>   Programming Language :: Cython
>>   Topic :: Scientific/Engineering
>>
>> I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
>> updated using:
>>
>> sudo pip install --upgrade pip
>>
>> ...before installing pandas which I installed using pip and not an ubuntu
>> package.
>>
>> -Jim
>>
>> btw - really appreciate your help with this...
>>
>>
>> On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Maybe try reinstall pip package, or if you use ubuntu package, use pip
>>> one instead...
>>>
>>> On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Can you identify the responsible piece of pandas code that cause the
 issue? It don't make sens if you can't import pandas as pd in U16.04... I
 just try and it works...


 sudo pip show pandas
 ---
 Metadata-Version: 1.1
 Name: pandas
 Version: 0.18.1
 Summary: Powerful data structures for data analysis, time series,and
 statistics
 Home-page: http://pandas.pydata.org
 Author: The PyData Development Team
 Author-email: pyd...@googlegroups.com
 License: BSD
 Location: /usr/local/lib/python2.7/dist-packages
 Requires: python-dateutil, pytz, numpy
 Classifiers:
   Development Status :: 5 - Production/Stable
   Environment :: Console
   Operating System :: OS Independent
   Intended Audience :: Science/Research
   Programming Language :: Python
   Programming Language :: Python :: 2
   Programming Language :: Python :: 3
   Programming Language :: Python :: 2.7
   Programming Language :: Python :: 3.4
   Programming Language :: Python :: 3.5
   Programming Language :: Cython
   Topic :: Scientific/Engineering

 Richard

 On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:

> Richard
>
> I have not had it successfully running under ubuntu 16.04 with a prior
> version of pandas.  I have it running on Ubuntu 14.04 with the same 
> version
> of pandas.  It fails on:
>
> import pandas as pd
>
> -Jim
>
> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Massimo's has always said it wasn't secure, I ignore the exact
>> reason(s)...
>>
>> I suggest downgrading pandas with this rational you were using is in
>> previous version of pandas and nginx without this problem...
>>
>> I do use pandas (but not HDF5 Store) and I don't experiment this
>> issue... neither in 12.04 or 16.04
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>>
>>> In my reading I didn't see that downgrading pandas would help. Am I
>>> missing something or did I mislead you with my post?  Downgrading ubuntu
>>> would help (which is what we have now, but would like to run the latest
>>> ubuntu).
>>>
>>> But, back to the main question, what are the biggest factors in not
>>> recommending rocket for production use?  Does putting haproxy in front 
>>> of
>>> the rocket servers alleviate the concerns?
>>>
>>> -Jim
>>>
>>> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:

 You can't downgrade pandas package?

 Richard

 On Tue, 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Jim Steil
>From my system:

administrator@ubuntu16-2:/etc/nginx/sites-enabled$ sudo pip show pandas
[sudo] password for administrator:
---
Metadata-Version: 2.0
Name: pandas
Version: 0.18.1
Summary: Powerful data structures for data analysis, time series,and
statistics
Home-page: http://pandas.pydata.org
Author: The PyData Development Team
Author-email: pyd...@googlegroups.com
Installer: pip
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: pytz, python-dateutil, numpy
Classifiers:
  Development Status :: 5 - Production/Stable
  Environment :: Console
  Operating System :: OS Independent
  Intended Audience :: Science/Research
  Programming Language :: Python
  Programming Language :: Python :: 2
  Programming Language :: Python :: 3
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Programming Language :: Cython
  Topic :: Scientific/Engineering

I'm experiencing this on multiple Ubuntu 16.04 systems.  Pip has been
updated using:

sudo pip install --upgrade pip

...before installing pandas which I installed using pip and not an ubuntu
package.

-Jim

btw - really appreciate your help with this...


On Tue, Aug 16, 2016 at 2:19 PM, Richard Vézina  wrote:

> Maybe try reinstall pip package, or if you use ubuntu package, use pip one
> instead...
>
> On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Can you identify the responsible piece of pandas code that cause the
>> issue? It don't make sens if you can't import pandas as pd in U16.04... I
>> just try and it works...
>>
>>
>> sudo pip show pandas
>> ---
>> Metadata-Version: 1.1
>> Name: pandas
>> Version: 0.18.1
>> Summary: Powerful data structures for data analysis, time series,and
>> statistics
>> Home-page: http://pandas.pydata.org
>> Author: The PyData Development Team
>> Author-email: pyd...@googlegroups.com
>> License: BSD
>> Location: /usr/local/lib/python2.7/dist-packages
>> Requires: python-dateutil, pytz, numpy
>> Classifiers:
>>   Development Status :: 5 - Production/Stable
>>   Environment :: Console
>>   Operating System :: OS Independent
>>   Intended Audience :: Science/Research
>>   Programming Language :: Python
>>   Programming Language :: Python :: 2
>>   Programming Language :: Python :: 3
>>   Programming Language :: Python :: 2.7
>>   Programming Language :: Python :: 3.4
>>   Programming Language :: Python :: 3.5
>>   Programming Language :: Cython
>>   Topic :: Scientific/Engineering
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:
>>
>>> Richard
>>>
>>> I have not had it successfully running under ubuntu 16.04 with a prior
>>> version of pandas.  I have it running on Ubuntu 14.04 with the same version
>>> of pandas.  It fails on:
>>>
>>> import pandas as pd
>>>
>>> -Jim
>>>
>>> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Massimo's has always said it wasn't secure, I ignore the exact
 reason(s)...

 I suggest downgrading pandas with this rational you were using is in
 previous version of pandas and nginx without this problem...

 I do use pandas (but not HDF5 Store) and I don't experiment this
 issue... neither in 12.04 or 16.04

 Richard

 On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:

> In my reading I didn't see that downgrading pandas would help. Am I
> missing something or did I mislead you with my post?  Downgrading ubuntu
> would help (which is what we have now, but would like to run the latest
> ubuntu).
>
> But, back to the main question, what are the biggest factors in not
> recommending rocket for production use?  Does putting haproxy in front of
> the rocket servers alleviate the concerns?
>
> -Jim
>
> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>>
>> You can't downgrade pandas package?
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:
>>
>>> Ron
>>>
>>> It would depend on what OS you're running on the x86 box.  This
>>> would be a good place to start http://web2py.com/books/
>>> default/chapter/29/13/deployment-recipes
>>>
>>> Also, if you don't mind, could you re-post this in a new thread so
>>> this thread could focus on my initial question?
>>>
>>> -Jim
>>>
>>>
>>> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee
>>> wrote:

 On that note, can someone point me to documentation about how to
 set up an environment in dedicated sever on X86? I am thinking about
 co-locating than shared hosting. If someone does go that route, how we
 manage to set up the hosting environment?



 On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:

Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
Maybe try reinstall pip package, or if you use ubuntu package, use pip one
instead...

On Tue, Aug 16, 2016 at 3:16 PM, Richard Vézina  wrote:

> Can you identify the responsible piece of pandas code that cause the
> issue? It don't make sens if you can't import pandas as pd in U16.04... I
> just try and it works...
>
>
> sudo pip show pandas
> ---
> Metadata-Version: 1.1
> Name: pandas
> Version: 0.18.1
> Summary: Powerful data structures for data analysis, time series,and
> statistics
> Home-page: http://pandas.pydata.org
> Author: The PyData Development Team
> Author-email: pyd...@googlegroups.com
> License: BSD
> Location: /usr/local/lib/python2.7/dist-packages
> Requires: python-dateutil, pytz, numpy
> Classifiers:
>   Development Status :: 5 - Production/Stable
>   Environment :: Console
>   Operating System :: OS Independent
>   Intended Audience :: Science/Research
>   Programming Language :: Python
>   Programming Language :: Python :: 2
>   Programming Language :: Python :: 3
>   Programming Language :: Python :: 2.7
>   Programming Language :: Python :: 3.4
>   Programming Language :: Python :: 3.5
>   Programming Language :: Cython
>   Topic :: Scientific/Engineering
>
> Richard
>
> On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:
>
>> Richard
>>
>> I have not had it successfully running under ubuntu 16.04 with a prior
>> version of pandas.  I have it running on Ubuntu 14.04 with the same version
>> of pandas.  It fails on:
>>
>> import pandas as pd
>>
>> -Jim
>>
>> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Massimo's has always said it wasn't secure, I ignore the exact
>>> reason(s)...
>>>
>>> I suggest downgrading pandas with this rational you were using is in
>>> previous version of pandas and nginx without this problem...
>>>
>>> I do use pandas (but not HDF5 Store) and I don't experiment this
>>> issue... neither in 12.04 or 16.04
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>>>
 In my reading I didn't see that downgrading pandas would help. Am I
 missing something or did I mislead you with my post?  Downgrading ubuntu
 would help (which is what we have now, but would like to run the latest
 ubuntu).

 But, back to the main question, what are the biggest factors in not
 recommending rocket for production use?  Does putting haproxy in front of
 the rocket servers alleviate the concerns?

 -Jim

 On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>
> You can't downgrade pandas package?
>
> Richard
>
> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:
>
>> Ron
>>
>> It would depend on what OS you're running on the x86 box.  This would
>> be a good place to start http://web2py.com/books/
>> default/chapter/29/13/deployment-recipes
>>
>> Also, if you don't mind, could you re-post this in a new thread so
>> this thread could focus on my initial question?
>>
>> -Jim
>>
>>
>> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee
>> wrote:
>>>
>>> On that note, can someone point me to documentation about how to set
>>> up an environment in dedicated sever on X86? I am thinking about
>>> co-locating than shared hosting. If someone does go that route, how we
>>> manage to set up the hosting environment?
>>>
>>>
>>>
>>> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:

 Hi

 I currently have my app deployed using Ubuntu 14.04 / nginx /
 uwsgi.  I have a couple of servers load-balanced behind a haproxy 
 server.
 I'm running ssl on the haproxy system and talking http to web2y through
 nginx/uwsgi.

 Now, I'm trying to upgrade ubuntu to 16.04 and an having issues
 with pandas (used in my web2py app) through the nginx/uwsgi stack.  See
 this issue for what might be causing it -
 http://stackoverflow.com/questions/19439190/segmentation-f
 ault-while-using-pandas-in-uwsgi

 Fixing this error is obviously something beyond my capabilities so
 it got me thinking about alternative deployment options.  One that I'm
 considering is replacing my nginx / uwsgi stack with just the rocket 
 server
 to serve the web2py app.  My rocket servers (2 of them) would be 
 behind the
 haproxy server so would not be public-facing.

 I'm aware of the recommendation against running rocket in a
 production environment but am not aware of the reasons for the
 recommendation.

 My question - does running multiple rocket servers behind haproxy
 remove the concerns about rocket in a production environment?

 -Jim

>>> 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
Can you identify the responsible piece of pandas code that cause the issue?
It don't make sens if you can't import pandas as pd in U16.04... I just try
and it works...


sudo pip show pandas
---
Metadata-Version: 1.1
Name: pandas
Version: 0.18.1
Summary: Powerful data structures for data analysis, time series,and
statistics
Home-page: http://pandas.pydata.org
Author: The PyData Development Team
Author-email: pyd...@googlegroups.com
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: python-dateutil, pytz, numpy
Classifiers:
  Development Status :: 5 - Production/Stable
  Environment :: Console
  Operating System :: OS Independent
  Intended Audience :: Science/Research
  Programming Language :: Python
  Programming Language :: Python :: 2
  Programming Language :: Python :: 3
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Programming Language :: Cython
  Topic :: Scientific/Engineering

Richard

On Tue, Aug 16, 2016 at 2:52 PM, Jim Steil  wrote:

> Richard
>
> I have not had it successfully running under ubuntu 16.04 with a prior
> version of pandas.  I have it running on Ubuntu 14.04 with the same version
> of pandas.  It fails on:
>
> import pandas as pd
>
> -Jim
>
> On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Massimo's has always said it wasn't secure, I ignore the exact
>> reason(s)...
>>
>> I suggest downgrading pandas with this rational you were using is in
>> previous version of pandas and nginx without this problem...
>>
>> I do use pandas (but not HDF5 Store) and I don't experiment this issue...
>> neither in 12.04 or 16.04
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>>
>>> In my reading I didn't see that downgrading pandas would help. Am I
>>> missing something or did I mislead you with my post?  Downgrading ubuntu
>>> would help (which is what we have now, but would like to run the latest
>>> ubuntu).
>>>
>>> But, back to the main question, what are the biggest factors in not
>>> recommending rocket for production use?  Does putting haproxy in front of
>>> the rocket servers alleviate the concerns?
>>>
>>> -Jim
>>>
>>> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:

 You can't downgrade pandas package?

 Richard

 On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:

> Ron
>
> It would depend on what OS you're running on the x86 box.  This would
> be a good place to start http://web2py.com/books/
> default/chapter/29/13/deployment-recipes
>
> Also, if you don't mind, could you re-post this in a new thread so
> this thread could focus on my initial question?
>
> -Jim
>
>
> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:
>>
>> On that note, can someone point me to documentation about how to set
>> up an environment in dedicated sever on X86? I am thinking about
>> co-locating than shared hosting. If someone does go that route, how we
>> manage to set up the hosting environment?
>>
>>
>>
>> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>>>
>>> Hi
>>>
>>> I currently have my app deployed using Ubuntu 14.04 / nginx /
>>> uwsgi.  I have a couple of servers load-balanced behind a haproxy 
>>> server.
>>> I'm running ssl on the haproxy system and talking http to web2y through
>>> nginx/uwsgi.
>>>
>>> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with
>>> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this
>>> issue for what might be causing it - http://stackoverflow.com/que
>>> stions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>>>
>>> Fixing this error is obviously something beyond my capabilities so
>>> it got me thinking about alternative deployment options.  One that I'm
>>> considering is replacing my nginx / uwsgi stack with just the rocket 
>>> server
>>> to serve the web2py app.  My rocket servers (2 of them) would be behind 
>>> the
>>> haproxy server so would not be public-facing.
>>>
>>> I'm aware of the recommendation against running rocket in a
>>> production environment but am not aware of the reasons for the
>>> recommendation.
>>>
>>> My question - does running multiple rocket servers behind haproxy
>>> remove the concerns about rocket in a production environment?
>>>
>>> -Jim
>>>
>> --
> 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 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Jim Steil
Richard

I have not had it successfully running under ubuntu 16.04 with a prior
version of pandas.  I have it running on Ubuntu 14.04 with the same version
of pandas.  It fails on:

import pandas as pd

-Jim

On Tue, Aug 16, 2016 at 1:02 PM, Richard Vézina  wrote:

> Massimo's has always said it wasn't secure, I ignore the exact reason(s)...
>
> I suggest downgrading pandas with this rational you were using is in
> previous version of pandas and nginx without this problem...
>
> I do use pandas (but not HDF5 Store) and I don't experiment this issue...
> neither in 12.04 or 16.04
>
> Richard
>
> On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:
>
>> In my reading I didn't see that downgrading pandas would help. Am I
>> missing something or did I mislead you with my post?  Downgrading ubuntu
>> would help (which is what we have now, but would like to run the latest
>> ubuntu).
>>
>> But, back to the main question, what are the biggest factors in not
>> recommending rocket for production use?  Does putting haproxy in front of
>> the rocket servers alleviate the concerns?
>>
>> -Jim
>>
>> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>>>
>>> You can't downgrade pandas package?
>>>
>>> Richard
>>>
>>> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:
>>>
 Ron

 It would depend on what OS you're running on the x86 box.  This would
 be a good place to start http://web2py.com/books/
 default/chapter/29/13/deployment-recipes

 Also, if you don't mind, could you re-post this in a new thread so this
 thread could focus on my initial question?

 -Jim


 On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:
>
> On that note, can someone point me to documentation about how to set
> up an environment in dedicated sever on X86? I am thinking about
> co-locating than shared hosting. If someone does go that route, how we
> manage to set up the hosting environment?
>
>
>
> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>>
>> Hi
>>
>> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.
>> I have a couple of servers load-balanced behind a haproxy server.  I'm
>> running ssl on the haproxy system and talking http to web2y through
>> nginx/uwsgi.
>>
>> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with
>> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this
>> issue for what might be causing it - http://stackoverflow.com/que
>> stions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>>
>> Fixing this error is obviously something beyond my capabilities so it
>> got me thinking about alternative deployment options.  One that I'm
>> considering is replacing my nginx / uwsgi stack with just the rocket 
>> server
>> to serve the web2py app.  My rocket servers (2 of them) would be behind 
>> the
>> haproxy server so would not be public-facing.
>>
>> I'm aware of the recommendation against running rocket in a
>> production environment but am not aware of the reasons for the
>> recommendation.
>>
>> My question - does running multiple rocket servers behind haproxy
>> remove the concerns about rocket in a production environment?
>>
>> -Jim
>>
> --
 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+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>> 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.
>>
>
> --
> 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/MTOjl8gPuTk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> 

[web2py] Re: scheduler task_id assigned to multiple workers

2016-08-16 Thread Jason Solack
task = scheduler.queue_task(tab_run, 
pvars=dict(tab_file_name=tab_file_name, the_form_file=the_form_file), 
timeout=60 * 60 * 24, sync_output=2, immediate=False, 
group_name=scheduler_group_name)

anything look amiss here?

On Tuesday, August 16, 2016 at 2:14:38 PM UTC-4, Dave S wrote:
>
>
>
> On Tuesday, August 16, 2016 at 9:38:09 AM UTC-7, Jason Solack wrote:
>>
>> Hello all, i am having a situation where my scheduled jobs are being 
>> picked up by multiple workers.  My last task was picked up by all 12 
>> workers and is crushing the machines.  This is a load balanced machine with 
>> 3 machine and 4 workers on each machine.  has anyone experienced something 
>> like this?
>>
>> Thanks for your help in advance!
>>
>> jason
>>
>
> What does your queue_task() code look like?
>
> /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] Re: Deployment question

2016-08-16 Thread Dave S


On Tuesday, August 16, 2016 at 8:50:51 AM UTC-7, Jim S wrote:
>
> Hi 
>
> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I 
> have a couple of servers load-balanced behind a haproxy server.  I'm 
> running ssl on the haproxy system and talking http to web2y through 
> nginx/uwsgi.
>
> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with 
> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this 
> issue for what might be causing it - 
> http://stackoverflow.com/questions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>
> Fixing this error is obviously something beyond my capabilities so it got 
> me thinking about alternative deployment options.  One that I'm considering 
> is replacing my nginx / uwsgi stack with just the rocket server to serve 
> the web2py app.  My rocket servers (2 of them) would be behind the haproxy 
> server so would not be public-facing.
>
> I'm aware of the recommendation against running rocket in a production 
> environment but am not aware of the reasons for the recommendation.
>
> My question - does running multiple rocket servers behind haproxy remove 
> the concerns about rocket in a production environment?
>
> -Jim
>


I'm not familiar with Pandas, so I can't comment on that part.  I run 
rocket, but only a single instance as a development environment.  Perhaps 
Mariano and Massimo have tested other configurations, but I think the bulk 
of us using rocket only run a single instance. 

What are the specific rocket concerns?  Scaling?

/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] Re: scheduler task_id assigned to multiple workers

2016-08-16 Thread Dave S


On Tuesday, August 16, 2016 at 9:38:09 AM UTC-7, Jason Solack wrote:
>
> Hello all, i am having a situation where my scheduled jobs are being 
> picked up by multiple workers.  My last task was picked up by all 12 
> workers and is crushing the machines.  This is a load balanced machine with 
> 3 machine and 4 workers on each machine.  has anyone experienced something 
> like this?
>
> Thanks for your help in advance!
>
> jason
>

What does your queue_task() code look like?

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


Re: [web2py] Re: Web2Py tool: Amazon SNS integration

2016-08-16 Thread Dave S

On Tuesday, August 16, 2016 at 6:17:11 AM UTC-7, Kiran Subbaraman wrote:
>
> I don't have code for this, but the general idea would be: 
> * Refer to the SNS API from here: 
> http://docs.aws.amazon.com/sns/latest/api/Welcome.html. I would use the 
> `requests` library to interact with the API. Or you could search for a 
> python client for this API. 
>

That page refers to "the SDKs".  Following the reference, there is
 


* Scheduler implementation, along with the callbacks code, is listed in 
> the web2py book, and this forum. 
>
> Do you attempt the implementation, and share any issues you face. 
>
>
He's already got some coaching on the scheduler in another thread.

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


Re: [web2py] Re: Deployment question

2016-08-16 Thread Richard Vézina
Massimo's has always said it wasn't secure, I ignore the exact reason(s)...

I suggest downgrading pandas with this rational you were using is in
previous version of pandas and nginx without this problem...

I do use pandas (but not HDF5 Store) and I don't experiment this issue...
neither in 12.04 or 16.04

Richard

On Tue, Aug 16, 2016 at 1:55 PM, Jim S  wrote:

> In my reading I didn't see that downgrading pandas would help. Am I
> missing something or did I mislead you with my post?  Downgrading ubuntu
> would help (which is what we have now, but would like to run the latest
> ubuntu).
>
> But, back to the main question, what are the biggest factors in not
> recommending rocket for production use?  Does putting haproxy in front of
> the rocket servers alleviate the concerns?
>
> -Jim
>
> On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>>
>> You can't downgrade pandas package?
>>
>> Richard
>>
>> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:
>>
>>> Ron
>>>
>>> It would depend on what OS you're running on the x86 box.  This would be
>>> a good place to start http://web2py.com/books/
>>> default/chapter/29/13/deployment-recipes
>>>
>>> Also, if you don't mind, could you re-post this in a new thread so this
>>> thread could focus on my initial question?
>>>
>>> -Jim
>>>
>>>
>>> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:

 On that note, can someone point me to documentation about how to set up
 an environment in dedicated sever on X86? I am thinking about co-locating
 than shared hosting. If someone does go that route, how we manage to set up
 the hosting environment?



 On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>
> Hi
>
> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.
> I have a couple of servers load-balanced behind a haproxy server.  I'm
> running ssl on the haproxy system and talking http to web2y through
> nginx/uwsgi.
>
> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with
> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this
> issue for what might be causing it - http://stackoverflow.com/que
> stions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>
> Fixing this error is obviously something beyond my capabilities so it
> got me thinking about alternative deployment options.  One that I'm
> considering is replacing my nginx / uwsgi stack with just the rocket 
> server
> to serve the web2py app.  My rocket servers (2 of them) would be behind 
> the
> haproxy server so would not be public-facing.
>
> I'm aware of the recommendation against running rocket in a production
> environment but am not aware of the reasons for the recommendation.
>
> My question - does running multiple rocket servers behind haproxy
> remove the concerns about rocket in a production environment?
>
> -Jim
>
 --
>>> 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+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> 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.
>

-- 
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 tool : Send emails to multiple user on schedule basis

2016-08-16 Thread Dave S


On Tuesday, August 16, 2016 at 4:58:11 AM UTC-7, madhu nomula wrote:
>
> Thank you. 
> I moved the code to Model. But could you please share me steps that 
> how to schedule(trigger) it send emails. 
>
>
I thought my suggested code was pretty clear.  sched_tasks() sets up the 
task to run every day.  The task then checks to see if it needs to send 
mail to everybody or just to the slow responders.

If you want to schedule the task to run just twice a month, then you change 
the "86400" to (approximately) 1209600.  I say "approximately" because that 
value if for "every two weeks".  To do the 1st and 16th, you need to figure 
out how much time there is from "now" to the 1st or 16th.  You'd use a 
standard Python datetime.timedelta to figure that out.  You can make 
sched_tasks() start just the first run, and have the task itself schedule 
itself (actually, another task instance running the same code); in that 
case, the call to scheduler.queue_task() will set repeats=0.

Please read 

for details about the scheduler.

/dps


 

> On Tue, Aug 16, 2016 at 5:19 PM, 黄祥  
> wrote: 
> > i think the sendemail.py should be in models 
> > models/SendEmail.py: 
> > # -*- coding: utf-8 -*- 
> > # try something like 
> > from gluon.tools import Mail 
> > def send_email(): 
> >   mail = Mail() 
> >   #mail.settings.server = 'smtp.hitachiconsulting.com' 
> >   mail.settings.server = 'smtp.gmail.com:587' 
> >   mail.settings.sender = 'a...@example.com' 
> >   mail.settings.login = 'mytool...@gmail.com:123' 
> >   x = mail.send( 
> >   to = ['m...@gmail.com'], subject = 'hello', 
> >   reply_to = 'a...@example.com', 
> >   message = 'Hello ! How are you?' 
> >   ) 
> >   if x: 
> > nm="Sent Successfully"; 
> >   else: 
> > nm="failed"; 
> > 
> > not sure what do you mean with to schedule sending emails 1 to 15 days 
> and 
> > 16 to 30 days, if you want to send email which is date is 1-15, i think 
> you 
> > can use conditional if : 
> > if request.now.day >= 1 and request.now.day <= 15: 
> > 
> > best regards, 
> > stifan 
> > 
> > On Tuesday, August 16, 2016 at 6:26:33 PM UTC+7, madhu nomula wrote: 
> >> 
> >> Thanks Dave. 
> >> 
> >> I wrote code like below: But I am not sure how to schedule this. Could 
> >> you please guide me to configure this Scheduler (need bit more 
> >> elaborated steps). Thank you appreciate your help: 
> >> __ 
> >> In Controller: SendEmail.py: 
> >> # -*- coding: utf-8 -*- 
> >> # try something like 
> >> from gluon.tools import Mail 
> >> def send_email(): 
> >> mail = Mail() 
> >> #mail.settings.server = 'smtp.hitachiconsulting.com' 
> >> mail.settings.server = 'smtp.gmail.com:587' 
> >> mail.settings.sender = 'a...@example.com' 
> >> mail.settings.login = 'mytool...@gmail.com:123' 
> >> x = mail.send( 
> >>to = ['m...@gmail.com'], subject = 'hello', 
> >>reply_to = 'a...@example.com', 
> >>message = 'Hello ! How are you?' 
> >> ) 
> >> if x: 
> >> nm="Sent Successfully"; 
> >> else: 
> >> nm="failed"; 
> >> _ 
> >> In Controller: scheduler.py 
> >> from gluon.scheduler import Scheduler 
> >> # schedule recurring tasks: 
> >> def sched_tasks(arg1=""): 
> >>   # arg1 keeps this from being expose as a web page 
> >>   # instantiate Scheduler class 
> >> scheduler = Scheduler(db) 
> >> task = scheduler.queue_task("send_email", period = 86400, 
> repeats=1) 
> >>   # show on console, or add to log 
> >> print task 
> >> db.commit() 
> >> 
> >> def stop_tasks(arg1=""): 
> >>   # arg1 keeps this from being expose as a web page 
> >>   # instantiate Scheduler class 
> >> scheduler = Scheduler(db) 
> >> task = scheduler.task_status(db.scheduler_task.task_name == 
> >> 'send_email') 
> >> if hasattr(task, "status") and task.status in ["QUEUED", 
> "RUNNING"]: 
> >> stop = scehduler.stop_task(task.uuid) 
> >>  # show on console or add to log 
> >> print cue 
> >> db.commit() 
> >> _ 
> >> 
> >> 
> >> Please suggest me, next what I have to do , to schedule sending emails 
> >> 1 to 15 days and 16 to 30 days . 
> >> 
> >> Regards, 
> >> MC 
> >> 
> >> 
> >> On Wed, Aug 3, 2016 at 12:28 AM, Dave S  wrote: 
> >> > 
> >> > 
> >> > On Tuesday, August 2, 2016 at 10:51:36 AM UTC-7, madhu nomula wrote: 
> >> >> 
> >> >> Hi All, 
> >> >> 
> >> >> I need help on below requirement. 
> >> >> 
> >> >> We have implemented Time sheet  logging tool for users in web2py 
> tool. 
> >> >> 
> >> >> Now the requirement is to send email notifications to the users of 
> >> >> tool, 
> >> >> to enter time sheet and submit. 
> >> >> This email has to be sent for all users from 1 to 15 days of month 
> and 
> >> >> 16 
> >> >> to 30 days of month till the user submits time sheets. 
> >> > 
> >> > 
> >> > I am not sure 

Re: [web2py] Re: Deployment question

2016-08-16 Thread Jim S
In my reading I didn't see that downgrading pandas would help. Am I missing 
something or did I mislead you with my post?  Downgrading ubuntu would help 
(which is what we have now, but would like to run the latest ubuntu).

But, back to the main question, what are the biggest factors in not 
recommending rocket for production use?  Does putting haproxy in front of 
the rocket servers alleviate the concerns?

-Jim

On Tuesday, August 16, 2016 at 11:48:59 AM UTC-5, Richard wrote:
>
> You can't downgrade pandas package?
>
> Richard
>
> On Tue, Aug 16, 2016 at 12:35 PM, Jim S  
> wrote:
>
>> Ron
>>
>> It would depend on what OS you're running on the x86 box.  This would be 
>> a good place to start 
>> http://web2py.com/books/default/chapter/29/13/deployment-recipes
>>
>> Also, if you don't mind, could you re-post this in a new thread so this 
>> thread could focus on my initial question?
>>
>> -Jim
>>
>>
>> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:
>>>
>>> On that note, can someone point me to documentation about how to set up 
>>> an environment in dedicated sever on X86? I am thinking about co-locating 
>>> than shared hosting. If someone does go that route, how we manage to set up 
>>> the hosting environment?
>>>
>>>  
>>>
>>> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:

 Hi 

 I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I 
 have a couple of servers load-balanced behind a haproxy server.  I'm 
 running ssl on the haproxy system and talking http to web2y through 
 nginx/uwsgi.

 Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with 
 pandas (used in my web2py app) through the nginx/uwsgi stack.  See this 
 issue for what might be causing it - 
 http://stackoverflow.com/questions/19439190/segmentation-fault-while-using-pandas-in-uwsgi

 Fixing this error is obviously something beyond my capabilities so it 
 got me thinking about alternative deployment options.  One that I'm 
 considering is replacing my nginx / uwsgi stack with just the rocket 
 server 
 to serve the web2py app.  My rocket servers (2 of them) would be behind 
 the 
 haproxy server so would not be public-facing.

 I'm aware of the recommendation against running rocket in a production 
 environment but am not aware of the reasons for the recommendation.

 My question - does running multiple rocket servers behind haproxy 
 remove the concerns about rocket in a production environment?

 -Jim

>>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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: Deployment question

2016-08-16 Thread Richard Vézina
You can't downgrade pandas package?

Richard

On Tue, Aug 16, 2016 at 12:35 PM, Jim S  wrote:

> Ron
>
> It would depend on what OS you're running on the x86 box.  This would be a
> good place to start http://web2py.com/books/default/chapter/29/13/
> deployment-recipes
>
> Also, if you don't mind, could you re-post this in a new thread so this
> thread could focus on my initial question?
>
> -Jim
>
>
> On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:
>>
>> On that note, can someone point me to documentation about how to set up
>> an environment in dedicated sever on X86? I am thinking about co-locating
>> than shared hosting. If someone does go that route, how we manage to set up
>> the hosting environment?
>>
>>
>>
>> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>>>
>>> Hi
>>>
>>> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I
>>> have a couple of servers load-balanced behind a haproxy server.  I'm
>>> running ssl on the haproxy system and talking http to web2y through
>>> nginx/uwsgi.
>>>
>>> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with
>>> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this
>>> issue for what might be causing it - http://stackoverflow.com/que
>>> stions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>>>
>>> Fixing this error is obviously something beyond my capabilities so it
>>> got me thinking about alternative deployment options.  One that I'm
>>> considering is replacing my nginx / uwsgi stack with just the rocket server
>>> to serve the web2py app.  My rocket servers (2 of them) would be behind the
>>> haproxy server so would not be public-facing.
>>>
>>> I'm aware of the recommendation against running rocket in a production
>>> environment but am not aware of the reasons for the recommendation.
>>>
>>> My question - does running multiple rocket servers behind haproxy remove
>>> the concerns about rocket in a production environment?
>>>
>>> -Jim
>>>
>> --
> 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.
>

-- 
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] scheduler task_id assigned to multiple workers

2016-08-16 Thread Jason Solack
Hello all, i am having a situation where my scheduled jobs are being picked 
up by multiple workers.  My last task was picked up by all 12 workers and 
is crushing the machines.  This is a load balanced machine with 3 machine 
and 4 workers on each machine.  has anyone experienced something like this?

Thanks for your help in advance!

jason

-- 
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: Deployment question

2016-08-16 Thread Jim S
Ron

It would depend on what OS you're running on the x86 box.  This would be a 
good place to 
start http://web2py.com/books/default/chapter/29/13/deployment-recipes

Also, if you don't mind, could you re-post this in a new thread so this 
thread could focus on my initial question?

-Jim


On Tuesday, August 16, 2016 at 11:23:17 AM UTC-5, Ron Chatterjee wrote:
>
> On that note, can someone point me to documentation about how to set up an 
> environment in dedicated sever on X86? I am thinking about co-locating than 
> shared hosting. If someone does go that route, how we manage to set up the 
> hosting environment?
>
>  
>
> On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>>
>> Hi 
>>
>> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I 
>> have a couple of servers load-balanced behind a haproxy server.  I'm 
>> running ssl on the haproxy system and talking http to web2y through 
>> nginx/uwsgi.
>>
>> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with 
>> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this 
>> issue for what might be causing it - 
>> http://stackoverflow.com/questions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>>
>> Fixing this error is obviously something beyond my capabilities so it got 
>> me thinking about alternative deployment options.  One that I'm considering 
>> is replacing my nginx / uwsgi stack with just the rocket server to serve 
>> the web2py app.  My rocket servers (2 of them) would be behind the haproxy 
>> server so would not be public-facing.
>>
>> I'm aware of the recommendation against running rocket in a production 
>> environment but am not aware of the reasons for the recommendation.
>>
>> My question - does running multiple rocket servers behind haproxy remove 
>> the concerns about rocket in a production environment?
>>
>> -Jim
>>
>

-- 
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: Deployment question

2016-08-16 Thread Ron Chatterjee
On that note, can someone point me to documentation about how to set up an 
environment in dedicated sever on X86? I am thinking about co-locating than 
shared hosting. If someone does go that route, how we manage to set up the 
hosting environment?

 

On Tuesday, August 16, 2016 at 11:50:51 AM UTC-4, Jim S wrote:
>
> Hi 
>
> I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I 
> have a couple of servers load-balanced behind a haproxy server.  I'm 
> running ssl on the haproxy system and talking http to web2y through 
> nginx/uwsgi.
>
> Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with 
> pandas (used in my web2py app) through the nginx/uwsgi stack.  See this 
> issue for what might be causing it - 
> http://stackoverflow.com/questions/19439190/segmentation-fault-while-using-pandas-in-uwsgi
>
> Fixing this error is obviously something beyond my capabilities so it got 
> me thinking about alternative deployment options.  One that I'm considering 
> is replacing my nginx / uwsgi stack with just the rocket server to serve 
> the web2py app.  My rocket servers (2 of them) would be behind the haproxy 
> server so would not be public-facing.
>
> I'm aware of the recommendation against running rocket in a production 
> environment but am not aware of the reasons for the recommendation.
>
> My question - does running multiple rocket servers behind haproxy remove 
> the concerns about rocket in a production environment?
>
> -Jim
>

-- 
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] Deployment question

2016-08-16 Thread Jim S
Hi 

I currently have my app deployed using Ubuntu 14.04 / nginx / uwsgi.  I 
have a couple of servers load-balanced behind a haproxy server.  I'm 
running ssl on the haproxy system and talking http to web2y through 
nginx/uwsgi.

Now, I'm trying to upgrade ubuntu to 16.04 and an having issues with pandas 
(used in my web2py app) through the nginx/uwsgi stack.  See this issue for 
what might be causing it 
- 
http://stackoverflow.com/questions/19439190/segmentation-fault-while-using-pandas-in-uwsgi

Fixing this error is obviously something beyond my capabilities so it got 
me thinking about alternative deployment options.  One that I'm considering 
is replacing my nginx / uwsgi stack with just the rocket server to serve 
the web2py app.  My rocket servers (2 of them) would be behind the haproxy 
server so would not be public-facing.

I'm aware of the recommendation against running rocket in a production 
environment but am not aware of the reasons for the recommendation.

My question - does running multiple rocket servers behind haproxy remove 
the concerns about rocket in a production environment?

-Jim

-- 
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 tool: Amazon SNS integration

2016-08-16 Thread Kiran Subbaraman

I don't have code for this, but the general idea would be:
* Refer to the SNS API from here: 
http://docs.aws.amazon.com/sns/latest/api/Welcome.html. I would use the 
`requests` library to interact with the API. Or you could search for a 
python client for this API.
* Scheduler implementation, along with the callbacks code, is listed in 
the web2py book, and this forum.


Do you attempt the implementation, and share any issues you face.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Tue, 16-08-2016 5:12 PM, madhu nomula wrote:

Thank you.

I am completely new to this area. Could you please share sample code
with configure steps for SNS and integration in to Web2py tool.
Yes, the changed/newly inserted/deleted data has to be pushed.

Regards,
MC.

On Wed, Aug 3, 2016 at 10:44 AM, Kiran Subbaraman
 wrote:

Am assuming you are aware of the Amazon SNS APIs, and what it takes to
publish messages there (as a producer / publisher)
Do you want to read data from your database, and publish them to SNS on a:
* Regular scheduled basis?
* Whenever new data comes into the database?

In either case, I would use two web2py capabilities to do this - the
`_on_insert/update/delete` callbacks[1] in conjunction with the web2py
scheduler to publish to SNS.
The callback will help keep track of changes to the database (basically
whenever the database data changes, these callbacks are called ... and you
could record the changed value some place else ... maybe another table, or
store). The scheduler would call the function that would read from this
table/store and send this out to SNS.

Adjust the timing of the scheduler, depending on when you want to send out
the messages.

[1]
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=insert#callbacks-on-record-insert--delete-and-update



On Tuesday, August 2, 2016 at 11:21:39 PM UTC+5:30, madhu nomula wrote:

Hi All,

We have implemented a tool in web2py tool.

Now we have to implement sending the stored data(tables information) to
Amazon SNS.

Can you please help me how to move the stored data to Amazon SNS.

Thank you and appreciate your help in advance.


Regards,
MC

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


--
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: Referencing a table in web2py before defining it

2016-08-16 Thread Oasis Agano
this solved it

from datetime import datetime
from gluon.tools import Auth
db = DAL(lazy_tables=True)

from gluon.tools import Auth, Service, PluginManager, prettydate
auth = Auth(db, host_names = myconf.get('host.names') )

auth.define_tables(username = False, signature = True)

db.define_table('employee',
Field('fullname','string',label='Name'),
Field('email','string'),
Field('phone','string'),
Field('kids', 'string'),
Field('phone', 'string'),
#Field('date','datetime'),
Field('dob', 'datetime', label='Date'),
Field('department', 'reference 
department',requires=IS_IN_DB(db, "department.id", '%(department_name)s')),
auth.signature,
format='%(fullname)s'

)
#db = DAL(lazy_tables=True)
db.define_table('department',
Field('department_name', 'string', label='Department Name'),
# Field('department_name', 'string', label='Department Name'),
Field('manager', 'reference employee',
  requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
format='%(department_name)s'
)


Thanks to everyone


On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote:
>
> My code is the following im trying to assign a department to employees and 
> also create a manager in a department table
>
> db = DAL(lazy_tables=True)
> db.define_table('employee',
> Field('fullname','string',label='Name'),
> Field('email','string'),
> Field('phone','string'),
> Field('kids', 'string'),
> Field('phone', 'string'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date'),
> Field('department', 'reference department',
>   requires=IS_IN_DB(db, db.department.id, 
> '%(department_name)s')),
> auth.signature,
> format='%(fullname)s'
>
> )
> db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> # Field('department_name', 'string', label='Department Name'),
> Field('manager', 'reference employee', required='true',
>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
> auth.signature,
> format='%(department_name)s'
> )
>
>

-- 
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: Referencing a table in web2py before defining it

2016-08-16 Thread Anthony
Below, you still have that extra db = DAL(...) line, which needs to be 
removed.

On Tuesday, August 16, 2016 at 5:10:04 AM UTC-4, 黄祥 wrote:
>
> i think the error  related with auth definition is not found, perhaps 
> because you define the employee table first and then (or not) auth 
> definition.
> pls try :
>
> db = DAL(lazy_tables=True)
>
> from gluon.tools import Auth, Service, PluginManager, prettydate
> auth = Auth(db, host_names = myconf.get('host.names') )
>
> auth.define_tables(username = False, signature = True)
>
> db.define_table('employee',
> Field('fullname','string',label='Name'),
> Field('email','string'),
> Field('phone','string'),
> Field('kids', 'string'),
> Field('phone', 'string'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date'),
> Field('department', 'reference department',
>   requires=IS_IN_DB(db, db.department.id, 
> '%(department_name)s')),
> auth.signature,
> format='%(fullname)s'
>
> )
> db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> # Field('department_name', 'string', label='Department Name'),
> Field('manager', 'reference employee', required='true',
>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
> auth.signature,
> format='%(department_name)s'
> )
>
> as you can see on the example above, you define the db first, then the 
> auth, after that pls proceed with another table you want to have in your 
> apps.
>
> best regards,
> stifan
>
> On Tuesday, August 16, 2016 at 3:35:14 PM UTC+7, Oasis Agano wrote:
>>
>> *I did this *
>>
>> db = DAL(lazy_tables=True)
>> db.define_table('employee',
>> Field('fullname','string',label='Name'),
>> Field('email','string'),
>> Field('phone','string'),
>> Field('kids', 'string'),
>> Field('phone', 'string'),
>> #Field('date','datetime'),
>> Field('dob', 'datetime', label='Date'),
>> Field('department', 'reference department',
>>
>>   requires=IS_IN_DB(db, "department.id", 
>> '%(department_name)s')),
>> auth.signature,
>> format='%(fullname)s'
>>
>> )
>> #db = DAL(lazy_tables=True)
>> db.define_table('department',
>> Field('department_name', 'string', label='Department Name'),
>> # Field('department_name', 'string', label='Department 
>> Name'),
>> Field('manager', 'reference employee',
>>   requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
>> auth.signature,
>> format='%(department_name)s'
>> )
>>
>> now im getting a complete different error
>>
>>raise KeyError('Cannot resolve reference %s in %s definition' % 
>> (referenced, table._tablename))
>> KeyError: 'Cannot resolve reference auth_user in employee definition'
>>
>>
>> On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote:
>>>
>>> My code is the following im trying to assign a department to employees 
>>> and also create a manager in a department table
>>>
>>> db = DAL(lazy_tables=True)
>>> db.define_table('employee',
>>> Field('fullname','string',label='Name'),
>>> Field('email','string'),
>>> Field('phone','string'),
>>> Field('kids', 'string'),
>>> Field('phone', 'string'),
>>> #Field('date','datetime'),
>>> Field('dob', 'datetime', label='Date'),
>>> Field('department', 'reference department',
>>>   requires=IS_IN_DB(db, db.department.id, 
>>> '%(department_name)s')),
>>> auth.signature,
>>> format='%(fullname)s'
>>>
>>> )
>>> db = DAL(lazy_tables=True)
>>> db.define_table('department',
>>> Field('department_name', 'string', label='Department Name'),
>>> # Field('department_name', 'string', label='Department Name'),
>>> Field('manager', 'reference employee', required='true',
>>>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
>>> auth.signature,
>>> format='%(department_name)s'
>>> )
>>>
>>>

-- 
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: web2py admin - cannot install plugin - bug??

2016-08-16 Thread Mirek Zvolský
So, I have fixed few bugs in admin/default/design and have created a pull 
request,
and finally I know the real error.

It has nothing with Web2py, but with tarfile.py.
No idea why but one file inside plugin archive has date 01.01.1970 and this 
made problems for tarfile.py, as mentioned here:
http://www.gossamer-threads.com/lists/python/bugs/986466


 Python int too large to convert to C long

Traceback (most recent call last):
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/restricted.py", line 
220, in restricted
exec(ccode, environment)
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/applications/admin/controllers/default.py",
 
line 2002, in 
  File "/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/globals.py", 
line 405, in 
self._caller = lambda f: f()
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/applications/admin/controllers/default.py",
 
line 1085, in design
request, filename):
  File "/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/admin.py", 
line 313, in plugin_install
w2p_unpack_plugin(upname, path)
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/fileutils.py", line 
331, in w2p_unpack_plugin
w2p_unpack(filename, path, delete_tar)
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/fileutils.py", line 
294, in w2p_unpack
untar(tarname, path)
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/fileutils.py", line 
237, in untar
_extractall(file, dir)
  File 
"/home/mirek/mz/web2py_related/web2py_git/web2py/gluon/fileutils.py", line 
212, in _extractall
ret = tar.extractall(path, members)
  File "/usr/lib/python2.7/tarfile.py", line 2078, in extractall
self.extract(tarinfo, path)
  File "/usr/lib/python2.7/tarfile.py", line 2115, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
  File "/usr/lib/python2.7/tarfile.py", line 2208, in _extract_member
self.utime(tarinfo, targetpath)
  File "/usr/lib/python2.7/tarfile.py", line 2329, in utime
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
OverflowError: Python int too large to convert to C long





Dne úterý 9. srpna 2016 14:40:03 UTC+2 Mirek Zvolský napsal(a):
>
> Yes, .w2p.
> It is my plugin, I have packed it in one web2py app using admin (and in 
> ark I see all ~5 files inside),
> In second app I am trying to install/unpack it.
>
> Plugin is in attachment.
>
> I have renamed all files to managegroups (without underscore) too, to see 
> if problem isn't the 2nd underscore character. But result is same: Just the 
> file models/plugin_manage[_]groups.py will unpack and then it fails.
>
> PS:
> I have tested same with plugin.ckeditor.w2p - works well.
>
>
>
>
>
>
> Dne sobota 6. srpna 2016 9:29:56 UTC+2 Massimo Di Pierro napsal(a):
>>
>> Why are you uploading it as a plugin? Is it *.plugin.*.w2p? Do you know 
>> it is a plugin and not an app? 
>> If it is an app you need to upload it from the form on the right of the 
>> main site page.
>>
>> On Thursday, 4 August 2016 06:23:35 UTC-5, Mirek Zvolský wrote:
>>>
>>> I have the .w2p file on disk.
>>> I choose it in Admin interface, edit application, plugins, upload.
>>>
>>> Then only first file from the plugin is properly unpacked,
>>> other files aren't.
>>> Then the error will flash: "App does not exist or you are not authorized"
>>>
>>> I am trying to debug it and see that
>>> redirect to admin/default/get_app is called twice:
>>> - first with parameter = application name --> no problem
>>> - second call is without parameter - which causes Error message and 
>>> redirect to admin main page.
>>>
>>> Is this a bug?
>>> Or what can I do better?
>>>
>>> I have tested it with 2.14.5 and with today trunk versions.
>>> Behavior is the same :(
>>>
>>>

-- 
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 tool : Send emails to multiple user on schedule basis

2016-08-16 Thread madhu nomula
Thank you.
I moved the code to Model. But could you please share me steps that
how to schedule(trigger) it send emails.

On Tue, Aug 16, 2016 at 5:19 PM, 黄祥  wrote:
> i think the sendemail.py should be in models
> models/SendEmail.py:
> # -*- coding: utf-8 -*-
> # try something like
> from gluon.tools import Mail
> def send_email():
>   mail = Mail()
>   #mail.settings.server = 'smtp.hitachiconsulting.com'
>   mail.settings.server = 'smtp.gmail.com:587'
>   mail.settings.sender = 'a...@example.com'
>   mail.settings.login = 'mytool...@gmail.com:123'
>   x = mail.send(
>   to = ['m...@gmail.com'], subject = 'hello',
>   reply_to = 'a...@example.com',
>   message = 'Hello ! How are you?'
>   )
>   if x:
> nm="Sent Successfully";
>   else:
> nm="failed";
>
> not sure what do you mean with to schedule sending emails 1 to 15 days and
> 16 to 30 days, if you want to send email which is date is 1-15, i think you
> can use conditional if :
> if request.now.day >= 1 and request.now.day <= 15:
>
> best regards,
> stifan
>
> On Tuesday, August 16, 2016 at 6:26:33 PM UTC+7, madhu nomula wrote:
>>
>> Thanks Dave.
>>
>> I wrote code like below: But I am not sure how to schedule this. Could
>> you please guide me to configure this Scheduler (need bit more
>> elaborated steps). Thank you appreciate your help:
>> __
>> In Controller: SendEmail.py:
>> # -*- coding: utf-8 -*-
>> # try something like
>> from gluon.tools import Mail
>> def send_email():
>> mail = Mail()
>> #mail.settings.server = 'smtp.hitachiconsulting.com'
>> mail.settings.server = 'smtp.gmail.com:587'
>> mail.settings.sender = 'a...@example.com'
>> mail.settings.login = 'mytool...@gmail.com:123'
>> x = mail.send(
>>to = ['m...@gmail.com'], subject = 'hello',
>>reply_to = 'a...@example.com',
>>message = 'Hello ! How are you?'
>> )
>> if x:
>> nm="Sent Successfully";
>> else:
>> nm="failed";
>> _
>> In Controller: scheduler.py
>> from gluon.scheduler import Scheduler
>> # schedule recurring tasks:
>> def sched_tasks(arg1=""):
>>   # arg1 keeps this from being expose as a web page
>>   # instantiate Scheduler class
>> scheduler = Scheduler(db)
>> task = scheduler.queue_task("send_email", period = 86400, repeats=1)
>>   # show on console, or add to log
>> print task
>> db.commit()
>>
>> def stop_tasks(arg1=""):
>>   # arg1 keeps this from being expose as a web page
>>   # instantiate Scheduler class
>> scheduler = Scheduler(db)
>> task = scheduler.task_status(db.scheduler_task.task_name ==
>> 'send_email')
>> if hasattr(task, "status") and task.status in ["QUEUED", "RUNNING"]:
>> stop = scehduler.stop_task(task.uuid)
>>  # show on console or add to log
>> print cue
>> db.commit()
>> _
>>
>>
>> Please suggest me, next what I have to do , to schedule sending emails
>> 1 to 15 days and 16 to 30 days .
>>
>> Regards,
>> MC
>>
>>
>> On Wed, Aug 3, 2016 at 12:28 AM, Dave S  wrote:
>> >
>> >
>> > On Tuesday, August 2, 2016 at 10:51:36 AM UTC-7, madhu nomula wrote:
>> >>
>> >> Hi All,
>> >>
>> >> I need help on below requirement.
>> >>
>> >> We have implemented Time sheet  logging tool for users in web2py tool.
>> >>
>> >> Now the requirement is to send email notifications to the users of
>> >> tool,
>> >> to enter time sheet and submit.
>> >> This email has to be sent for all users from 1 to 15 days of month and
>> >> 16
>> >> to 30 days of month till the user submits time sheets.
>> >
>> >
>> > I am not sure what you mean here ... That twice a month you start
>> > nagging
>> > the users?  That's the easiest interpretation.  Also, I think, easy to
>> > do
>> > ... see below.
>> >
>> >>
>> >>
>> >> Please suggest, how can I schedule this sending emails option in Web2Py
>> >> tool.
>> >
>> >
>> > I recommend using the built-in scheduler.  This looks something like:
>> > (read about it at
>> >
>> > )
>> > (and note that this is untested, but based on my own scheduler usage and
>> > comments in this forum by Niphlod)
>> >
>> > in your model file (scheduler.py is a good name)
>> > # define scheduler task
>> >def send_nags(first_reminder = False):
>> >   if first_reminder or now.date in [1, 16]:
>> > db(db.staff.ALL).update(curts_recd = False)
>> >   mail = auth.settings.mailer
>> >   query = db.staff.curts_recd == False
>> >   rows = db(query)
>> >   for row in rows:
>> > msg = compose_reminder(row.id, ...)
>> > mail.send(to=row.email, reply_to="payroll@mybiz", message = msg)
>> >
>> > # instantiate Scheduler class
>> > from gluon.scheduler.import Scheduler
>> > scheduler = Scheduler(db)
>> >
>> >
>> > In one of your controller files:
>> > # schedule recurring tasks:
>> > def sched_tasks(arg1=""):
>> >   # arg1 

Re: [web2py] Re: Web2py tool : Send emails to multiple user on schedule basis

2016-08-16 Thread 黄祥
i think the sendemail.py should be in models
*models/SendEmail.py: *
# -*- coding: utf-8 -*- 
# try something like 
from gluon.tools import Mail 
def send_email(): 
  mail = Mail() 
  #mail.settings.server = 'smtp.hitachiconsulting.com' 
  mail.settings.server = 'smtp.gmail.com:587' 
  mail.settings.sender = 'a...@example.com' 
  mail.settings.login = 'mytool...@gmail.com:123' 
  x = mail.send( 
  to = ['m...@gmail.com'], subject = 'hello', 
  reply_to = 'a...@example.com', 
  message = 'Hello ! How are you?' 
  ) 
  if x: 
nm="Sent Successfully"; 
  else: 
nm="failed"; 

not sure what do you mean with to schedule sending emails 1 to 15 days and 
16 to 30 days, if you want to send email which is date is 1-15, i think you 
can use conditional if :
if request.now.day >= 1 and request.now.day <= 15:

best regards,
stifan

On Tuesday, August 16, 2016 at 6:26:33 PM UTC+7, madhu nomula wrote:
>
> Thanks Dave. 
>
> I wrote code like below: But I am not sure how to schedule this. Could 
> you please guide me to configure this Scheduler (need bit more 
> elaborated steps). Thank you appreciate your help: 
> __ 
> In Controller: SendEmail.py: 
> # -*- coding: utf-8 -*- 
> # try something like 
> from gluon.tools import Mail 
> def send_email(): 
> mail = Mail() 
> #mail.settings.server = 'smtp.hitachiconsulting.com' 
> mail.settings.server = 'smtp.gmail.com:587' 
> mail.settings.sender = 'a...@example.com ' 
> mail.settings.login = 'mytool...@gmail.com:123' 
> x = mail.send( 
>to = ['m...@gmail.com '], subject = 'hello', 
>reply_to = 'a...@example.com ', 
>message = 'Hello ! How are you?' 
> ) 
> if x: 
> nm="Sent Successfully"; 
> else: 
> nm="failed"; 
> _ 
> In Controller: scheduler.py 
> from gluon.scheduler import Scheduler 
> # schedule recurring tasks: 
> def sched_tasks(arg1=""): 
>   # arg1 keeps this from being expose as a web page 
>   # instantiate Scheduler class 
> scheduler = Scheduler(db) 
> task = scheduler.queue_task("send_email", period = 86400, repeats=1) 
>   # show on console, or add to log 
> print task 
> db.commit() 
>
> def stop_tasks(arg1=""): 
>   # arg1 keeps this from being expose as a web page 
>   # instantiate Scheduler class 
> scheduler = Scheduler(db) 
> task = scheduler.task_status(db.scheduler_task.task_name == 
> 'send_email') 
> if hasattr(task, "status") and task.status in ["QUEUED", "RUNNING"]: 
> stop = scehduler.stop_task(task.uuid) 
>  # show on console or add to log 
> print cue 
> db.commit() 
> _ 
>
>
> Please suggest me, next what I have to do , to schedule sending emails 
> 1 to 15 days and 16 to 30 days . 
>
> Regards, 
> MC 
>
>
> On Wed, Aug 3, 2016 at 12:28 AM, Dave S  
> wrote: 
> > 
> > 
> > On Tuesday, August 2, 2016 at 10:51:36 AM UTC-7, madhu nomula wrote: 
> >> 
> >> Hi All, 
> >> 
> >> I need help on below requirement. 
> >> 
> >> We have implemented Time sheet  logging tool for users in web2py tool. 
> >> 
> >> Now the requirement is to send email notifications to the users of 
> tool, 
> >> to enter time sheet and submit. 
> >> This email has to be sent for all users from 1 to 15 days of month and 
> 16 
> >> to 30 days of month till the user submits time sheets. 
> > 
> > 
> > I am not sure what you mean here ... That twice a month you start 
> nagging 
> > the users?  That's the easiest interpretation.  Also, I think, easy to 
> do 
> > ... see below. 
> > 
> >> 
> >> 
> >> Please suggest, how can I schedule this sending emails option in Web2Py 
> >> tool. 
> > 
> > 
> > I recommend using the built-in scheduler.  This looks something like: 
> > (read about it at 
> >  http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler>) 
> > (and note that this is untested, but based on my own scheduler usage and 
> > comments in this forum by Niphlod) 
> > 
> > in your model file (scheduler.py is a good name) 
> > # define scheduler task 
> >def send_nags(first_reminder = False): 
> >   if first_reminder or now.date in [1, 16]: 
> > db(db.staff.ALL).update(curts_recd = False) 
> >   mail = auth.settings.mailer 
> >   query = db.staff.curts_recd == False 
> >   rows = db(query) 
> >   for row in rows: 
> > msg = compose_reminder(row.id, ...) 
> > mail.send(to=row.email, reply_to="payroll@mybiz", message = msg) 
> > 
> > # instantiate Scheduler class 
> > from gluon.scheduler.import Scheduler 
> > scheduler = Scheduler(db) 
> > 
> > 
> > In one of your controller files: 
> > # schedule recurring tasks: 
> > def sched_tasks(arg1=""): 
> >   # arg1 keeps this from being expose as a web page 
> >   # instantiate Scheduler class 
> >   from gluon.scheduler.import Scheduler 
> >   scheduler = Scheduler(db) 
> >   task = scheduler.queue_task("send_nags", period = 86400, repeats=1) 
> >   # show on 

Re: [web2py] Re: Web2Py tool: Amazon SNS integration

2016-08-16 Thread madhu nomula
Thank you.

I am completely new to this area. Could you please share sample code
with configure steps for SNS and integration in to Web2py tool.
Yes, the changed/newly inserted/deleted data has to be pushed.

Regards,
MC.

On Wed, Aug 3, 2016 at 10:44 AM, Kiran Subbaraman
 wrote:
> Am assuming you are aware of the Amazon SNS APIs, and what it takes to
> publish messages there (as a producer / publisher)
> Do you want to read data from your database, and publish them to SNS on a:
> * Regular scheduled basis?
> * Whenever new data comes into the database?
>
> In either case, I would use two web2py capabilities to do this - the
> `_on_insert/update/delete` callbacks[1] in conjunction with the web2py
> scheduler to publish to SNS.
> The callback will help keep track of changes to the database (basically
> whenever the database data changes, these callbacks are called ... and you
> could record the changed value some place else ... maybe another table, or
> store). The scheduler would call the function that would read from this
> table/store and send this out to SNS.
>
> Adjust the timing of the scheduler, depending on when you want to send out
> the messages.
>
> [1]
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=insert#callbacks-on-record-insert--delete-and-update
>
>
>
> On Tuesday, August 2, 2016 at 11:21:39 PM UTC+5:30, madhu nomula wrote:
>>
>> Hi All,
>>
>> We have implemented a tool in web2py tool.
>>
>> Now we have to implement sending the stored data(tables information) to
>> Amazon SNS.
>>
>> Can you please help me how to move the stored data to Amazon SNS.
>>
>> Thank you and appreciate your help in advance.
>>
>>
>> Regards,
>> MC
>
> --
> 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.

-- 
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 tool : Send emails to multiple user on schedule basis

2016-08-16 Thread madhu nomula
Thanks Dave.

I wrote code like below: But I am not sure how to schedule this. Could
you please guide me to configure this Scheduler (need bit more
elaborated steps). Thank you appreciate your help:
__
In Controller: SendEmail.py:
# -*- coding: utf-8 -*-
# try something like
from gluon.tools import Mail
def send_email():
mail = Mail()
#mail.settings.server = 'smtp.hitachiconsulting.com'
mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = 'a...@example.com'
mail.settings.login = 'mytool...@gmail.com:123'
x = mail.send(
   to = ['m...@gmail.com'], subject = 'hello',
   reply_to = 'a...@example.com',
   message = 'Hello ! How are you?'
)
if x:
nm="Sent Successfully";
else:
nm="failed";
_
In Controller: scheduler.py
from gluon.scheduler import Scheduler
# schedule recurring tasks:
def sched_tasks(arg1=""):
  # arg1 keeps this from being expose as a web page
  # instantiate Scheduler class
scheduler = Scheduler(db)
task = scheduler.queue_task("send_email", period = 86400, repeats=1)
  # show on console, or add to log
print task
db.commit()

def stop_tasks(arg1=""):
  # arg1 keeps this from being expose as a web page
  # instantiate Scheduler class
scheduler = Scheduler(db)
task = scheduler.task_status(db.scheduler_task.task_name == 'send_email')
if hasattr(task, "status") and task.status in ["QUEUED", "RUNNING"]:
stop = scehduler.stop_task(task.uuid)
 # show on console or add to log
print cue
db.commit()
_


Please suggest me, next what I have to do , to schedule sending emails
1 to 15 days and 16 to 30 days .

Regards,
MC


On Wed, Aug 3, 2016 at 12:28 AM, Dave S  wrote:
>
>
> On Tuesday, August 2, 2016 at 10:51:36 AM UTC-7, madhu nomula wrote:
>>
>> Hi All,
>>
>> I need help on below requirement.
>>
>> We have implemented Time sheet  logging tool for users in web2py tool.
>>
>> Now the requirement is to send email notifications to the users of tool,
>> to enter time sheet and submit.
>> This email has to be sent for all users from 1 to 15 days of month and 16
>> to 30 days of month till the user submits time sheets.
>
>
> I am not sure what you mean here ... That twice a month you start nagging
> the users?  That's the easiest interpretation.  Also, I think, easy to do
> ... see below.
>
>>
>>
>> Please suggest, how can I schedule this sending emails option in Web2Py
>> tool.
>
>
> I recommend using the built-in scheduler.  This looks something like:
> (read about it at
> )
> (and note that this is untested, but based on my own scheduler usage and
> comments in this forum by Niphlod)
>
> in your model file (scheduler.py is a good name)
> # define scheduler task
>def send_nags(first_reminder = False):
>   if first_reminder or now.date in [1, 16]:
> db(db.staff.ALL).update(curts_recd = False)
>   mail = auth.settings.mailer
>   query = db.staff.curts_recd == False
>   rows = db(query)
>   for row in rows:
> msg = compose_reminder(row.id, ...)
> mail.send(to=row.email, reply_to="payroll@mybiz", message = msg)
>
> # instantiate Scheduler class
> from gluon.scheduler.import Scheduler
> scheduler = Scheduler(db)
>
>
> In one of your controller files:
> # schedule recurring tasks:
> def sched_tasks(arg1=""):
>   # arg1 keeps this from being expose as a web page
>   # instantiate Scheduler class
>   from gluon.scheduler.import Scheduler
>   scheduler = Scheduler(db)
>   task = scheduler.queue_task("send_nags", period = 86400, repeats=1)
>   # show on console, or add to log
>   print task
>   db.commit()
>
> # also add as needed
> def stop_tasks(arg1=""):
>   # arg1 keeps this from being expose as a web page
>   # instantiate Scheduler class
>   from gluon.scheduler.import Scheduler
>   scheduler = Scheduler(db)
>   task = scheduler.task_status(db.scheduler_task.task_name == 'send_nags')
>   if hasattr(task, "status") and task.status in ["QUEUED", "RUNNING"]:
>  stop = scehduler.stop_task(task.uuid)
>  # show on console or add to log
>  print cue
>  db.commit()
>
>
>
>
> Use  these from the command line like this:
> web2py.py -M -S uploader/default/sched_tasks
> or
> web2py.py -M -S uploader/default/stop_tasks
>
> (and of course, you've used the -K option earlier to start the scheduler ...
> you can add this to the startup sequence for your webserver)
>
>  See
>
> for more details.
>
>
> --
> 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 

[web2py] Re: Referencing a table in web2py before defining it

2016-08-16 Thread 黄祥
i think the error  related with auth definition is not found, perhaps 
because you define the employee table first and then (or not) auth 
definition.
pls try :

db = DAL(lazy_tables=True)

from gluon.tools import Auth, Service, PluginManager, prettydate
auth = Auth(db, host_names = myconf.get('host.names') )

auth.define_tables(username = False, signature = True)

db.define_table('employee',
Field('fullname','string',label='Name'),
Field('email','string'),
Field('phone','string'),
Field('kids', 'string'),
Field('phone', 'string'),
#Field('date','datetime'),
Field('dob', 'datetime', label='Date'),
Field('department', 'reference department',
  requires=IS_IN_DB(db, db.department.id, 
'%(department_name)s')),
auth.signature,
format='%(fullname)s'

)
db = DAL(lazy_tables=True)
db.define_table('department',
Field('department_name', 'string', label='Department Name'),
# Field('department_name', 'string', label='Department Name'),
Field('manager', 'reference employee', required='true',
  requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
auth.signature,
format='%(department_name)s'
)

as you can see on the example above, you define the db first, then the 
auth, after that pls proceed with another table you want to have in your 
apps.

best regards,
stifan

On Tuesday, August 16, 2016 at 3:35:14 PM UTC+7, Oasis Agano wrote:
>
> *I did this *
>
> db = DAL(lazy_tables=True)
> db.define_table('employee',
> Field('fullname','string',label='Name'),
> Field('email','string'),
> Field('phone','string'),
> Field('kids', 'string'),
> Field('phone', 'string'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date'),
> Field('department', 'reference department',
>
>   requires=IS_IN_DB(db, "department.id", 
> '%(department_name)s')),
> auth.signature,
> format='%(fullname)s'
>
> )
> #db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> # Field('department_name', 'string', label='Department Name'),
> Field('manager', 'reference employee',
>   requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
> auth.signature,
> format='%(department_name)s'
> )
>
> now im getting a complete different error
>
>raise KeyError('Cannot resolve reference %s in %s definition' % 
> (referenced, table._tablename))
> KeyError: 'Cannot resolve reference auth_user in employee definition'
>
>
> On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote:
>>
>> My code is the following im trying to assign a department to employees 
>> and also create a manager in a department table
>>
>> db = DAL(lazy_tables=True)
>> db.define_table('employee',
>> Field('fullname','string',label='Name'),
>> Field('email','string'),
>> Field('phone','string'),
>> Field('kids', 'string'),
>> Field('phone', 'string'),
>> #Field('date','datetime'),
>> Field('dob', 'datetime', label='Date'),
>> Field('department', 'reference department',
>>   requires=IS_IN_DB(db, db.department.id, 
>> '%(department_name)s')),
>> auth.signature,
>> format='%(fullname)s'
>>
>> )
>> db = DAL(lazy_tables=True)
>> db.define_table('department',
>> Field('department_name', 'string', label='Department Name'),
>> # Field('department_name', 'string', label='Department Name'),
>> Field('manager', 'reference employee', required='true',
>>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
>> auth.signature,
>> format='%(department_name)s'
>> )
>>
>>

-- 
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: Referencing a table in web2py before defining it

2016-08-16 Thread Oasis Agano
Is there any way of using 3-4 tables like emp,dept,emp_dept then 
dept_manager if yes can you show me how i can proceed 
Kind regards

On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote:
>
> My code is the following im trying to assign a department to employees and 
> also create a manager in a department table
>
> db = DAL(lazy_tables=True)
> db.define_table('employee',
> Field('fullname','string',label='Name'),
> Field('email','string'),
> Field('phone','string'),
> Field('kids', 'string'),
> Field('phone', 'string'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date'),
> Field('department', 'reference department',
>   requires=IS_IN_DB(db, db.department.id, 
> '%(department_name)s')),
> auth.signature,
> format='%(fullname)s'
>
> )
> db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> # Field('department_name', 'string', label='Department Name'),
> Field('manager', 'reference employee', required='true',
>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
> auth.signature,
> format='%(department_name)s'
> )
>
>

-- 
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: Referencing a table in web2py before defining it

2016-08-16 Thread Oasis Agano


*I did this *

db = DAL(lazy_tables=True)
db.define_table('employee',
Field('fullname','string',label='Name'),
Field('email','string'),
Field('phone','string'),
Field('kids', 'string'),
Field('phone', 'string'),
#Field('date','datetime'),
Field('dob', 'datetime', label='Date'),
Field('department', 'reference department',

  requires=IS_IN_DB(db, "department.id", 
'%(department_name)s')),
auth.signature,
format='%(fullname)s'

)
#db = DAL(lazy_tables=True)
db.define_table('department',
Field('department_name', 'string', label='Department Name'),
# Field('department_name', 'string', label='Department Name'),
Field('manager', 'reference employee',
  requires=IS_IN_DB(db, "employee.id", '%(fullname)s')),
auth.signature,
format='%(department_name)s'
)

now im getting a complete different error

   raise KeyError('Cannot resolve reference %s in %s definition' % (referenced, 
table._tablename))
KeyError: 'Cannot resolve reference auth_user in employee definition'


On Sunday, August 14, 2016 at 11:02:56 PM UTC+2, Oasis Agano wrote:
>
> My code is the following im trying to assign a department to employees and 
> also create a manager in a department table
>
> db = DAL(lazy_tables=True)
> db.define_table('employee',
> Field('fullname','string',label='Name'),
> Field('email','string'),
> Field('phone','string'),
> Field('kids', 'string'),
> Field('phone', 'string'),
> #Field('date','datetime'),
> Field('dob', 'datetime', label='Date'),
> Field('department', 'reference department',
>   requires=IS_IN_DB(db, db.department.id, 
> '%(department_name)s')),
> auth.signature,
> format='%(fullname)s'
>
> )
> db = DAL(lazy_tables=True)
> db.define_table('department',
> Field('department_name', 'string', label='Department Name'),
> # Field('department_name', 'string', label='Department Name'),
> Field('manager', 'reference employee', required='true',
>   requires=IS_IN_DB(db, db.employee.id, '%(fullname)s')),
> auth.signature,
> format='%(department_name)s'
> )
>
>

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