[web2py] Re: Web2py is Badly designed framework and Does not scale

2015-07-15 Thread Alex
I never understood why ORM should be better than the DAL. Actually I think 
it's the other way around. I worked with ORM for years and I'm really happy 
I can now use only DAL. It's very easy to get performance problems with ORM 
when all references are automatically fetched, and then those references 
can trigger even more selects for their own references and so on... Usually 
we ended up to manually generate our selects and then just fill in the 
class instances. This approach can be done with DAL as well (and it should 
be much easier) - if someone needs entities.

-- 
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] Pass html in label of SQLFORM.factory Field without it by sanitized

2015-07-15 Thread Thomas Sitter
Hello,

I am trying to pass HTML from my controller in a SQLFORM.factory but it 
keeps getting sanitized

form = SQLFORM.factory(
Field('install_consent', 'boolean', 
label='I consent for  to provide my contact information to ___. 
strongI confirm that my house DOES NOT have aluminium siding. */strong',
requires=IS_NOT_EMPTY('You must provide consent in order to recieve the 
equipment')
)
)

Is there anyway to do this?

Thanks for the help.

-- 
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] expand_one not working anymore?

2015-07-15 Thread Samuel Sowah
currently, when I use autolinks' expand_one, I don't get youtube videos 
rendering anymore, or anything for that matter, not even files. it just 
turns the urls into anchor links. something I'm 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: using PyCharm

2015-07-15 Thread Alex
web2py runs fine :) I never had serious problems with it. Here is a list of 
some PyCharm web2py issues:

https://youtrack.jetbrains.com/issue/PY-10810
reported by Richard - if this would be solved then I could probably live 
with the other issue reported by me:
https://youtrack.jetbrains.com/issue/PY-15309
and I found another issue which addresses the same problem (I think):
https://youtrack.jetbrains.com/issue/PY-16070

maybe you can help them somehow so they can fix it faster. But for me it 
looks like they are not even interested in fixing it.

I think it would be good if more web2py PyCharm users would add comments 
and votes to those issues. Maybe then they will be taken more seriously.

Alex

Am Mittwoch, 15. Juli 2015 10:31:18 UTC+2 schrieb Massimo Di Pierro:

 Oh! I thought you were talking a web2py issue. Our turnaround is much 
 faster that that. That is a PyCharm issue. Next time if file an issue with 
 them about web2py, you may want to also open a web2py issue so we can be 
 proactive and help them resolve it.

 On Tuesday, 14 July 2015 17:34:28 UTC-5, Alex wrote:

 https://youtrack.jetbrains.com/issue/PY-13794

 Am Mittwoch, 15. Juli 2015 00:16:08 UTC+2 schrieb Massimo Di Pierro:

 Which  issue took 6 months?

 On Tuesday, 14 July 2015 14:59:15 UTC-5, Alex wrote:

 I added a comment to this issue. I hope they'll address this soon. But 
 actually I doubt it, last time I reported an even more serious web2py 
 issue 
 it took them over 6 months until they fixed it...
 I also don't think moving the applications folder out of web2py will 
 work, it will probably lead to the same issue.

 Alex



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


Re: [web2py] Re: using PyCharm

2015-07-15 Thread Massimo Di Pierro
Oh! I thought you were talking a web2py issue. Our turnaround is much 
faster that that. That is a PyCharm issue. Next time if file an issue with 
them about web2py, you may want to also open a web2py issue so we can be 
proactive and help them resolve it.

On Tuesday, 14 July 2015 17:34:28 UTC-5, Alex wrote:

 https://youtrack.jetbrains.com/issue/PY-13794

 Am Mittwoch, 15. Juli 2015 00:16:08 UTC+2 schrieb Massimo Di Pierro:

 Which  issue took 6 months?

 On Tuesday, 14 July 2015 14:59:15 UTC-5, Alex wrote:

 I added a comment to this issue. I hope they'll address this soon. But 
 actually I doubt it, last time I reported an even more serious web2py issue 
 it took them over 6 months until they fixed it...
 I also don't think moving the applications folder out of web2py will 
 work, it will probably lead to the same issue.

 Alex



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


[web2py] websocket_messaging.py does not work out of the box

2015-07-15 Thread jackson . read
I tried to setup a simple websocket to try and learn the concept so I can 
use it in my app. I took the instructions in websocket_messaging.py and 
built the following minimal app.  I am on debian squeeze using chromium and 
tornado 4.2.. I started websocket_messaging.py as per the instructions: *python 
gluon/contrib/websocket_messaging.py -k mykey -p *. When I enter some 
test into the index controller form I see it in the terminal that I 
started websocket_messaging.py in but I do not see a flash alert in the 
websocket_receiver viewAm I missing something in the concept?  is it a 
browser problem?..any help would be greatly appreciated

*Controller:*

*default.py* 

def index():
form=LOAD('default', 'ajax_form', ajax=True)
script=SCRIPT('''
jQuery(document).ready(function(){
  var callback=function(e){alert(e.data)};
 
 if(!$.web2py.web2py_websocket('ws://127.0.0.1:/realtime/mygroup', 
callback))
alert(html5 websocket not supported by your browser, try 
Google Chrome);
});
''')
return dict(form=form, script=script)

def ajax_form():
form=SQLFORM.factory(Field('message'))
if form.accepts(request,session):
from gluon.contrib.websocket_messaging import websocket_send
websocket_send(
'http://127.0.0.1:', form.vars.message, 'mykey', 
'mygroup')
return form

def websocket_receiver():
return dict()

*Views:*

*index.html*

{{extend 'layout.html'}}
WEBSOCKET TEST:
{{=form}}
{{=script}}

*websocket_receiver.html*

{{extend 'layout.html'}}
h1This is the receiver.html template/h1

script
   $(document).ready(function(){
  if(!$.web2py.web2py_websocket('ws://127.0.0.1:/realtime/mygroup', 
function(e){alert(e.data)}))
 alert(html5 websocket not supported by your browser, try Google 
Chrome);
   });
/script





-- 
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: Query and Manage profiles

2015-07-15 Thread Daniel Dos Santos Guilhermino
Dear Stifan,

Thank you for your comment, I will try to follow your suggestion, 
using SQLFORM.grid (CRUDS).

Where are you from, China or Japan?

Best regards,

On Tuesday, July 14, 2015 at 9:46:15 AM UTC-3, 黄祥 wrote:

 I would like to deploy the Company to work a form  query where employees 
 create requests for certain departments , and these departments must 
 respond to these requests. How best to work ? Using SQLform or Form ? 


 please start from simple first, after it run well, then go ahead to make 
 it complex, the simple way to have it work is using SQLFORM.grid (CRUDS)
  


 We will need two profiles of users, developers and  departments  , how 
 to manage this profile ? 


 just create it in auth_groups (users, developers and departments), after 
 that assign the user (auth_users) to it's own group

 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] Temp file with own name

2015-07-15 Thread reddyreddy
Hello all,

I have a script which writes the output to a file.
Now I want to make this file temporary that means when I close it it should 
deleted..but I do not want to change the name of the file.  How can I do this?
Thanks in advance.q

-- 
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 and OODBMS?

2015-07-15 Thread Esteban Bulutsuzku
Hello,

I am an experienced OOP programmer. I -fortunately- do not use relational 
technology anymore, so I won't plan get back to write SQL/RDBMS/ORM stuff 
(I really don't care if the relational math theory + ISO/IEC 9075-1 backs 
the stack). This could sound like a rare use case for you, but it is not if 
you use actively other systems (Java, db4o, GemStone, etc) where you can 
have nested complex designs with navigational access to data, dynamic class 
definitions, class extensions, etc. Also if you don't ever plan to use an 
OODBMS, sometimes is desirable to delay the need to hook up a database 
during development, or ever forever ;)

But I am dissapointed, because after hearing a lot about web2py I still 
have not found how to work with web2py with an OODBMS (any of them). It 
seems that web2py is tied to RDBMS (which to me is technology from 1970's 
but that's another story).

Maybe most python devs have experience with flat simple tabular data 
models, it could also be the case that Python file-orientation promotes 
more scripting approach than object-technology, and I am not criticizing 
you but in my case I already have a rich object model (is *NOT* NoSQL) and 
I am giving web2py a chance. 

But it seems there is few to none documentation of web2py + OODBMS, i.e. 
how to use the DAL with a OODMS backend.

Is web2py still valid for my use-case?
Anyone working with OODBMS and web2py?

Thanks,
Cheers,

Esteban

-- 
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: Query and Manage profiles

2015-07-15 Thread Daniel Dos Santos Guilhermino
Dear Richard,

Thank you for your comment, I just read and saw website Odoo, Good suggest!

I had an idea when a I visit Odoo, Is possible We adapt CRM for purchase 
department, precisely for quotes? Let explain my idea:

I will create a user for the buyer of the Company. It will request that the 
vendor companies to enroll on our website to participate in quotes. We will 
have two profiles: Buyer and Seller.

Sellers are separated by departments such as services, consumer and etc.

When the buyer need to make a quotation, it will complete the form with the 
request, select the department and submit,

The system will automatically send the form to sellers that department, 
inviting them to participate in the quote.

We need to create a room of quotations, where the buyer has access to the 
suppliers answers.

It is different from Odoo, we have to register the suppliers, in this case, 
they will be invited to participate.

I dont know if I was clear on my explanation, What you think about?

Best regards,

Daniel - From Brazil!

On Tuesday, July 14, 2015 at 10:23:06 AM UTC-3, Richard wrote:

 I would suggest if you need CRM functionnality that you have a look to the 
 existing open source project, let say Odoo (OpenERP) which contain an CRM 
 module and planty of orther thing... There is a Docker Odoo package that 
 may help you deploy it rapidly for testing...

 Richard

 On Tue, Jul 14, 2015 at 8:46 AM, 黄祥 steve.van...@gmail.com javascript: 
 wrote:

 I would like to deploy the Company to work a form  query where 
 employees create requests for certain departments , and these departments 
 must respond to these requests. How best to work ? Using SQLform or Form ? 


 please start from simple first, after it run well, then go ahead to make 
 it complex, the simple way to have it work is using SQLFORM.grid (CRUDS)
  


 We will need two profiles of users, developers and  departments  , how 
 to manage this profile ? 


 just create it in auth_groups (users, developers and departments), after 
 that assign the user (auth_users) to it's own group

 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+un...@googlegroups.com javascript:.
 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: Another online store based in web2py+ractive+stripe

2015-07-15 Thread icodk
I think www.tindie.com has a very nice interface. Specifically, where you 
can add to cart you can also inc/dec quantity

On Tuesday, July 14, 2015 at 6:44:29 PM UTC+2, Massimo Di Pierro wrote:

 I made another simple online store: https://github.com/mdipierro/estore3

 Can you help me test, suggest improvement, add features?

 Taxes and shipping logic are missing.

 All the code is in models/db.py, controllers/default.py, and 
 views/default/index.html so it is very simple and easy to improve.


-- 
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: questions about autocomplete widget

2015-07-15 Thread Massimo Di Pierro
On Tuesday, 14 July 2015 19:34:50 UTC-5, 黄祥 wrote:

 is it possible to have the query in sqlform.autocomplete.widgets?
 *e.g. no error occured but the result is not expected*
 table.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.keywords, id_field = db.customer.id, db = 
 db(db.customer.keywords.contains(request) ) )


this should work. What you mean by result is not expected?
 


 *e.g. an error occured*
 table.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.keywords, id_field = db.customer.id, db = 
 db(db.customer.keywords.contains(r) for r in request) )
 error :


This could be

q = reduce(lambda a,b: a|b, [db.customer.keywords.contains(r) for r in 
request])
widget = SQLFORM.widgets.autocomplete(request, db.customer.keywords, 
id_field = db.customer.id, db = db(q))

But I against using the autocomplete this way. Accessing the database every 
time you use the autocomplete is a big bottle neck. The best way it compile 
a cached dictionary of ids and corresponding words and than use the cached 
list instead of the db.


 

 Error snapshot [image: help] 
 https://127.0.0.1/admin/default/ticket/delivery/127.0.0.1.2015-07-15.07-33-12.3ccf3534-b59c-403b-b0b0-3f1f6fae9dc6#
  

 class 'sqlite3.OperationalError'(near : syntax error) 


 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: questions about autocomplete widget

2015-07-15 Thread 黄祥


 is it possible to have the query in sqlform.autocomplete.widgets?
 *e.g. no error occured but the result is not expected*
 table.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.keywords, id_field = db.customer.id, db = 
 db(db.customer.keywords.contains(request) ) )


 this should work. What you mean by result is not expected?


the autocomplete didn't work at all, not shown any suggestion even i input 
with full customer name
e.g.
customer name : customer
normal work : type cu (show suggestion)
result is not expected : type custom (not show any suggestion)
 

  


 *e.g. an error occured*
 table.customer.widget = SQLFORM.widgets.autocomplete(request, 
 db.customer.keywords, id_field = db.customer.id, db = 
 db(db.customer.keywords.contains(r) for r in request) )
 error :


 This could be

 q = reduce(lambda a,b: a|b, [db.customer.keywords.contains(r) for r in 
 request])
 widget = SQLFORM.widgets.autocomplete(request, db.customer.keywords, 
 id_field = db.customer.id, db = db(q))

 But I against using the autocomplete this way. Accessing the database 
 every time you use the autocomplete is a big bottle neck. The best way it 
 compile a cached dictionary of ids and corresponding words and than use the 
 cached list instead of the db.


any example how to accomplished it (compile a cached dictionary of ids and 
corresponding words and than use the cached list) with web2py?

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: Always send a custom HTTP header with web2py responses

2015-07-15 Thread Massimo Di Pierro
Good point. Please open a ticket. There is no way to do this now.

On Wednesday, 15 July 2015 01:52:55 UTC-5, Saifuddin Rangwala wrote:

 Hi,

 I would like to a custom http header X-APP-VERSION alongwith all 
 the web2py responses.

 For 200 OK I do it using code below in the models file:

 response.headers[X-APP-VERSION] = config.version

 However, I would like to send this header for all error cases as well 
 including the unexpected errors like 500 Internal Server Error.

 Is there a good way to accomplish this?


 -- 
 Thanks,
 -Saif.
  

-- 
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: Temp file with own name

2015-07-15 Thread Massimo Di Pierro
https://docs.python.org/2/library/tempfile.html

On Wednesday, 15 July 2015 03:29:03 UTC-5, reddyreddy wrote:

 Hello all, 

 I have a script which writes the output to a file. 
 Now I want to make this file temporary that means when I close it it 
 should deleted..but I do not want to change the name of the file.  How can 
 I do this? 
 Thanks in advance.q

-- 
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] Always sending a custom HTTP header regardless of error or success

2015-07-15 Thread Saifuddin Rangwala
Hi,

I would like to a custom http header X-APP-VERSION alongwith all 
the web2py responses.

For 200 OK I do it using code below in the models file:

response.headers[X-APP-VERSION] = config.version

However, I would like to send this header for all error cases as well 
including the unexpected errors like 500 Internal Server Error.

Is there a good way to accomplish this?

-- 
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: prettydate ago is not translated

2015-07-15 Thread Maxim Hrustalev
Don't you try ti access attribute 'year' of your prettydated expire_date 
somewhere in your code?

On Sunday, July 12, 2015 at 12:10:09 PM UTC+3, icodk wrote:

 Thanks Maxim,
 I tried :
 db.place.expire_date.represent= lambda value,row: prettydate(value,T=T)
 The problem is that I get the following error
 type 'exceptions.AttributeError' 'str' object has no attribute 'year'
 The field is defined as:

 Field('expire_date','datetime',label=T('expire_date'),writable=False,default=request.now)
 If I don't add the T=T it works fine (but not translate:-(


 On Saturday, July 11, 2015 at 3:24:03 PM UTC+2, Maxim Hrustalev wrote:

 To translate prettydate output  you have to pass translation function as 
 argument: prettydate(my_date, T=T).

 On Wednesday, July 8, 2015 at 12:40:55 AM UTC+3, icodk wrote:

 Thanks for your help.
 My editor (web2py web interface, Notepad++,Visual Studio) should be able 
 to find 'ago' in any sentence combination. It also found '%d weeks ago' 
 as I wrote below so I can't see any reason why it should not find  %d 
 hours ago unless it is not there. May be I am looking in the wrong 
 file-but everything else works fine(I mean the other translations).


 On Monday, July 6, 2015 at 8:10:39 AM UTC+2, xmarx wrote:

 you must look up the %d weeks ago, %d hours ago, %d months ago 
 phrases. 
 not just ago. because i think item that be translated is T(%d days 
 ago). not T(ago). i don't know its detail.

  In addition I can only find '%d weeks ago': '%d uge siden', in my 
 language file.


 this translate  used to be work. didn't it?

 2015-07-05 1:49 GMT+03:00 icodk i...@alpiron.com:

 There are two issues here, the first is that 'ago' it is NOT in my 
 language file and if you look in  gluon/tools.py you will see that 
 suffix = ' ago ' and NOT  suffix = T(' ago') . Anyway this is in my 
  gluon/tools.py file.
 OK I replaced  it with:  suffix = T(' ago') .which should be part of 
 the web2py in the first place or I am missing something.

 The second issue is that even if I replaced it as above I still can't 
 find 'ago' in my language file. In addition I can only find '%d weeks 
 ago': '%d uge siden', in my language file. Nothing else from prettydate 
 function in my language file.
 What am I doing wrong ?
 Thanks





 On Saturday, July 4, 2015 at 1:45:24 PM UTC+2, icodk wrote:

 Is there any reason why the 'ago' is not translate in 
 prettydate  (gluon/tools.py) ?

 *suffix = ' ago'* instead of:
 *suffix = ** T( ago)*

 In Danish that will be translated to: 'siden'
 Also I can't find the other strings in my language file
 T('1 year' + suffix)
 T('1 month' + suffix)
 etc.

 I can only find:
 %d weeks ago




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




 -- 
 Selman Kocael
 İsabet Yayınları

 

-- 
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: Another online store based in web2py+ractive+stripe

2015-07-15 Thread Massimo Di Pierro
Oops I added the missing file.

private/appconfig.ini

On Tuesday, 14 July 2015 18:50:58 UTC-5, 黄祥 wrote:

 great. btw it raise an error :
 Error snapshot [image: help] 
 https://127.0.0.1/admin/default/ticket/estore/127.0.0.1.2015-07-15.06-49-17.32099d19-bccc-43f3-b2f6-77197a15e972#
  

 type 'exceptions.BaseException'(Config file not found) 

 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: Another online store based in web2py+ractive+stripe

2015-07-15 Thread Massimo Di Pierro
You can do it here. The more times you click the more items you put the in 
the cart. If you edit the numbers in cart, everything changes in realtime 
without need to submit.

On Wednesday, 15 July 2015 03:29:02 UTC-5, icodk wrote:

 I think www.tindie.com has a very nice interface. Specifically, where you 
 can add to cart you can also inc/dec quantity

 On Tuesday, July 14, 2015 at 6:44:29 PM UTC+2, Massimo Di Pierro wrote:

 I made another simple online store: https://github.com/mdipierro/estore3

 Can you help me test, suggest improvement, add features?

 Taxes and shipping logic are missing.

 All the code is in models/db.py, controllers/default.py, and 
 views/default/index.html so it is very simple and easy to improve.



-- 
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 OODBMS?

2015-07-15 Thread Massimo Di Pierro
web2py include pydal and pydal is an API for accessing RDBMs and some NoSQL 
engines. This is not your use case.

web2py does not include a OODBM but nothing prevent you from accessing one 
and take advantage of all the other features. You simply would not do it 
through the DAL. The reason is that there is no standardize API for 
accessing OODBMs. Every one of them is different and every one has its own 
set of APIs.

So for example in the python world a popular one is ZODB. You can install 
ZODB and use it with web2py. I do not expect any problem but I never tried 
it. There are other OODBMs which you can use from python. If they work with 
Python, they work with web2py.

That said. I disagree that OODBMs are the future and SQL is the past for 
two reasons: SQL databases are still widely more popular and more scalable. 
It is possible to build a OODBM on top of SQL database, and in fact, if 
time permits, I would like to build one on top of the web2py dal.


On Wednesday, 15 July 2015 03:29:04 UTC-5, Esteban Bulutsuzku wrote:

 Hello,

 I am an experienced OOP programmer. I -fortunately- do not use relational 
 technology anymore, so I won't plan get back to write SQL/RDBMS/ORM stuff 
 (I really don't care if the relational math theory + ISO/IEC 9075-1 backs 
 the stack). This could sound like a rare use case for you, but it is not if 
 you use actively other systems (Java, db4o, GemStone, etc) where you can 
 have nested complex designs with navigational access to data, dynamic class 
 definitions, class extensions, etc. Also if you don't ever plan to use an 
 OODBMS, sometimes is desirable to delay the need to hook up a database 
 during development, or ever forever ;)

 But I am dissapointed, because after hearing a lot about web2py I still 
 have not found how to work with web2py with an OODBMS (any of them). It 
 seems that web2py is tied to RDBMS (which to me is technology from 1970's 
 but that's another story).

 Maybe most python devs have experience with flat simple tabular data 
 models, it could also be the case that Python file-orientation promotes 
 more scripting approach than object-technology, and I am not criticizing 
 you but in my case I already have a rich object model (is *NOT* NoSQL) and 
 I am giving web2py a chance. 

 But it seems there is few to none documentation of web2py + OODBMS, i.e. 
 how to use the DAL with a OODMS backend.

 Is web2py still valid for my use-case?
 Anyone working with OODBMS and web2py?

 Thanks,
 Cheers,

 Esteban



-- 
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: What if Massimo got hit by a Bus?

2015-07-15 Thread Michele Comitini
Massimo recently had a little accident with the byke, the consequence was a
huge increase in his contributions.  Not that I am wishing him an accident
with a truck, but if we make a linear projection ;-)

2015-07-15 7:00 GMT+02:00 Kiran Subbaraman subbaraman.ki...@gmail.com:

 Well, someone couldn't let reassurances stand in the way of science:
 http://mtov.github.io/Truck-Factor/
 Wonder what the truck-factor for web2py is ;)




 On Thursday, May 26, 2011 at 8:18:51 PM UTC+5:30, Massimo Di Pierro wrote:

 LOL...

 What if the CEO of a company gets hit by a bus? They get another CEO!

 I can assure there are many web2py experts on this list
 http://web2py.com/examples/default/who.html

 I also have a will with some instructions about relinquishing
 trademark rights and control over web2py.com to other list members.
 I assure you do not need me. ;-)

 Massimo



 On May 26, 9:15 am, Bob Blanchett bob.blanch...@gmail.com wrote:
  I just read this presentation by by GvR/BDFL
 http://mvdirona.com/jrh/TalksAndPapers/GuidoVanRossum_21_years_of_pyt...on
 21 years of Python and wondered for Web2py  as  some
  one did  for Python
 http://www.python.org/search/hypermail/python-1994q2/1040.htmlin 1994.
 
  What if the worst happened to Massimo (God Forbid) ?
 
  The Technology Selection Risks etc etc..
 
  Yours in no way Gruesomely,
 
  Bob

  --
 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: Invalid password reset

2015-07-15 Thread Massimo Di Pierro
Can you please post the list of steps to reproduce? We will fix it asap.

On Wednesday, 15 July 2015 01:42:39 UTC-5, Annet wrote:


 This would happen if the user has already clicked the link.


 This also happens when clicking the link for the very first time,
 I noticed this after upgrading to version 2.10.

 Kind regards,

 Annet 


-- 
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: websocket_messaging.py -t question

2015-07-15 Thread Massimo Di Pierro
This logic was added somewhat recently and I did not test it myself but 
reading the code it seems it should work this way:

1) run websocket_messaging.py  -t to enable the token message
2) post a message to the /token API with a message containing a made up 
UUID token. This will create a token on the server
3) when connecting instead of 

   ws://127.0.0.1:/realtime/mygroup


use


   ws://127.0.0.1:/realtime/mygroup/token


because of -t , the token must match one of the registered token and no 
other client must be using it for a connection. Notice that in 2 the /token 
api is meant to be called by the web2py server. Works like the post 
handler. The message is supposed to be created and signed using the server 
password.


The idea is when a new cllient accesses the web app, the server create a on 
time token for that client, gives it to the client (via normal web2py 
means, embedding in the pages, etc.) and registers it with the 
websocket_server. The latter then checks the token when the client tries to 
connect. 

On Tuesday, 14 July 2015 20:54:32 UTC-5, Samuel Sowah wrote:

 Can someone please explain how to use websocket_messaging.py properly with 
 tokens?


-- 
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] Always send a custom HTTP header with web2py responses

2015-07-15 Thread Saifuddin Rangwala
Hi,

I would like to a custom http header X-APP-VERSION alongwith all
the web2py responses.

For 200 OK I do it using code below in the models file:

response.headers[X-APP-VERSION] = config.version

However, I would like to send this header for all error cases as well
including the unexpected errors like 500 Internal Server Error.

Is there a good way to accomplish this?


-- 
Thanks,
-Saif.

-- 
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: Invalid password reset

2015-07-15 Thread Annet


 This would happen if the user has already clicked the link.


This also happens when clicking the link for the very first time,
I noticed this after upgrading to version 2.10.

Kind regards,

Annet 

-- 
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: Another online store based in web2py+ractive+stripe

2015-07-15 Thread Ramkrishan Bhatt
Its faar better and improved version of previous estore. I have gone 
through i would love to do some operation over it :)

On Tuesday, 14 July 2015 22:14:29 UTC+5:30, Massimo Di Pierro wrote:

 I made another simple online store: https://github.com/mdipierro/estore3

 Can you help me test, suggest improvement, add features?

 Taxes and shipping logic are missing.

 All the code is in models/db.py, controllers/default.py, and 
 views/default/index.html so it is very simple and easy to improve.


-- 
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: module vs plugin

2015-07-15 Thread Fabiano Almeida
Hi Anthony,

I think add plugins to build a system. Eg customer registration, product
registration, shopping trolley, service order, reports, etc.

thks

Fabiano.

-- 
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] Web2py is Badly designed framework and Does not scale

2015-07-15 Thread António Ramos
Look in the right side  under activity .
You will see Bruno saying  it...

Am i wrong too ?

2015-07-15 18:30 GMT+01:00 Anthony abasta...@gmail.com:

 I don't see where the second con is attributed to Bruno - no source is
 listed for that one.

 --
 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] Web2py is Badly designed framework and Does not scale

2015-07-15 Thread Samuel Sowah


On Wednesday, July 15, 2015 at 5:54:13 PM UTC, Ramos wrote:

 Look in the right side  under activity .
 You will see Bruno saying  it...

 
That's an upvote, doesn't say he's not the source...


 Am i wrong too ?

 2015-07-15 18:30 GMT+01:00 Anthony abas...@gmail.com javascript::

 I don't see where the second con is attributed to Bruno - no source is 
 listed for that one.

 --
 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 javascript:.
 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] Web2py is Badly designed framework and Does not scale

2015-07-15 Thread Anthony
I don't see where the second con is attributed to Bruno - no source is listed 
for that one.

-- 
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] Web2py is Badly designed framework and Does not scale

2015-07-15 Thread Anthony
On Wednesday, July 15, 2015 at 1:54:13 PM UTC-4, Ramos wrote:

 Look in the right side  under activity .
 You will see Bruno saying  it...


Got it -- that is not visible in the mobile view.

-- 
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: websocket_messaging.py -t question

2015-07-15 Thread Massimo Di Pierro
The -t options does not take an argument. There are two security 
mechanisms. The key and the token. The key is unique and required. It is 
used to encrypt communications bewteen the web2py server and the websocket 
server. You set a key with -k key. The token mechanism is optional. It is 
enabled with -t and it is designed to prevent arbitrary clients to connect 
to the websocket. Each client must have a unique token and pass it in the 
ws:// connection string when it connects. If it up to you to make up 
tokens. They can be random numbers, uuid, etc. You have to give a token to 
the clients and you have to register the tokens with websocket_server via 
the /token api.

On Wednesday, 15 July 2015 08:51:18 UTC-5, Samuel Sowah wrote:



 On Wednesday, July 15, 2015 at 8:53:35 AM UTC, Massimo Di Pierro wrote:

 This logic was added somewhat recently and I did not test it myself but 
 reading the code it seems it should work this way:

 1) run websocket_messaging.py  -t to enable the token message
 2) post a message to the /token API with a message containing a made up 
 UUID token. This will create a token on the server
 3) when connecting instead of 

ws://127.0.0.1:/realtime/mygroup


 use


ws://127.0.0.1:/realtime/mygroup/token


 because of -t , the token must match one of the registered token and no 
 other client must be using it for a connection. Notice that in 2 the /token 
 api is meant to be called by the web2py server. Works like the post 
 handler. The message is supposed to be created and signed using the server 
 password.


 The idea is when a new cllient accesses the web app, the server create a 
 on time token for that client, gives it to the client (via normal web2py 
 means, embedding in the pages, etc.) and registers it with the 
 websocket_server. The latter then checks the token when the client tries to 
 connect. 


 I don't understand how this happens? The token that I use to start the 
 websocket_messaging.py via -t option, that token doesn't change, so which 
 token does the server create to give to the client, and how does it 
 register it with the websocket_server. Are the tokens unique for each 
 client? and if so how are they generated and registered to allow 
 communication? how different is the token for the -t option from the token 
 the server creates? I'm a bit confused how to use this. The english makes 
 sense but the technicality behind it is still fuzzy. Like, from what I 
 understand, the server creates a token when the client first connects and 
 gives it to the client. when the client tries to send messages via the 
 websocket, it has to add the token to the message via 
 url/realtime/group/token. I still don't know how to implement this (if 
 that's what you're saying even means.

 A simple chat app implementing just this can help my understanding, I'm 
 only asking. But some further explanation will also do until I can 
 understand.
 Thanks.
  

 On Tuesday, 14 July 2015 20:54:32 UTC-5, Samuel Sowah wrote:

 Can someone please explain how to use websocket_messaging.py properly 
 with tokens?



-- 
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] bootstrap select writable = False

2015-07-15 Thread Annet
When I set writable = False on a field that is being rendered as a select
it does not comply with Bootstraps disabled state for disabled selects:

http://getbootstrap.com/css/#forms-control-disabled

div class=form-group
  label for=disabledSelectDisabled select menu/label
  select id=disabledSelect class=form-control
optionDisabled select/option
  /select/div


What I get instead is:

div id=nav_vertex_navID__row class=form-group
  label id=nav_vertex_navID__label class=control-label 
for=nav_vertex_navIDDisabled select menu/label
Disabled select/div


which does look rather ugly. Is it possible ti fix this issue?


Kind regards,

Annet

-- 
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: Invalid password reset

2015-07-15 Thread Annet


 Can you please post the list of steps to reproduce? We will fix it asap.


I extended the auth_user table with username:

auth.settings.extra_fields['auth_user']= [
  Field('username', length=32, default='', requires=[IS_LENGTH(32, 
error_message='Lengte overschreidt 32 tekens'), 
IS_NOT_EMPTY(error_message='Vul gebruikersnaam in'), IS_NOT_IN_DB(db, 
'auth_user.username', error_message='Gebruikersnaam al in database')], 
notnull=True, unique=True, label='Gebruikersnaam * ', writable=False, 
readable=False)]


In the default/user view I have the following link:

a href={{=URL(args='request_reset_password')}}Reset password/a

When I click the link, enter my username in the form and submits the form, 
I get a
mail with the following link:

https://www.leonexus.nl/my/default/user/reset_password/1436942252-fffb0ed4-dec2-4ae6-93a1-19355abc13ac
 
http://127.0.0.1:8000/my/default/user/reset_password/1436942252-fffb0ed4-dec2-4ae6-93a1-19355abc13ac

 When I click the link I am redirected to /my/default/user/login and the 
flash displays the message:

invalid reset password

I hope I provided sufficient information to fix the issue.


Kind regards,

Annet

-- 
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 is Badly designed framework and Does not scale

2015-07-15 Thread Anthony
On Wednesday, July 15, 2015 at 1:20:11 PM UTC-4, Matheus Cardoso wrote:

 In Slant.com 
 http://www.slant.co/topics/426/viewpoints/4/~what-are-the-best-general-purpose-python-web-frameworks-usable-in-production-sites~web2py
  we 
 have some Python Frameworks under criticism. One of them is web2py. But I 
 got stunned when I saw two great cons:

 - Badly designed framework


*Globally defined variables,*

There are a small number of core API objects that are available in the 
web2py execution environment (i.e., models, views, and controllers). This 
avoids the need for a lot of boilerplate import code for widely used 
objects. There is no explanation as to why this should be considered bad 
or what problems it causes.

*no real object-oriented design*

This is obviously false, as most of the framework follows an object 
oriented design. Even if it were true, though, there is no explanation as 
to why that would therefore qualify as bad design (e.g., some frameworks 
take a more functional approach, which can also be good design).

*and basically everything is all over the place.*

Hard to respond to such a vague claim with nothing to back it up.

The source article cited raises some additional concerns, most of which are 
incorrect or overblown:

*web2py doesn't support unit testing*

It does, though does take a little extra setup work to make it work with 
models and controllers. This is a legitimate criticism, though much easier 
to overcome than implied in the article.

*The error message for a syntax error or coding errors in web2py is 
ambiguous **(try doing a mistake in the model) that's because web2py takes 
your code and merges it into larger file to run*

This is incorrect. Perhaps the author is referring specifically to view 
templates, which are first converted to Python code -- when there is an 
error, the ticket shows the Python code, not the original template code, 
but this can actually make debugging easier because it is easier to see the 
structure of the code that was executed (and it is usually not difficult to 
find the associated line in the original template).

*In development mode this is a headache, I really need to see the error 
instantly and not to see a ticket number!*

While this is true, there is an easy workaround 
http://stackoverflow.com/a/7094917/440323.

*but remains the way you define the tables and fields a completely 
functional (not OO)*

It's true that web2py does not have an ORM, and you do not define models by 
creating a Python class. However, the author fails to explain why the 
class-based approach is superior. Most of the functionality you would get 
with an ORM class you can also achieve with the DAL's virtual fields, table 
methods, and other functionality.

*web2py has really poor IDE support and you cannot use standard python 
development tools without modifications*

This is a legitimate criticism, though overstated, as there are workarounds 
to allow web2py to work with such tools (and several IDE's come with 
built-in web2py support).

- Does not scale


I think Bruno is conflating *scalability* and *efficiency*. *Scalability* 
refers to the ease with which an application can be made to serve more 
requests by simply adding more hardware resources. In that regard, it is 
just as easy to scale web2py as any similar type of framework. So, web2py 
does indeed scale.

On the other hand, *efficiency* refers to the number of requests that can 
be served with a given amount of hardware resources. What Bruno probably 
meant is that web2py is not as efficient as other frameworks, in that it 
requires more time per request. This might be true out of the box, as 
web2py automatically includes some functionality (such as sessions) that is 
optional in other frameworks, and web2py must read model and controller 
files on every request. However, it is possible to optimize web2py code by 
bytecode compiling the app, moving most logic to modules, using lazy 
tables, caching, etc. Even after such optimizations, I suspect web2py will 
not be the fastest framework around, but for real applications involving 
databases (as opposed to idealized benchmarks), it probably won't be far 
off.

Anthony

-- 
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 is Badly designed framework and Does not scale

2015-07-15 Thread Massimo Di Pierro
I posted a short rebuttal of those two negative points. It would help if 
somebody but me were to post sone positive comments. No need to target 
negative comments. Target prospective readers who may now know what web2py 
is.

On Wednesday, 15 July 2015 12:20:11 UTC-5, Matheus Cardoso wrote:

 In Slant.com 
 http://www.slant.co/topics/426/viewpoints/4/~what-are-the-best-general-purpose-python-web-frameworks-usable-in-production-sites~web2py
  we 
 have some Python Frameworks under criticism. One of them is web2py. But I 
 got stunned when I saw two great cons:

 - Badly designed framework
 - Does not scale

 The last one it concerned me more because was Rocha Bruno, a former web2py 
 contributor (i guess), that said that. What you guys have to say about it. 
 Are they are real two cons? Where truth and where is misconception?


-- 
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: websocket_messaging.py -t question

2015-07-15 Thread Dave S


On Wednesday, July 15, 2015 at 11:40:08 AM UTC-7, Massimo Di Pierro wrote:

 [...] 

Each client must have a unique token and pass it in the ws:// connection 
 string when it connects. If it up to you to make up tokens. They can be 
 random numbers, uuid, etc. You have to give a token to the clients and you 
 have to register the tokens with websocket_server via the /token api.


For instance, with web2py you enforce user login (@auth-login-required), 
and when the login succeeds you generate a token (e.g., uuid.uuid4()), 
perhaps adding it to the session data and using it when accepting message 
forms?

/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] Web2py is Badly designed framework and Does not scale

2015-07-15 Thread Matheus Cardoso
In Slant.com 
http://www.slant.co/topics/426/viewpoints/4/~what-are-the-best-general-purpose-python-web-frameworks-usable-in-production-sites~web2py
 we 
have some Python Frameworks under criticism. One of them is web2py. But I 
got stunned when I saw two great cons:

- Badly designed framework
- Does not scale

The last one it concerned me more because was Rocha Bruno, a former web2py 
contributor (i guess), that said that. What you guys have to say about it. 
Are they are real two cons? Where truth and where is misconception?

-- 
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.js websocket bug?

2015-07-15 Thread Samuel Sowah
I believe this is a bug. Please confirm what I'm thinking or correct me if 
I'm wrong.
The web2py_websocket function in web2py.js takes 4 parameters (2 optional, 
onopen and onclose)
web2py_websocket: function (url, onmessage, onopen, onclose) {
  if(WebSocket in window) {
var ws = new WebSocket(url);
ws.onopen = onopen ? onopen : (function () {});
ws.onmessage = onmessage;
ws.onclose = onclose ? onclose : (function () {});
return true; /* supported */
  } else return false; /* not supported */
},


I used all 4 parameters but only 3 behave how I expect them except to. url, 
onmessage, and onopen.
the url connects the client to the websocket, onmessage executes when a 
message is sent, onopen if specified executes when the socket is opened. I 
expect that onclose would execute if specified, when the socket is closed 
(client disconnects). for some reason, when the client disconnects, the 
function doesn't execute. I've already asked leading questions in other 
threads but I think this should sum up my exact problem.

*default/home.html*
script
   $(document).ready(function(){
  var data;
  $.web2py.web2py_websocket('ws://127.0.0.1:/realtime/home',
  function(e){data=eval('('+e.data+')')},
  function(){ajax('someone_online',[],'');},
  function(){ajax('{{='someone_offline/%s' % 
auth.user.id}}',[],'');});
   });
/script


*default.py*
@auth.requires_login()
def someone_online():
if not db(db.online_users.user_id==auth.user.id).select():
db.online_users.insert(user_id=auth.user.id)
script2=$('#userStatus').prepend('div%s just came 
online/div').fadeIn('slow').slideDown('slow') % auth.user.full_name
websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')

script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
 
% len(db().select(db.online_users.user_id))
websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


@auth.requires_login()
def someone_offline():
db(db.online_users.user_id==request.args(0)).delete()
script2=$('#userStatus').append('div%s just went 
offline/div').fadeIn('slow').slideDown('slow') % 
db(db.auth_user.id==request.args(0)).select().first().full_name
websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')

script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
 
% len(db().select(db.online_users.user_id))
websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


Scenario for the code above. when someone opens home.html, the page will 
connect to the websocket server because of the ws:// url on the page. 
because the onopen parameter has been specified, that function would 
execute immediately after the connection is established, which is to call 
the someone_online method in default.py via ajax. the someone_online method 
then via websocket_send updates the page with the statement user just 
came online.

This so far works just as expected.
1436999804.04:CONNECT to home
1436999804.41:MESSAGE to home:$('#userStatus').prepend('divsaso just came 
online/div').fadeIn('slow').slideDown('slow')
1436999804.41:MESSAGE to 
home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


The part that doesn't work is, when the page is closed, i expect that other 
people who have that same page opened will get the update user just went 
offline. the onclose function doesn't seem to be executed at all, or at 
least it doesn't do what I'm expecting. For example, when i refresh the 
page, it disconnects and reconnects without sending the offline message.
1436999803.66:DISCONNECT from home
1436999804.04:CONNECT to home
1436999804.41:MESSAGE to home:$('#userStatus').prepend('divsaso just came 
online/div').fadeIn('slow').slideDown('slow')
1436999804.41:MESSAGE to 
home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


What I have tried:
I tried starting the websocket server with the token option -t. When this 
is in play, somehow due to unregistered tokens I believe, the connection 
opens and closes immediately due to this code in the websocket_messaging.py 
script.
if DistributeHandler.tokens:
if not self.token in tokens or not token[self.token] is None:
self.close()
else:
tokens[self.token] = self

When the connection closes because of this code above checking for tokens, 
the onclose function somehow executes
1436999086.05:CONNECT to home
1436999086.05:DISCONNECT from home
1436999086.57:MESSAGE to home:$('#userStatus').prepend('divsaso just came 
online/div').fadeIn('slow').slideDown('slow')
1436999086.6:MESSAGE to 
home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))
1436999087.49:MESSAGE to home:$('#userStatus').append('divsaso just went 
offline/div').fadeIn('slow').slideDown('slow')
1436999087.49:MESSAGE to 

[web2py] Implementing hashids

2015-07-15 Thread Octavian G
Hello,

I'm using hashids http://hashids.org/python/. I'm generating my own 
forms, without SQLFORM. My tables have a Field.Virtual('hashid', lambda 
row: current.hashids.encrypt(row.table.id)).

I'd like to be able to use SQLFORM, so that a field's IS_IN_DB validator 
would help generate a form where the id is obfuscated using hashids, then 
automatically decode it before inserting in the database.

I've seen that validators.IS_IN_DB excludes FieldVirtual when building the 
set. I suppose the first step would be to subclass IS_IN_DB and make it 
read the FieldVirtual. Or, I could just ignore that and encode the id using 
hashids, when it's outputted by the options widget. But then I'd have to 
decode it before it's inserted into the database.. but where ?

I'm kind of confused about how to approach this. I'd also like to avoid 
subclassing web2py functionality if possible, but that's a bonus. Any help 
would be 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.


[web2py] listen on all interfaces 0.0.0.0 or specific interface - how ?

2015-07-15 Thread Gary Cowell
I'm trying to get the web2py.py to listen on all interfaces in development.

I'm sure I've done this before. I know I have. But I can't make this work 
at all now. I get this:

$ ./web2py.py --ip 10.2.1.15:8000
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.11.2-stable+timestamp.2015.05.30.16.33.24
Database drivers available: sqlite3, imaplib, cx_Oracle, pymysql, pg8000
WARNING:web2py:GUI not available because Tk library is not installed
choose a password:

please visit:
http://[10.2.1.15:8000]:8000/
use kill -SIGTERM 6380 to shutdown the web2py server


ERROR:Rocket.Errors.Port8000:Socket 10.2.1.15:8000:8000 in use by other 
process and it won't share.
WARNING:Rocket.Errors.Port8000:Listener started when not ready.

The please visit line looks odd, and the Rocket.Erros.Port line too. Why 
is the port there twice?

The only way I can get it to start, is by omitting the --ip option all 
together so it starts on 127.0.0.1:8000 , I can't even specify --ip 
127.0.0.1:8000 because I get the same style of error.

I'm prepared to kick myself when I find out what silly thing I'm doing 
wrong :/

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] Re: Changing order of auth_user fields

2015-07-15 Thread Mat Miles
Has this functionality been added?

On Wednesday, October 22, 2014 at 8:24:05 PM UTC-6, Massimo Di Pierro wrote:

 Please open a ticket about this. There is not a way but there should be.

 On Friday, 17 October 2014 16:50:37 UTC-5, Spokes wrote:

 I've added a middle name field to *auth_user* by doing the following:

 auth.settings.extra_fields['auth_user']= [
  Field('middle_name', type = string, length = 16, label = current.T
 ('Middle Name'))]

 This means that when a form is automatically generated from *auth_user, *the 
 order of the fields will be awkward. For example, the auth.register() 
 function produces input fields in the following order: first name, last 
 name, ... , password, middle name, confirm password.

 Is there a way to change the default order of the fields? 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] Re: redirecting app to another server

2015-07-15 Thread ari
it is interesting that not even the poeple who created the routes, nor the 
creator of web2py, doesn't have a clue how to redirect an app to another 
server.
maybe de logic behind the app is usefull?

vineri, 10 iulie 2015, 02:32:28 UTC+3, ari a scris:

 Hello!

 I have an web2py server with multiple apps. I want to redirect a specific 
 app to a new server

 Example:
 when i make the call
 http://name_of_the_server/app_name/default/index

 it will be redirected to:
 http://name_of_the_new_server/app_name/default/index

 i've tried the example from routes.example.py
 into the best case scenario, when i have some response: was only adding 
 into routes_in = ('BASE+/app_name/$anything'+
 http://name_of_the_new_server/app_name/default/index)
 but into the httpserver.log the entry is:
 10.8.52.24, 2015-07-09 18:33:19, GET, 
 http://name_of_the_new_server/app_name/default/index, HTTP/1.1, 400, 
 0.00

 the other cases was: only routes_out, both set.
 Could you , please, help me with this. Thank you very much




-- 
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: module vs plugin

2015-07-15 Thread Vikash Sharma
Module defines grouping logic at one place, the way you want to design it.
Example, all customer database, order details, vendor details and
respective operation are organised  implemented separately. Read more
about cohesion and coupling on wiki

Plugins is more like a features you can attach to your system or removed,
if required. Now this plugin implementation might modularized within itself
for better design. Example, you include features in eclipse ide as plugins.
Another example would be: Lets say you are selling a base product to all
your customer at a price X. Now, based on customer requirement, specify
features/plugins can be added or attached to this base system.



Regards,
Vikash Sharma
vikash0...@gmail.com

On Wed, Jul 15, 2015 at 10:17 PM, Fabiano Almeida fabi...@techno7.com.br
wrote:

 Hi Anthony,

 I think add plugins to build a system. Eg customer registration, product
 registration, shopping trolley, service order, reports, etc.

 thks

 Fabiano.

 --
 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: prettydate ago is not translated

2015-07-15 Thread icodk
No I don't. I only refers to it as in the line below
db.place.expire_date.represent= lambda value,row: prettydate(value,T=T)


On Wednesday, July 15, 2015 at 10:29:03 AM UTC+2, Maxim Hrustalev wrote:

 Don't you try ti access attribute 'year' of your prettydated expire_date 
 somewhere in your code?

 On Sunday, July 12, 2015 at 12:10:09 PM UTC+3, icodk wrote:

 Thanks Maxim,
 I tried :
 db.place.expire_date.represent= lambda value,row: prettydate(value,T=T)
 The problem is that I get the following error
 type 'exceptions.AttributeError' 'str' object has no attribute 'year'
 The field is defined as:

 Field('expire_date','datetime',label=T('expire_date'),writable=False,default=request.now)
 If I don't add the T=T it works fine (but not translate:-(


 On Saturday, July 11, 2015 at 3:24:03 PM UTC+2, Maxim Hrustalev wrote:

 To translate prettydate output  you have to pass translation function as 
 argument: prettydate(my_date, T=T).

 On Wednesday, July 8, 2015 at 12:40:55 AM UTC+3, icodk wrote:

 Thanks for your help.
 My editor (web2py web interface, Notepad++,Visual Studio) should be 
 able to find 'ago' in any sentence combination. It also found '%d 
 weeks ago' as I wrote below so I can't see any reason why it should not 
 find  %d hours ago unless it is not there. May be I am looking in 
 the wrong file-but everything else works fine(I mean the other 
 translations).


 On Monday, July 6, 2015 at 8:10:39 AM UTC+2, xmarx wrote:

 you must look up the %d weeks ago, %d hours ago, %d months ago 
 phrases. 
 not just ago. because i think item that be translated is T(%d days 
 ago). not T(ago). i don't know its detail.

  In addition I can only find '%d weeks ago': '%d uge siden', in my 
 language file.


 this translate  used to be work. didn't it?

 2015-07-05 1:49 GMT+03:00 icodk i...@alpiron.com:

 There are two issues here, the first is that 'ago' it is NOT in my 
 language file and if you look in  gluon/tools.py you will see that 
 suffix = ' ago ' and NOT  suffix = T(' ago') . Anyway this is in my 
  gluon/tools.py file.
 OK I replaced  it with:  suffix = T(' ago') .which should be part of 
 the web2py in the first place or I am missing something.

 The second issue is that even if I replaced it as above I still can't 
 find 'ago' in my language file. In addition I can only find '%d 
 weeks ago': '%d uge siden', in my language file. Nothing else from 
 prettydate 
 function in my language file.
 What am I doing wrong ?
 Thanks





 On Saturday, July 4, 2015 at 1:45:24 PM UTC+2, icodk wrote:

 Is there any reason why the 'ago' is not translate in 
 prettydate  (gluon/tools.py) ?

 *suffix = ' ago'* instead of:
 *suffix = ** T( ago)*

 In Danish that will be translated to: 'siden'
 Also I can't find the other strings in my language file
 T('1 year' + suffix)
 T('1 month' + suffix)
 etc.

 I can only find:
 %d weeks ago




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




 -- 
 Selman Kocael
 İsabet Yayınları

 

-- 
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: websocket_messaging.py -t question

2015-07-15 Thread Massimo Di Pierro
Yes and no. websocket_messaging is designed to deliver messages from the 
server to the clients. Clients communicate by sending messages to the 
web2py server which then sends to the websocket_messaging for delivery. The 
process of posting messages does not require a connection to 
the websocket_messaging and security is handled by web2py in the usual way. 
Communication between web2py and websocket_messagingis signed using the 
key. The token only restricts who can signup for receiving messages 
from websocket_messaging

As you suggested you could create a token wen a user logs into web2py and 
register it with websocket_server using the token api. You need to 
communicate it to the app. You can do for example:

script
   

   $(document).ready(function(){   
   

  
if(!$.web2py.web2py_websocket('ws://127.0.0.1:/realtime/{{=session.group}}/{{=session.token}}',
 
function(e){alert(e.data)}))  

   
   

 alert(html5 websocket not supported by your browser, try Google 
Chrome);   

   }); 

/script






On Wednesday, 15 July 2015 14:24:08 UTC-5, Dave S wrote:



 On Wednesday, July 15, 2015 at 11:40:08 AM UTC-7, Massimo Di Pierro wrote:

 [...] 

 Each client must have a unique token and pass it in the ws:// connection 
 string when it connects. If it up to you to make up tokens. They can be 
 random numbers, uuid, etc. You have to give a token to the clients and you 
 have to register the tokens with websocket_server via the /token api.


 For instance, with web2py you enforce user login (@auth-login-required), 
 and when the login succeeds you generate a token (e.g., uuid.uuid4()), 
 perhaps adding it to the session data and using it when accepting message 
 forms?

 /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: listen on all interfaces 0.0.0.0 or specific interface - how ?

2015-07-15 Thread Massimo Di Pierro
This is not valid syntax: 

/web2py.py --ip 10.2.1.15:8000 #WRONG

supposed to be

/web2py.py --ip 10.2.1.15 --port 8000 http://10.2.1.15:8000/




On Wednesday, 15 July 2015 18:36:58 UTC-5, Gary Cowell wrote:

 I'm trying to get the web2py.py to listen on all interfaces in development.

 I'm sure I've done this before. I know I have. But I can't make this work 
 at all now. I get this:

 $ ./web2py.py --ip 10.2.1.15:8000
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2015
 Version 2.11.2-stable+timestamp.2015.05.30.16.33.24
 Database drivers available: sqlite3, imaplib, cx_Oracle, pymysql, pg8000
 WARNING:web2py:GUI not available because Tk library is not installed
 choose a password:

 please visit:
 http://[10.2.1.15:8000]:8000/
 use kill -SIGTERM 6380 to shutdown the web2py server


 ERROR:Rocket.Errors.Port8000:Socket 10.2.1.15:8000:8000 in use by other 
 process and it won't share.
 WARNING:Rocket.Errors.Port8000:Listener started when not ready.

 The please visit line looks odd, and the Rocket.Erros.Port line too. Why 
 is the port there twice?

 The only way I can get it to start, is by omitting the --ip option all 
 together so it starts on 127.0.0.1:8000 , I can't even specify --ip 
 127.0.0.1:8000 because I get the same style of error.

 I'm prepared to kick myself when I find out what silly thing I'm doing 
 wrong :/

 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] Re: web2py.js websocket bug?

2015-07-15 Thread 黄祥
please open a ticket in here (also please include this discussion):
https://github.com/web2py/web2py/issues

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: Web2py is Badly designed framework and Does not scale

2015-07-15 Thread rochacbruno
I edited my answer, I included more information and clarification about my 
CON points!

http://www.slant.co/topics/426/viewpoints/4/~what-are-the-best-general-purpose-python-web-frameworks-usable-in-production-sites~web2py#3

On Wednesday, July 15, 2015 at 2:20:11 PM UTC-3, Matheus Cardoso wrote:

 In Slant.com 
 http://www.slant.co/topics/426/viewpoints/4/~what-are-the-best-general-purpose-python-web-frameworks-usable-in-production-sites~web2py
  we 
 have some Python Frameworks under criticism. One of them is web2py. But I 
 got stunned when I saw two great cons:

 - Badly designed framework
 - Does not scale

 The last one it concerned me more because was Rocha Bruno, a former web2py 
 contributor (i guess), that said that. What you guys have to say about it. 
 Are they are real two cons? Where truth and where is misconception?


-- 
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.js websocket bug?

2015-07-15 Thread Massimo Di Pierro
you may be right. Will check asap. Please open a ticket.

On Wednesday, 15 July 2015 18:17:00 UTC-5, Samuel Sowah wrote:

 I believe this is a bug. Please confirm what I'm thinking or correct me if 
 I'm wrong.
 The web2py_websocket function in web2py.js takes 4 parameters (2 optional, 
 onopen and onclose)
 web2py_websocket: function (url, onmessage, onopen, onclose) {
   if(WebSocket in window) {
 var ws = new WebSocket(url);
 ws.onopen = onopen ? onopen : (function () {});
 ws.onmessage = onmessage;
 ws.onclose = onclose ? onclose : (function () {});
 return true; /* supported */
   } else return false; /* not supported */
 },


 I used all 4 parameters but only 3 behave how I expect them except to. 
 url, onmessage, and onopen.
 the url connects the client to the websocket, onmessage executes when a 
 message is sent, onopen if specified executes when the socket is opened. I 
 expect that onclose would execute if specified, when the socket is closed 
 (client disconnects). for some reason, when the client disconnects, the 
 function doesn't execute. I've already asked leading questions in other 
 threads but I think this should sum up my exact problem.

 *default/home.html*
 script
$(document).ready(function(){
   var data;
   $.web2py.web2py_websocket('ws://127.0.0.1:/realtime/home',
   function(e){data=eval('('+e.data+')')},
   function(){ajax('someone_online',[],'');},
   function(){ajax('{{='someone_offline/%s' % auth.user.id
 }}',[],'');});
});
 /script


 *default.py*
 @auth.requires_login()
 def someone_online():
 if not db(db.online_users.user_id==auth.user.id).select():
 db.online_users.insert(user_id=auth.user.id)
 script2=$('#userStatus').prepend('div%s just came 
 online/div').fadeIn('slow').slideDown('slow') % auth.user.full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 @auth.requires_login()
 def someone_offline():
 db(db.online_users.user_id==request.args(0)).delete()
 script2=$('#userStatus').append('div%s just went 
 offline/div').fadeIn('slow').slideDown('slow') % db(db.auth_user.id
 ==request.args(0)).select().first().full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 Scenario for the code above. when someone opens home.html, the page will 
 connect to the websocket server because of the ws:// url on the page. 
 because the onopen parameter has been specified, that function would 
 execute immediately after the connection is established, which is to call 
 the someone_online method in default.py via ajax. the someone_online method 
 then via websocket_send updates the page with the statement user just 
 came online.

 This so far works just as expected.
 1436999804.04:CONNECT to home
 1436999804.41:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1436999804.41:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 The part that doesn't work is, when the page is closed, i expect that 
 other people who have that same page opened will get the update user 
 just went offline. the onclose function doesn't seem to be executed at 
 all, or at least it doesn't do what I'm expecting. For example, when i 
 refresh the page, it disconnects and reconnects without sending the offline 
 message.
 1437002425.12:DISCONNECT from home
 1437002425.52:CONNECT to home
 1437002425.98:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1437002425.98:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 What I have tried:
 I tried starting the websocket server with the token option -t. When this 
 is in play, somehow due to unregistered tokens I believe, the connection 
 opens and closes immediately due to this code in the websocket_messaging.py 
 script.
 if DistributeHandler.tokens:
 if not self.token in tokens or not token[self.token] is None:
 self.close()
 else:
 tokens[self.token] = self

 When the connection closes because of this code above checking for tokens, 
 the onclose function somehow executes
 1436999086.05:CONNECT to home
 1436999086.05:DISCONNECT from home
 1436999086.57:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1436999086.6:MESSAGE to 
 

[web2py] Re: web2py.js websocket bug?

2015-07-15 Thread Samuel Sowah


On Wednesday, July 15, 2015 at 11:46:38 PM UTC, Massimo Di Pierro wrote:

 you may be right. Will check asap. Please open a ticket.

 I've never opened a ticket, where and how do I do that?
 

 On Wednesday, 15 July 2015 18:17:00 UTC-5, Samuel Sowah wrote:

 I believe this is a bug. Please confirm what I'm thinking or correct me 
 if I'm wrong.
 The web2py_websocket function in web2py.js takes 4 parameters (2 
 optional, onopen and onclose)
 web2py_websocket: function (url, onmessage, onopen, onclose) {
   if(WebSocket in window) {
 var ws = new WebSocket(url);
 ws.onopen = onopen ? onopen : (function () {});
 ws.onmessage = onmessage;
 ws.onclose = onclose ? onclose : (function () {});
 return true; /* supported */
   } else return false; /* not supported */
 },


 I used all 4 parameters but only 3 behave how I expect them except to. 
 url, onmessage, and onopen.
 the url connects the client to the websocket, onmessage executes when a 
 message is sent, onopen if specified executes when the socket is opened. I 
 expect that onclose would execute if specified, when the socket is closed 
 (client disconnects). for some reason, when the client disconnects, the 
 function doesn't execute. I've already asked leading questions in other 
 threads but I think this should sum up my exact problem.

 *default/home.html*
 script
$(document).ready(function(){
   var data;
   $.web2py.web2py_websocket('ws://127.0.0.1:/realtime/home',
   function(e){data=eval('('+e.data+')')},
   function(){ajax('someone_online',[],'');},
   function(){ajax('{{='someone_offline/%s' % auth.user.id
 }}',[],'');});
});
 /script


 *default.py*
 @auth.requires_login()
 def someone_online():
 if not db(db.online_users.user_id==auth.user.id).select():
 db.online_users.insert(user_id=auth.user.id)
 script2=$('#userStatus').prepend('div%s just came 
 online/div').fadeIn('slow').slideDown('slow') % auth.user.full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 @auth.requires_login()
 def someone_offline():
 db(db.online_users.user_id==request.args(0)).delete()
 script2=$('#userStatus').append('div%s just went 
 offline/div').fadeIn('slow').slideDown('slow') % db(db.auth_user.id
 ==request.args(0)).select().first().full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 Scenario for the code above. when someone opens home.html, the page will 
 connect to the websocket server because of the ws:// url on the page. 
 because the onopen parameter has been specified, that function would 
 execute immediately after the connection is established, which is to call 
 the someone_online method in default.py via ajax. the someone_online method 
 then via websocket_send updates the page with the statement user just 
 came online.

 This so far works just as expected.
 1436999804.04:CONNECT to home
 1436999804.41:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1436999804.41:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 The part that doesn't work is, when the page is closed, i expect that 
 other people who have that same page opened will get the update user 
 just went offline. the onclose function doesn't seem to be executed at 
 all, or at least it doesn't do what I'm expecting. For example, when i 
 refresh the page, it disconnects and reconnects without sending the offline 
 message.
 1437002425.12:DISCONNECT from home
 1437002425.52:CONNECT to home
 1437002425.98:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1437002425.98:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 What I have tried:
 I tried starting the websocket server with the token option -t. When this 
 is in play, somehow due to unregistered tokens I believe, the connection 
 opens and closes immediately due to this code in the websocket_messaging.py 
 script.
 if DistributeHandler.tokens:
 if not self.token in tokens or not token[self.token] is None:
 self.close()
 else:
 tokens[self.token] = self

 When the connection closes because of this code above checking for 
 tokens, the onclose function somehow executes
 1436999086.05:CONNECT to home
 1436999086.05:DISCONNECT from home
 1436999086.57:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 

[web2py] Re: redirecting app to another server

2015-07-15 Thread Massimo Di Pierro
Who says we do not have a clue? ;-)

There are multiple ways:

1) The easiest way is to create a model file in your app that does:

redirect(URL(args=request.args, vars=request.vars, 
host='your.new.host.com'))

2) It can be done at the routes level

routes_in = [
('/appname','301-http://your.new.host.com/appname/default/index'),
('/appname/default','301-http://your.new.host.com/appname/default/index'),
('/appname/default/index','301-http://your.new.host.com/appname/default/index'),
#... more rules as needed
]

3) (recommended) use iptables

iptables -t nat -A PREROUTING -d 1.1.1.1 -j DNAT --to-destination 2.2.2.2
iptables -t filter -A FORWARD -d 1.1.1.1 -j ACCEPT

1.1.1.1 being the old server, and 2.2.2.2 being the new server.

this will work even if the old server and the new server have the same DNS 
domain name!

3) is recommended because although web2py can do it, this is really not a 
job for web2py. This is a job for the OS.




On Wednesday, 15 July 2015 18:36:59 UTC-5, ari wrote:

 it is interesting that not even the poeple who created the routes, nor the 
 creator of web2py, doesn't have a clue how to redirect an app to another 
 server.
 maybe de logic behind the app is usefull?

 vineri, 10 iulie 2015, 02:32:28 UTC+3, ari a scris:

 Hello!

 I have an web2py server with multiple apps. I want to redirect a specific 
 app to a new server

 Example:
 when i make the call
 http://name_of_the_server/app_name/default/index

 it will be redirected to:
 http://name_of_the_new_server/app_name/default/index

 i've tried the example from routes.example.py
 into the best case scenario, when i have some response: was only adding 
 into routes_in = ('BASE+/app_name/$anything'+
 http://name_of_the_new_server/app_name/default/index)
 but into the httpserver.log the entry is:
 10.8.52.24, 2015-07-09 18:33:19, GET, 
 http://name_of_the_new_server/app_name/default/index, HTTP/1.1, 400, 
 0.00

 the other cases was: only routes_out, both set.
 Could you , please, help me with this. Thank you very much




-- 
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.js websocket bug?

2015-07-15 Thread Samuel Sowah
I found a work around to the whole problem. I just added this attribute to 
the body tag,
onunload=ajax('{{='someone_offline/%s' % auth.user.id}}',[],'');

This does exactly what I want. However I think the onclose issue has to 
still be resolved or looked into.



On Wednesday, July 15, 2015 at 11:51:37 PM UTC, Samuel Sowah wrote:



 On Wednesday, July 15, 2015 at 11:46:38 PM UTC, Massimo Di Pierro wrote:

 you may be right. Will check asap. Please open a ticket.

 I've never opened a ticket, where and how do I do that?
  

 On Wednesday, 15 July 2015 18:17:00 UTC-5, Samuel Sowah wrote:

 I believe this is a bug. Please confirm what I'm thinking or correct me 
 if I'm wrong.
 The web2py_websocket function in web2py.js takes 4 parameters (2 
 optional, onopen and onclose)
 web2py_websocket: function (url, onmessage, onopen, onclose) {
   if(WebSocket in window) {
 var ws = new WebSocket(url);
 ws.onopen = onopen ? onopen : (function () {});
 ws.onmessage = onmessage;
 ws.onclose = onclose ? onclose : (function () {});
 return true; /* supported */
   } else return false; /* not supported */
 },


 I used all 4 parameters but only 3 behave how I expect them except to. 
 url, onmessage, and onopen.
 the url connects the client to the websocket, onmessage executes when a 
 message is sent, onopen if specified executes when the socket is opened. I 
 expect that onclose would execute if specified, when the socket is closed 
 (client disconnects). for some reason, when the client disconnects, the 
 function doesn't execute. I've already asked leading questions in other 
 threads but I think this should sum up my exact problem.

 *default/home.html*
 script
$(document).ready(function(){
   var data;
   $.web2py.web2py_websocket('ws://127.0.0.1:/realtime/home',
   function(e){data=eval('('+e.data+')')},
   function(){ajax('someone_online',[],'');},
   function(){ajax('{{='someone_offline/%s' % auth.user.id
 }}',[],'');});
});
 /script


 *default.py*
 @auth.requires_login()
 def someone_online():
 if not db(db.online_users.user_id==auth.user.id).select():
 db.online_users.insert(user_id=auth.user.id)
 script2=$('#userStatus').prepend('div%s just came 
 online/div').fadeIn('slow').slideDown('slow') % auth.user.full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 @auth.requires_login()
 def someone_offline():
 db(db.online_users.user_id==request.args(0)).delete()
 script2=$('#userStatus').append('div%s just went 
 offline/div').fadeIn('slow').slideDown('slow') % db(db.auth_user.id
 ==request.args(0)).select().first().full_name
 websocket_send('http://127.0.0.1:', script2, 'somekey', 'home')
 
 script1=$('#usersOnline').html($('span%s/span').fadeIn('slow').slideDown('slow'))
  
 % len(db().select(db.online_users.user_id))
 websocket_send('http://127.0.0.1:', script1, 'somekey', 'home')


 Scenario for the code above. when someone opens home.html, the page will 
 connect to the websocket server because of the ws:// url on the page. 
 because the onopen parameter has been specified, that function would 
 execute immediately after the connection is established, which is to call 
 the someone_online method in default.py via ajax. the someone_online method 
 then via websocket_send updates the page with the statement user just 
 came online.

 This so far works just as expected.
 1436999804.04:CONNECT to home
 1436999804.41:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1436999804.41:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 The part that doesn't work is, when the page is closed, i expect that 
 other people who have that same page opened will get the update user 
 just went offline. the onclose function doesn't seem to be executed at 
 all, or at least it doesn't do what I'm expecting. For example, when i 
 refresh the page, it disconnects and reconnects without sending the offline 
 message.
 1437002425.12:DISCONNECT from home
 1437002425.52:CONNECT to home
 1437002425.98:MESSAGE to home:$('#userStatus').prepend('divsaso just 
 came online/div').fadeIn('slow').slideDown('slow')
 1437002425.98:MESSAGE to 
 home:$('#usersOnline').html($('span2/span').fadeIn('slow').slideDown('slow'))


 What I have tried:
 I tried starting the websocket server with the token option -t. When 
 this is in play, somehow due to unregistered tokens I believe, the 
 connection opens and closes immediately due to this code in the 
 websocket_messaging.py script.
 if DistributeHandler.tokens:
 if not self.token in tokens or not 

[web2py] Re: websocket_messaging.py -t question

2015-07-15 Thread Dave S


On Wednesday, July 15, 2015 at 12:24:08 PM UTC-7, Dave S wrote:



 On Wednesday, July 15, 2015 at 11:40:08 AM UTC-7, Massimo Di Pierro wrote:

 [...] 

 Each client must have a unique token and pass it in the ws:// connection 
 string when it connects. If it up to you to make up tokens. They can be 
 random numbers, uuid, etc. You have to give a token to the clients and you 
 have to register the tokens with websocket_server via the /token api.


 For instance, with web2py you enforce user login (@auth-login-required), 
 and when the login succeeds you generate a token (e.g., uuid.uuid4()), 
 perhaps adding it to the session data and using it when accepting message 
 forms?


Er, using it when taking the message from the message forms and submitting 
it to websocket

(sorry, I'll catch up to the rest of you eventually) 

/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: Always send a custom HTTP header with web2py responses

2015-07-15 Thread Anthony
There isn't an easy way to do it, so go ahead and open a ticket, but I 
think you can do it by creating a custom error handler 
http://web2py.com/books/default/chapter/29/04/the-core#Routes-on-error 
(though will fail in case the error handler itself fails) or via external 
WSGI middleware 
http://web2py.com/books/default/chapter/29/04/the-core#External-middleware
.

Anthony

On Wednesday, July 15, 2015 at 4:58:42 AM UTC-4, Massimo Di Pierro wrote:

 Good point. Please open a ticket. There is no way to do this now.

 On Wednesday, 15 July 2015 01:52:55 UTC-5, Saifuddin Rangwala wrote:

 Hi,

 I would like to a custom http header X-APP-VERSION alongwith 
 all the web2py responses.

 For 200 OK I do it using code below in the models file:

 response.headers[X-APP-VERSION] = config.version

 However, I would like to send this header for all error cases as well 
 including the unexpected errors like 500 Internal Server Error.

 Is there a good way to accomplish this?


 -- 
 Thanks,
 -Saif.
  


-- 
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: bootstrap select writable = False

2015-07-15 Thread Anthony
When you set writable=False, web2py does not disable the form input 
element, but instead just writes the value in place of the input element. 
Instead, you can leave writable=True and manually set the select widget to 
be disabled:

db.mytable.myfield.widget = lambda f, v: SQLFORM.widgets.options.widget(f, v
, _disabled=True)

However, if the built-in Bootstrap formstyle is not displaying read-only 
values nicely, you should submit a Github issue so it can be improved.

Anthony


On Wednesday, July 15, 2015 at 7:41:26 AM UTC-4, Annet wrote:

 When I set writable = False on a field that is being rendered as a select
 it does not comply with Bootstraps disabled state for disabled selects:

 http://getbootstrap.com/css/#forms-control-disabled

 div class=form-group
   label for=disabledSelectDisabled select menu/label
   select id=disabledSelect class=form-control
 optionDisabled select/option
   /select/div


 What I get instead is:

 div id=nav_vertex_navID__row class=form-group
   label id=nav_vertex_navID__label class=control-label 
 for=nav_vertex_navIDDisabled select menu/label
 Disabled select/div


 which does look rather ugly. Is it possible ti fix this issue?


 Kind regards,

 Annet


-- 
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: websocket_messaging.py -t question

2015-07-15 Thread Samuel Sowah


On Wednesday, July 15, 2015 at 8:53:35 AM UTC, Massimo Di Pierro wrote:

 This logic was added somewhat recently and I did not test it myself but 
 reading the code it seems it should work this way:

 1) run websocket_messaging.py  -t to enable the token message
 2) post a message to the /token API with a message containing a made up 
 UUID token. This will create a token on the server
 3) when connecting instead of 

ws://127.0.0.1:/realtime/mygroup


 use


ws://127.0.0.1:/realtime/mygroup/token


 because of -t , the token must match one of the registered token and no 
 other client must be using it for a connection. Notice that in 2 the /token 
 api is meant to be called by the web2py server. Works like the post 
 handler. The message is supposed to be created and signed using the server 
 password.


 The idea is when a new cllient accesses the web app, the server create a 
 on time token for that client, gives it to the client (via normal web2py 
 means, embedding in the pages, etc.) and registers it with the 
 websocket_server. The latter then checks the token when the client tries to 
 connect. 


I don't understand how this happens? The token that I use to start the 
websocket_messaging.py via -t option, that token doesn't change, so which 
token does the server create to give to the client, and how does it 
register it with the websocket_server. Are the tokens unique for each 
client? and if so how are they generated and registered to allow 
communication? how different is the token for the -t option from the token 
the server creates? I'm a bit confused how to use this. The english makes 
sense but the technicality behind it is still fuzzy. Like, from what I 
understand, the server creates a token when the client first connects and 
gives it to the client. when the client tries to send messages via the 
websocket, it has to add the token to the message via 
url/realtime/group/token. I still don't know how to implement this (if 
that's what you're saying even means.

A simple chat app implementing just this can help my understanding, I'm 
only asking. But some further explanation will also do until I can 
understand.
Thanks.
 

 On Tuesday, 14 July 2015 20:54:32 UTC-5, Samuel Sowah wrote:

 Can someone please explain how to use websocket_messaging.py properly 
 with tokens?



-- 
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: Another online store based in web2py+ractive+stripe

2015-07-15 Thread Michele Comitini
Massimo have you taken in account to  use http://satchless.com/ ?
It has a fairly complete API and it's easy to couple with DAL...


2015-07-15 10:55 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 You can do it here. The more times you click the more items you put the in
 the cart. If you edit the numbers in cart, everything changes in realtime
 without need to submit.


 On Wednesday, 15 July 2015 03:29:02 UTC-5, icodk wrote:

 I think www.tindie.com has a very nice interface. Specifically, where
 you can add to cart you can also inc/dec quantity

 On Tuesday, July 14, 2015 at 6:44:29 PM UTC+2, Massimo Di Pierro wrote:

 I made another simple online store: https://github.com/mdipierro/estore3

 Can you help me test, suggest improvement, add features?

 Taxes and shipping logic are missing.

 All the code is in models/db.py, controllers/default.py, and
 views/default/index.html so it is very simple and easy to improve.

  --
 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 and OODBMS?

2015-07-15 Thread Michele Comitini
Of course one can use the usual postgresql which an ORDBM...  pyDAL does
not (yet) support inheritance at DDL level, but can be used at DML level
for most needs.

2015-07-15 11:09 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 web2py include pydal and pydal is an API for accessing RDBMs and some
 NoSQL engines. This is not your use case.

 web2py does not include a OODBM but nothing prevent you from accessing one
 and take advantage of all the other features. You simply would not do it
 through the DAL. The reason is that there is no standardize API for
 accessing OODBMs. Every one of them is different and every one has its own
 set of APIs.

 So for example in the python world a popular one is ZODB. You can install
 ZODB and use it with web2py. I do not expect any problem but I never tried
 it. There are other OODBMs which you can use from python. If they work with
 Python, they work with web2py.

 That said. I disagree that OODBMs are the future and SQL is the past for
 two reasons: SQL databases are still widely more popular and more scalable.
 It is possible to build a OODBM on top of SQL database, and in fact, if
 time permits, I would like to build one on top of the web2py dal.


 On Wednesday, 15 July 2015 03:29:04 UTC-5, Esteban Bulutsuzku wrote:

 Hello,

 I am an experienced OOP programmer. I -fortunately- do not use relational
 technology anymore, so I won't plan get back to write SQL/RDBMS/ORM stuff
 (I really don't care if the relational math theory + ISO/IEC 9075-1 backs
 the stack). This could sound like a rare use case for you, but it is not if
 you use actively other systems (Java, db4o, GemStone, etc) where you can
 have nested complex designs with navigational access to data, dynamic class
 definitions, class extensions, etc. Also if you don't ever plan to use an
 OODBMS, sometimes is desirable to delay the need to hook up a database
 during development, or ever forever ;)

 But I am dissapointed, because after hearing a lot about web2py I still
 have not found how to work with web2py with an OODBMS (any of them). It
 seems that web2py is tied to RDBMS (which to me is technology from 1970's
 but that's another story).

 Maybe most python devs have experience with flat simple tabular data
 models, it could also be the case that Python file-orientation promotes
 more scripting approach than object-technology, and I am not criticizing
 you but in my case I already have a rich object model (is *NOT* NoSQL) and
 I am giving web2py a chance.

 But it seems there is few to none documentation of web2py + OODBMS, i.e.
 how to use the DAL with a OODMS backend.

 Is web2py still valid for my use-case?
 Anyone working with OODBMS and web2py?

 Thanks,
 Cheers,

 Esteban

  --
 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] module vs plugin

2015-07-15 Thread Fabiano Almeida
Hi @ll!

I think about modularize my aplication. Then the question is: module or
plugin? What's the difference?

Thanks!

Fabiano.

-- 
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: module vs plugin

2015-07-15 Thread Anthony
It's not module *or* plugin -- a plugin can contain modules. A plugin is 
any subset of an application's files. If you want to modularize the 
models, views, and/or controllers of an app, then you would need to create 
a plugin. You can also move a lot of functionality to modules (which get 
imported where needed), and the modules themselves could go into plugins. 
Hard to say more without knowing more specifically what you are trying to 
achieve.

Anthony

On Wednesday, July 15, 2015 at 11:23:34 AM UTC-4, Fabiano Almeida wrote:

 Hi @ll!

 I think about modularize my aplication. Then the question is: module or 
 plugin? What's the difference?

 Thanks!

 Fabiano.


-- 
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: Always send a custom HTTP header with web2py responses

2015-07-15 Thread Saifuddin Rangwala
Yep thanks, I have created a ticket for the same. A good way of achieving
this helps with better error handling.

On Wed, Jul 15, 2015 at 8:02 PM, Anthony abasta...@gmail.com wrote:

 There isn't an easy way to do it, so go ahead and open a ticket, but I
 think you can do it by creating a custom error handler
 http://web2py.com/books/default/chapter/29/04/the-core#Routes-on-error
 (though will fail in case the error handler itself fails) or via external
 WSGI middleware
 http://web2py.com/books/default/chapter/29/04/the-core#External-middleware
 .

 Anthony

 On Wednesday, July 15, 2015 at 4:58:42 AM UTC-4, Massimo Di Pierro wrote:

 Good point. Please open a ticket. There is no way to do this now.

 On Wednesday, 15 July 2015 01:52:55 UTC-5, Saifuddin Rangwala wrote:

 Hi,

 I would like to a custom http header X-APP-VERSION alongwith
 all the web2py responses.

 For 200 OK I do it using code below in the models file:

 response.headers[X-APP-VERSION] = config.version

 However, I would like to send this header for all error cases as well
 including the unexpected errors like 500 Internal Server Error.

 Is there a good way to accomplish this?


 --
 Thanks,
 -Saif.




--
-Saif.

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