[web2py] Re: onvalidation in sqlform.smartgrid for delete purpose

2014-05-31 Thread Pham Quang Dung
Niphlod,
where may we find the default call back? e.g for onvalidation? thanks

On Thursday, September 19, 2013 5:32:40 AM UTC+7, Niphlod wrote:

 use always the same method. add a few logging lines between those lines of 
 code and see for yourself why your code isn't executed

 On Wednesday, September 18, 2013 6:19:21 PM UTC+2, 黄祥 wrote:

 sorry, i paste the part for my logic testing.
 db(db.purchase_requisition_header.id==1).update(status='Purchase 
 Requisition Authorized')
 should be :
 db(db.purchase_requisition_header.id==row_header.purchase.purchase_requisition_no).update(status='Purchase
  
 Requisition Authorized')

 at first i use :
 db(db.purchase_requisition_header.id==row_header.purchase.purchase_requisition_no).update(status='Purchase
  
 Requisition Authorized')
 because the output is not expected, when using variable 
 (row_header.purchase_requisition_no), so that i put the value (1) for 
 testing purpose, yet, the result is not expected (no error occured, just 
 not update the other tables).

 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: DAL doesn't fully support datetime operations

2014-05-31 Thread Pham Quang Dung
Good hint, thanks, but anyway it's platform(sqlite) dependent.

Also thanks to Niphlod to have confirmed the same thing. Sometimes never 
better choice.

On Saturday, May 31, 2014 3:23:44 AM UTC+7, Anthony wrote:

 Note, you can do:

 minus_5_min = 'DATETIME((writetime), -5 minutes)'
 row = db(db.mytable).select(minus_5_min).first()
 print row[minus_5_min]

 Anthony

 On Thursday, May 29, 2014 11:49:06 PM UTC-4, Pham Quang Dung wrote:

 Hm,
 Not true, I forgot to say I did with execlsql OK, for Sqlite, 
 select DATETIME((writetime), -5 minutes) from xxx

 On Friday, May 30, 2014 2:35:42 AM UTC+7, Niphlod wrote:

 This will never work because there is no notion of timedelta in any db 
 backend (nor any substitute for it).
 Calculate the result AFTER fetching the rows from the db. 

 On Thursday, May 29, 2014 12:32:41 PM UTC+2, Pham Quang Dung wrote:

 I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) 
 *and the result was totally a surprise because it was of type Int. 
 Thoughts?



-- 
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: import right here?

2014-05-31 Thread Pham Quang Dung
Yes, I had. Just tried to find another way to import a file directly 
without easyinstall.
When I placed it in the module subfolder, this rpdb2 (it is), cannot import 
as a module. Anyway, will use easyinstall then.

On Friday, May 30, 2014 2:37:19 AM UTC+7, Niphlod wrote:

 read the book before posting. from here onwards there is the documentation 
 about third-party modules and the execution environment of web2py.
 http://web2py.com/books/default/chapter/29/04/the-core#Third-party-modules

 On Thursday, May 29, 2014 12:40:43 PM UTC+2, Pham Quang Dung wrote:

 I have placed an __init__.py file in the folder (windows) of the 
 controller xyz.py but cannot import abc.py at the same location. Any hints 
 to use path + file name, or copy the abc.py to where? I am newbee, sorry.



-- 
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] problem with cyrillic in rest url

2014-05-31 Thread Thomas P
I am getting weird results when passing in cyrillic strings, or strings 
that contain characters like ® in the name pattern.

If I do a search with another patter like email against the same user, the 
username with cyrillic will display correctly.


I tried dumping the request.args and this is what displays where the name 
being searched should be  
If I pass the same string into a variable in request.vars the string will 
display correctly.


The the string I am searching for in my database is дерьмо and ®ob

/name/дерьмо   == bad results
/name/®ob == bad results


Anyone know what could be the issue?



@request.restful()
def api():
response.view = 'generic.json'
def GET(*args,**vars):
patterns = [
/name/{user.username},
/email/{user.email},
]
parser = forum_db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(results=parser.response)
else:
raise HTTP(parser.status,parser.error)
return locals()




-- 
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] Smartgrid onupdate still works while set to None

2014-05-31 Thread Pham Quang Dung
Anybody enlighten me on while this form still updates the data? (I expected 
it was disabled to then use my own callback)
form = SQLFORM.smartgrid(db.anyinfo,onupdate=None
,constraints = dict(anyinfo = 
(tb.name[6:]=='level'))
,user_signature=False
)

Also is there a way to convert all the way to POST form (I am confused as 
this was asserted in the manual, however it's GET while it reads args from 
URI not form vars, right?)

-- 
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 password encryption/decryption

2014-05-31 Thread Massimo Di Pierro
We can help you read and validate Joomla passwords (you need a custom 
validator instead of CRYPT) but we do not know how:
$P$DryHu7D3LgdPOK//FPvuVMcMR13HgU1
was generated. What algorithm?
It does not appear to be compatible with what the docs 
say: http://stackoverflow.com/questions/10428126/joomla-password-encryption

In the case of web2py:
pbkdf2(1000,20,sha512)$a76b573005c73906$01f33be064bd2a283350206fd29355f9fa2b30fe

pbkdf2(1000,20,sha512) is the algorithm
a76b573005c73906 is the salt
01f33be064bd2a283350206fd29355f9fa2b30fe is the hashed password+salt.


On Friday, 30 May 2014 09:22:40 UTC-5, farmy zdrowia wrote:

 Hello,
 I'm trying to integrate web2py users to be stored in joomla  _users 
 database instead of auth_user. I can see joomla and web2py use different 
 algorithm do code/decode passwords.
 Joomla password looks like:
   $P$DryHu7D3LgdPOK//FPvuVMcMR13HgU1
 , while web2py
   
 pbkdf2(1000,20,sha512)$a76b573005c73906$01f33be064bd2a283350206fd29355f9fa2b30fe

 I'd like to change web2py default algorithm to code/decode passwords to be 
 similar to joomla simply to have common users database.
 Could you help a bit and guide me where this function is located and how 
 to change it?

  


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

2014-05-31 Thread Massimo Di Pierro
kpax is so old I would recommend it any more.

On Friday, 30 May 2014 16:28:04 UTC-5, yamandu wrote:

 We have some options as I know.

 Kpax from Massimo
 http://vimeo.com/1098656
 https://github.com/mdipierro/web2py-appliances/tree/master/KPax2


 Quoca and Movuca (more lika a social app) from Bruno Rocha
 http://quokkaproject.org/
 https://github.com/rochacbruno/Movuca

 https://code.google.com/p/instant-press/


 2014-05-30 17:52 GMT-03:00 Fabiano Almeida fabi...@techno7.com.br:

 Hi Andrey,

 Do you need a blog?


 2014-05-30 11:21 GMT-03:00 Andrey K kmelevs...@gmail.com:

 I am interested to add in CMS system for our web2py application.
  Quick search does not give me any solutions. Is there any CMS plugin 
 already or any recipes on it?
 Any thoughts, suggestions, links and comments would be very appreciated.
 Thank you in advance!

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


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




 -- 
 Att.

 Carlos J. Costa
 Cientista da Computação
 Esp. Gestão em Telecom

 EL MELECH NEEMAN!
 אָמֵן

 

-- 
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] Restore missing web2py.socket

2014-05-31 Thread lesssugar
I'm using web2py's ngix + uwsgi + centos configuration and I accidentally 
removed web2py/logs folder on my server. Now I get 502 bad gateway 
whenever I try to open my page.

nginx error log:

2014/05/31 13:16:50 [crit] 762#0: *1052 connect() to 
unix:///var/www/web2py/logs/web2py.socket failed (2: No such file or 
directory) while connecting to upstream, client: xxx.xx.xxx.xxx, server: 
xxx.com, request: GET / HTTP/1.1, upstream: 
uwsgi://unix:///var/www/web2py/logs/web2py.socket:, host: www.xxx.com

How can I restore web2py.socket file and get my website to work again? Any 
help 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] Re: Smartgrid onupdate still works while set to None

2014-05-31 Thread Anthony
On Friday, May 30, 2014 7:59:01 PM UTC-4, Pham Quang Dung wrote:

 Anybody enlighten me on while this form still updates the data? (I 
 expected it was disabled to then use my own callback)
 form = SQLFORM.smartgrid(db.anyinfo,onupdate=None
 ,constraints = dict(anyinfo = (tb.name
 [6:]=='level'))
 ,user_signature=False
 )


onupdate is an argument of SQLFORM.grid that SQLFORM.smartgid passes on. 
SQLFORM.grid then submits the onupdate callback as the onsuccess 
argument to SQLFORM.process for update forms. The onsuccess argument is 
simply a callback function that gets run after a form has been accepted 
(i.e., processed). There is no reason to set onupdate=None, as that will 
have no effect -- it does not turn off editing. If you want to turn off 
editing, set editable=False.
 

 Also is there a way to convert all the way to POST form (I am confused as 
 this was asserted in the manual, however it's GET while it reads args from 
 URI not form vars, right?)


Not sure what you mean here. If you are using the grid functionality to 
create or update records in the grid, the associated forms are POSTed. The 
query string is only used when searching the grid.

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: Restore missing web2py.socket

2014-05-31 Thread Niphlod
What did you do to install this setup ? having the socket inside /var/www 
is not something is usually done.
However, that error is nginx telling you that a socket you told him to 
listen to isn't there, so to fix the error I'd create the logs folder again 
and restart whatever process (supposedly uwsgi) creates that file.
The second step would be to review carefully the configuration ^_^

On Saturday, May 31, 2014 2:30:22 PM UTC+2, lesssugar wrote:

 I'm using web2py's nginx + uwsgi + centos configuration and I accidentally 
 removed web2py/logs folder on my server. Now I get 502 bad gateway 
 whenever I try to open my page.

 nginx error log:

 2014/05/31 13:16:50 [crit] 762#0: *1052 connect() to 
 unix:///var/www/web2py/logs/web2py.socket failed (2: No such file or 
 directory) while connecting to upstream, client: xxx.xx.xxx.xxx, server: 
 xxx.com, request: GET / HTTP/1.1, upstream: 
 uwsgi://unix:///var/www/web2py/logs/web2py.socket:, host: www.xxx.com

 How can I restore web2py.socket file and get my website to work again? Any 
 help 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] best method to check for auth membership (with no DB IO)

2014-05-31 Thread Michael Beller
I've been checking for auth membership to control access to menus and 
access to controller functions.  But they all require significant DB IO ...

Decorators:
@auth.requires_membership()

@auth.requires(lambda: auth.has_membership('customer_service') or auth.
has_membership('admin')) # potentially 4 database queries

@auth.requires(lambda: any([auth.has_membership(r) for r in [
'customer_service', 'admin']))

and

Conditions (e..g, to control menu display):
if auth.user and any (auth.has_membership(r) for r in ['customer_service', 
'admin']): # performs potentially 4 database queries

if auth.has_membership('customer_service'): # performs two database queries

All of the above require DB IO (using the lambda's defers the IO but not 
eliminate it).  After seeing the DB IO using db stats, I started exploring 
auth.user_groups and have tested these two option:

@auth.requires(any (role in ['customer_service', 'admin'] for role in auth.
user_groups.itervalues()))

if any (role in ['customer_service', 'admin'] for role in auth.user_groups.
itervalues()):

Is there any reason to not use these?  I understand auth.user_groups is 
cached but can be updated with auth.update_groups() if needed.


-- 
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: how to determine the server (name) ?

2014-05-31 Thread Stef Mientki

thanks Leonel and Michael.

forgot to tell there are 2 programs running at least on one of those 
servers, a web2py application and another application polling a solar 
system.

So I don't always have the request variable.

So I hoped I could use os.curdir, but for some unknown reason that 
doesn't work correctly.
Instead I now use platform.uname () which is unique enough (although on 
PythonAnyWhere the name of the server is not constant)


cheers,
Stef


On 30-05-14 14:24, Michael Beller wrote:
Depending on your server and hosting 
environment, request.env.http_host may always return '127.0.0.1:8000' 
when you're using the browser based shell (in admin) or running web2py 
from console.


I found it was more reliable to use request.env.web2py_path which 
always gave a unique path (in the browser shell, while running web2py 
from the shell, and normally) for the server environment.  I use this 
to detect my dev, test, or prod environment.

--
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 
mailto: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] How to change bootstrap theme of application ?

2014-05-31 Thread Neeraj Shukla
After replacing bootstrap.min.css located in static/css/ folder of 
application with another bootstrap.min.css changes are not getting 
reflected in application.

-- 
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] Is web2py compatible with bootstrap 3.1.1

2014-05-31 Thread sarfaraz ahmed
Is web2py compatible with bootstrap 3.1.1. if yes, please provide 
information about how to include new files in WEB2PY. Please let me 
question go to group

-- 
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: Is web2py compatible with bootstrap 3.1.1

2014-05-31 Thread samuel bonill







link: https://groups.google.com/forum/#!topic/web2py/oSABtjmnYM0


https://02632110730338943350.googlegroups.com/attach/eade9c3eca54120f/bs3_welcome.jpg?part=0.11view=1vt=ANaJVrEmWPpea5klqT4LkBT-6Ie1wctW-ojSGJIT_TJlsFHI2S7UDZDe9k58i4qpzIcA3IIcTD1zqAgJ85ZoRyPME_03GZId8zhNi6EbLvZL-Pcw4nnMnPM

-- 
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: Smartgrid onupdate still works while set to None

2014-05-31 Thread Massimo Di Pierro
Be aware that user_signature=False is very dangerous. It mostly meant for 
debugging. It exposes your grid read and write without restrictions to 
anybody authorized to access the action.

On Friday, 30 May 2014 18:59:01 UTC-5, Pham Quang Dung wrote:

 Anybody enlighten me on while this form still updates the data? (I 
 expected it was disabled to then use my own callback)
 form = SQLFORM.smartgrid(db.anyinfo,onupdate=None
 ,constraints = dict(anyinfo = (tb.name
 [6:]=='level'))
 ,user_signature=False
 )

 Also is there a way to convert all the way to POST form (I am confused as 
 this was asserted in the manual, however it's GET while it reads args from 
 URI not form vars, right?)


-- 
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] How to change bootstrap theme of application ?

2014-05-31 Thread Marco Mansilla
El Sat, 31 May 2014 12:02:30 -0700 (PDT)
Neeraj Shukla neerajdshu...@gmail.com escribió:

 After replacing bootstrap.min.css located in static/css/ folder of 
 application with another bootstrap.min.css changes are not getting 
 reflected in application.
 
take a look here:

http://www.web2pyslices.com/slice/show/1516/adapt-a-css-template-to-web2py-layouthtml

also you should check the link references in views/layout.html

Marco.

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