[web2py] type 'exceptions.ImportError'

2015-06-28 Thread Auden RovelleQuartz
Error ticket for omniavx_joeTicket ID

24.211.17.122.2015-06-28.08-43-36.388910c0-3f65-456d-bcf2-7ee2c50e441e
type 'exceptions.ImportError' No module named 
omniavx_joe.modules.app_constantsVersionweb2py™Version 
2.11.2-stable+timestamp.2015.05.30.16.33.24PythonPython 2.7.6: 
/usr/bin/python (prefix: /usr)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 227, in restricted
exec ccode in environment
  File /home/www-data/web2py/applications/omniavx_joe/models/db.py 
https://128.199.142.115/admin/default/edit/omniavx_joe/models/db.py, line 23, 
in module
from applications.omniavx_joe.modules.app_constants import * #CDN-16
  File /home/www-data/web2py/gluon/custom_import.py, line 108, in 
custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
ImportError: No module named omniavx_joe.modules.app_constants


this one is stumping me anyone has a clue on what could be causing this 
error?

(__init__.py is in the modules folder...)

-- 
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: dynamic query on web2py

2015-06-28 Thread 黄祥
thank you again, massimo, for told me the different between those two. 
first time, i choose the sort random, because it can run on google sql, but 
the orderby = 'random' is what i need since i don't run it on google sql 
and it random over all of my query rows.

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: distinct based on more than 1 field

2015-06-28 Thread Annet
For distinct to work you need orderby, I don't know if that works for more 
than one field.

orderby=db.person.firstname | db.person.familyname, distinct = True


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: dynamic query on web2py

2015-06-28 Thread Massimo Di Pierro
db().select(orderby='random')

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=random

On Saturday, 27 June 2015 07:28:09 UTC-5, 黄祥 wrote:

 yeah, something like that, but i don't know how to do an orderby with 
 random option in web2py. any idea how to achieve it in 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: languages.py, line 914 - error

2015-06-28 Thread Massimo Di Pierro
The traceback says:

File C:\web2py-m\applications\ipay\views\buy/index.html, line 184, in module

You should be able to look in the ticket for line 184 in the compiled 
index.html.


Anyway, open a ticket and we will think how to better report it.


On Saturday, 27 June 2015 16:45:44 UTC-5, Dmitry Ermolaev wrote:

 How seek this error in my translating file?
 Could You make a CHECK function to find that kind error?

 суббота, 27 июня 2015 г., 10:22:18 UTC+3 пользователь Massimo Di Pierro 
 написал:

 Consider this

 T(Hello %s, Dmitry)

 if Hello %s is translated with Ciao without the %s than 

 Ciao % Dmitry results in an error.

 The problem is the omission of a %s or or the addition of a %(name)s in 
 the translation, possibly a misspelling of he (name)?


 On Saturday, 27 June 2015 02:10:45 UTC-5, Dmitry Ermolaev wrote:

 Traceback (most recent call last):
   File C:\web2py-m\gluon\restricted.py, line 224, in restricted
 exec ccode in environment
   File C:\web2py-m\applications\ipay\views\buy/index.html, line 184, in 
 module
   File C:\web2py-m\gluon\html.py, line 612, in __init__
 text = str(text)
   File C:\web2py-m\gluon\languages.py, line 379, in __str__
 self.T.translate(self.m, self.s))
   File C:\web2py-m\gluon\languages.py, line 937, in translate
 message = self.params_substitution(message, symbols)
   File C:\web2py-m\gluon\languages.py, line 914, in params_substitution
 message = message % symbols
 ValueError: incomplete format


 some translates rise error (



-- 
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: distinct based on more than 1 field

2015-06-28 Thread Davy Jacops
This works indeed, and I can build an SQLTABLE based on the rows now.
Thank you.

Consequence is that SQLFORM.grid or smart grid cannot be used in this case?
(since there is no select statement possible, as it just takes a query?)


Op zaterdag 27 juni 2015 22:47:34 UTC+2 schreef villas:

 I think you need to use the distinct like this:

 rows = db(q).select(db.person.firstname, db.person.familyname, 
 distinct=True)


-- 
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: dynamic query on web2py

2015-06-28 Thread 黄祥
thank you so much for the pointer, massimo. anthony already point the url 
above.
e.g.
import random

def index():
limitby = (0, 5)
rows_random = db((db.product.quantity  0) ).select(limitby = 
limitby).sort(lambda row: random.random() )
return dict(rows_random = rows_random)

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: dynamic query on web2py

2015-06-28 Thread Massimo Di Pierro
There is a difference. If you have 100 records

rows = db(...).select(limitby = 10).sort(lambda row: random.random())

selects the first 10 out of 100 sorted by ID, then randomizes those 10.

rows = db(...).select(limitby = 10, orderby='ranomd')

gives you 10 randomly picked from the 100.

On Sunday, 28 June 2015 03:55:50 UTC-5, 黄祥 wrote:

 thank you so much for the pointer, massimo. anthony already point the url 
 above.
 e.g.
 import random

 def index():
 limitby = (0, 5)
 rows_random = db((db.product.quantity  0) ).select(limitby = 
 limitby).sort(lambda row: random.random() )
 return dict(rows_random = rows_random)

 thanks and best regards,
 stifan


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


Re: [web2py] Re: For those using ractive or vuejs. I need help !!

2015-06-28 Thread António Ramos
I dont use ractive. Only Vuejs and a template inside a script tag is what i
learned from the docs and video tutorials.

Is the

script type=text/x-template id=pote
span class=label label-info(%name%)/span
div
ul class=sortable-list
li v-repeat=item:items|only name macro-doses
pote='(%name%)' mp='(%item%)' myid=(%name%)
items=(%items%)/macro-doses/li
/ul
/div
/script

accepted by web2py without any compilation so vue can do its job?

Regards

2015-06-28 9:23 GMT+01:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 I am not sure but I think you are mixing ractive and vue syntax.

 In ractive you have a script/ and a div id=target/. The script is
 rendered in the target.

 In vue (which you use), the ractive code is in place but you still use a
 script instead of a div.

 Massimo


 On Saturday, 27 June 2015 12:34:31 UTC-5, Ramos wrote:

 No help :)
 Im doomed...
 Em 26/06/2015 17:29, António Ramos ramstei...@gmail.com escreveu:

 Hello ,
 so far so good i created my second vuejs page inside web2py and this
 time using components.


 my doformind.js has some components and changes the delimiters to avoid
 colision with curlies.

 Vue.config.delimiters = ['(%', '%)'];
 Vue.component('pote', {
   props: ['name','items'],
   template: '#pote' *- refering to the html template inside my page*
 });
 etc


 my html ...


 {{response.files.append(URL(r=request,c='static',f='/js/vue.min.js'))}}

 {{response.files.append(URL(r=request,c='static',f='/js/vue-resource.min.js'))}}
 {{response.files.append(URL(r=request,c='static',f='/js/toastr.js'))}}
 {{response.files.append(URL(r=request,c='static',f='/js/jquery-ui.js'))}}

 *{{response.files.append(URL(r=request,c='static',f='/js/doformind.js'))}}*
 {{response.files.append(URL(r=request,c='static',f='/css/toastr.css'))}}

 *{{response.files.append(URL(r=request,c='static',f='/css/doformind.css'))}}*
 {{extend 'layout.html'}}


 script type=text/x-template id=pote
 span class=label label-info(%name%)/span
 div
 ul class=sortable-list
 li v-repeat=item:items|only name
 macro-doses pote='(%name%)' mp='(%item%)' myid=(%name%)
 items=(%items%)/macro-doses/li
 /ul
 /div
 /script


 
 
 somewhere in my page i have this component

 pote name=1 items=(%items%)/pote



 All of this works very well outside web2py.

 Inside web2py i get a blank page and in chrome dev tools i see that
 pote name=1 items=(%items%)/pote
 was translated to
 pote name=1 items=[object Object],[object Object]/pote

 instead of

 pote name=1
 span class=label label-info1/span
 div
 ul class=sortable-list ui-sortable
 /ul
 /div/pote

 the items object have to elements each a json object.

 What could be the problem ?

 I suspect that the

 script type=text/x-template id=pote
 is not being correctly interpteted.

 Any comments would be very appreciated.

 Thank you

 António

   --
 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: For those using ractive or vuejs. I need help !!

2015-06-28 Thread Massimo Di Pierro
I am not sure but I think you are mixing ractive and vue syntax.

In ractive you have a script/ and a div id=target/. The script is 
rendered in the target.

In vue (which you use), the ractive code is in place but you still use a 
script instead of a div.

Massimo

On Saturday, 27 June 2015 12:34:31 UTC-5, Ramos wrote:

 No help :)
 Im doomed...
 Em 26/06/2015 17:29, António Ramos ramstei...@gmail.com escreveu:

 Hello ,
 so far so good i created my second vuejs page inside web2py and this time 
 using components.


 my doformind.js has some components and changes the delimiters to avoid 
 colision with curlies.

 Vue.config.delimiters = ['(%', '%)'];
 Vue.component('pote', {
   props: ['name','items'],
   template: '#pote' *- refering to the html template inside my page*
 });
 etc


 my html ...


 {{response.files.append(URL(r=request,c='static',f='/js/vue.min.js'))}}

 {{response.files.append(URL(r=request,c='static',f='/js/vue-resource.min.js'))}}
 {{response.files.append(URL(r=request,c='static',f='/js/toastr.js'))}}
 {{response.files.append(URL(r=request,c='static',f='/js/jquery-ui.js'))}}

 *{{response.files.append(URL(r=request,c='static',f='/js/doformind.js'))}}*
 {{response.files.append(URL(r=request,c='static',f='/css/toastr.css'))}}

 *{{response.files.append(URL(r=request,c='static',f='/css/doformind.css'))}}*
 {{extend 'layout.html'}}


 script type=text/x-template id=pote
 span class=label label-info(%name%)/span
 div
 ul class=sortable-list
 li v-repeat=item:items|only name macro-doses 
 pote='(%name%)' mp='(%item%)' myid=(%name%) 
 items=(%items%)/macro-doses/li
 /ul
 /div
 /script


 
 
 somewhere in my page i have this component

 pote name=1 items=(%items%)/pote



 All of this works very well outside web2py.

 Inside web2py i get a blank page and in chrome dev tools i see that 
 pote name=1 items=(%items%)/pote
 was translated to
 pote name=1 items=[object Object],[object Object]/pote

 instead of 

 pote name=1
 span class=label label-info1/span
 div
 ul class=sortable-list ui-sortable
 /ul
 /div/pote

 the items object have to elements each a json object.

 What could be the problem ?

 I suspect that the  

 script type=text/x-template id=pote
 is not being correctly interpteted.

 Any comments would be very appreciated.

 Thank you

 António

 

-- 
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] Suggestions for multiple files upload in form

2015-06-28 Thread Chaitu P
can anyone help.
I have copied all the files. But still not working.
When i clicked on the + button it is not showing popup window to choose
files.

On Fri, Jun 26, 2015 at 11:43 AM, Chaitu P chaitanya.pochampa...@gmail.com
wrote:

 Hi Paolo,

 I have installed your application and it is working perfectly.
 I want have same multiimage upload functionality in my application. So I
 changed one of the table names.
 But unfortunately it is not working. Iam not sure what Iam missing I have
 copied the css and js files as well.  Is there a way that you can help me.

 my controller:
 def new():
 # only SQLFORM.factory tested
 form=SQLFORM.factory(db.submission,db.t_photos)

 if form.accepts(request, session, onvalidation=lambda form:check(form)): #
 Is it possible to use onvalidation with form.process() syntax ?
 submission_id =
 db.submission.insert(**db.submission._filter_fields(form.vars))
 nfiles = 0
 for var in request.vars:
 if var.startswith('f_photo') and request.vars[var] != '':
 uploaded = request.vars[var]
 if isinstance(uploaded,list):
 # files uploaded through input with multiple attribute set on true
 counter=0
 for element in uploaded:
 counter += 1
 nfiles += 1
 file_title = element.name.split(:)[-1] # TODO: could this be made
 better?
  # I mean, the title must be appended to element's name
  # or is there another way?
 db.t_photos.insert(
 f_trip_ref=trip_id,
 f_title=file_title+ (+str(counter)+) if file_title!= else file_title,
 f_photo=db.t_photos.f_photo.store(element.file,element.filename))
 else:
 # only one file uploaded
 element = request.vars[var]
 nfiles += 1
 db.t_photos.insert(
 f_trip_ref=trip_id,
 f_title=element.name.split(:)[-1],
 f_photo=db.t_photos.f_photo.store(element.file,element.filename))

 session.flash = T('%s photo%s uploaded'%(nfiles, 's' if nfiles1 else ''))
 redirect(URL('teacher'))

 if isinstance(form,FORM):
 # hide f_title form's row. Is there a better way to accomplish it?
 del form[0][3]

 return dict(form=form)

 view:

 {{response.files.extend([URL('static','css/multiupload.css'),URL('static','js/jquery.multiupload.js')])}}
 {{left_sidebar_enabled=right_sidebar_enabled=False}}
 {{extend 'layout.html'}}
 div
 {{=form}}
 script type=text/javascript charset=utf-8
 //!--
 jQuery('input[name=f_photo]:not(.processed)').multiUpload({
 mw_placeholder:{{=T('insert a title')}},
 mw_text_addBtn:+,
 mw_tooltip_addBtn:{{=T('add a file')}},
 mw_text_clearBtn:x,
 mw_tooltip_clearBtn:{{=T('remove all')}},
 mw_tooltip_removeFileBtn:{{=T('remove this file')}},
 mw_tooltip_removeGroupBtn:{{=T('remove this file group')}},
 mw_group_title:{{=T('FILE GROUP')}},
 mw_fileNumber:false,
 mw_maxElementAllowed:5
 });
 //--
 /script
 /div

 model:

 db.define_table('submission',
 Field('name', requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()]),
 Field('email', requires=[IS_NOT_EMPTY(), IS_EMAIL()]),
 #Field('file','upload', requires=IS_NOT_EMPTY()),
 Field('status', readable=False,writable=False),
 Field('posted_on', 'date', default=request.now, readable=False,
 writable=False),
 Field('problem_id','reference problem',readable=False, writable=False))

 db.define_table('t_photos',
 Field('f_trip_ref', type='reference submission', notnull=True,
 writable=False, readable=False),
 Field('f_title', type='string', label=T('Title'), notnull=False), #
 notnull=False is required
 Field('f_photo', type='upload',
 uploadfolder=request.folder+'static/pictures', notnull=False, #
 notnull=False is required
 label=T('Photos'),
 represent=lambda x, row:x and A('%s'%(db.t_photos.f_photo.retrieve(x)[0]),
 _href=URL('default','viewer.html',args=x),
 _target=_blank,
 _title=T(open photo),
 _class='file-reference')
 or ''
 ),
 )




 On Friday, June 22, 2012 at 1:46:51 PM UTC-5, Paolo Caruccio wrote:

 Richard,

 I'm sorry for late answer. I spent a bit of time playing with bootstrap
 2.0.4 and rewriting the code to follow frequent web2py changes.

 In attached app, you'll find a rewieved version of multiuploads control
 and some bootstrap features (carousel, web2py flash messages replaced with
 bootstrap alert, form and form errors).

 I don't know if the approach  - that you'll see in app - is enough to
 satisfy your request, but It represents the way I would use.

 The app is a toy. I mean, you could find many bugs, not optimized code,
 and so on. Its scope is only to demonstrate multiuploads control  usage in
 an web2py application.



 Il giorno venerdì 1 giugno 2012 22:08:06 UTC+2, Richard ha scritto:

 No problem, I don't have time neither maybe for a couples of days too :)

 Richard

 On Fri, Jun 1, 2012 at 3:24 PM, Paolo Caruccio paolo.ca...@gmail.com
 wrote:

 Richard,

 I made some reflections on what you want to do and it's not easy, since
 the use of control for simultaneous upload of multiple files was aimed to
 replace the standard control. As an example of use, you can see
 http://ochiba77.blogspot.it/2012/01/web2py-slices-sending-email-from-form.html
  However, we can use a different approach to 

Re: [web2py] Re: Layout problem

2015-06-28 Thread Sébastien Loix
Yeah it's definitely a CSS not found. Did you double check the console and 
network tab (under Chrome) to see if all CSS files loaded correctly?

On Friday, 26 June 2015 13:58:45 UTC+2, Chaitu P wrote:

 Thank you for reply.
 Iam using windows operating system.
 I have created a new application in web2py and copied all the .html, 
 controller, db files and it is working fine.
 Iam just anxious to know the reason why it was happend.

 I don't think there is something wrong in my code because it worked fine 
 when I copied files to new application.

 Here is my one of my view code.

 {{extend 'layout.html'}}
 H3{{=A('Create a New Assignment',_href=URL(new))}}/H3
 ol
 {{for question in questions:}}
 {{=LI(A(H3(question.title), _href=URL(show, args=question.id)))}} 
 [created on {{=question.created_on}}]
  {{=HR()}}
 {{pass}}
 /ol
 p




 On Thu, Jun 25, 2015 at 1:33 PM, JorgeH jorg...@gmail.com javascript: 
 wrote:

 what is your development enviroment?
 Operating system
 Web server..


 On Thursday, June 25, 2015 at 3:17:13 AM UTC-5, Chaitu P wrote:


 Does anyone have idea why web2py default layout not working.

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




 -- 
 Chaitanya Pochampally
  

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


[web2py] new feature in trunk multi-word grid search.

2015-06-28 Thread Massimo Di Pierro
Until now multi world grid search would result in invalid query, but it 
now works. On Google App Engine if you search for pinco pallino it looks 
into all text fields for pinco pallino. On all the other supported 
backends, it search if for the separate existance of pinco and pallino 
in any text field.

-- 
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: New feature in trunk. bulk_register/invite

2015-06-28 Thread Massimo Di Pierro
OK but notice, anybody, not even logged in, can already register using 
somebody else's email address and that person would receive an unwanted 
email with a link to verify their email. Unless 
registration_requires_approval is set False.

So perhaps the condition should only kick in if 
registration_requires_approval is False.

On Sunday, 28 June 2015 09:57:17 UTC-5, Anthony wrote:

 I don't think this should be exposed by default for all users -- it should 
 be disabled by default and only enabled when done so explicitly by the 
 developer. I would think you would only want to expose this kind of 
 functionality to admin/trusted users -- otherwise, you are providing a way 
 for users to spam people and load your db.auth_user table with an unlimited 
 number of phantom registrations. A few other suggestions:

- Provide an easy API for specifying a required Auth role or set of 
roles that are allowed access to this functionality (as I think in most 
cases you would want to restrict its usage) -- something like 
auth.settings.bulk_register_roles.
- Add an option to specify a limit on the number of users that can be 
registered at a time (with some reasonable default, such as 100).
- Maybe provide a script or a function in admin/appadmin that can 
clean up db.auth_user by expunging bulk registrations that were not 
completed within some (configurable) time frame.
- Apply auth.settings.formstyle to the form.

 Anthony

 On Sunday, June 28, 2015 at 10:19:46 AM UTC-4, Massimo Di Pierro wrote:

 Hello web2py users,

 a new feature is in trunk, please help us test it.
 Originally developed here https://github.com/web2py/web2py/pull/985 as 
 invite has been renamed as bulk_register. It is available to all web2py 
 applications at this user:

 http://127.0.0.1:8000/welcome/default/user/bulk_register

 It allows you to specify a list of emails and an email messages. Those 
 people will be registered and will receive the email with a link to 
 complete registration.

 Please send comments, suggestions for improvements, bug reports.

 Massimo



-- 
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: type 'exceptions.ImportError'

2015-06-28 Thread Massimo Di Pierro
Not sure but you do not need

from applications.omniavx_joe.modules.app_constants import *

try instead:

from app_constants import *

less things can go bad

On Sunday, 28 June 2015 08:19:46 UTC-5, Auden RovelleQuartz wrote:

 Error ticket for omniavx_joeTicket ID

 24.211.17.122.2015-06-28.08-43-36.388910c0-3f65-456d-bcf2-7ee2c50e441e
 type 'exceptions.ImportError' No module named 
 omniavx_joe.modules.app_constantsVersionweb2py™Version 
 2.11.2-stable+timestamp.2015.05.30.16.33.24PythonPython 2.7.6: 
 /usr/bin/python (prefix: /usr)Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/restricted.py, line 227, in restricted
 exec ccode in environment
   File /home/www-data/web2py/applications/omniavx_joe/models/db.py 
 https://128.199.142.115/admin/default/edit/omniavx_joe/models/db.py, line 
 23, in module
 from applications.omniavx_joe.modules.app_constants import * #CDN-16
   File /home/www-data/web2py/gluon/custom_import.py, line 108, in 
 custom_importer
 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
 ImportError: No module named omniavx_joe.modules.app_constants


 this one is stumping me anyone has a clue on what could be causing 
 this error?

 (__init__.py is in the modules folder...)


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


[web2py] New feature in trunk. bulk_register/invite

2015-06-28 Thread Massimo Di Pierro
Hello web2py users,

a new feature is in trunk, please help us test it.
Originally developed here https://github.com/web2py/web2py/pull/985 as 
invite has been renamed as bulk_register. It is available to all web2py 
applications at this user:

http://127.0.0.1:8000/welcome/default/user/bulk_register

It allows you to specify a list of emails and an email messages. Those 
people will be registered and will receive the email with a link to 
complete registration.

Please send comments, suggestions for improvements, bug reports.

Massimo

-- 
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: New feature in trunk. bulk_register/invite

2015-06-28 Thread Anthony
I don't think this should be exposed by default for all users -- it should 
be disabled by default and only enabled when done so explicitly by the 
developer. I would think you would only want to expose this kind of 
functionality to admin/trusted users -- otherwise, you are providing a way 
for users to spam people and load your db.auth_user table with an unlimited 
number of phantom registrations. A few other suggestions:

   - Provide an easy API for specifying a required Auth role or set of 
   roles that are allowed access to this functionality (as I think in most 
   cases you would want to restrict its usage) -- something like 
   auth.settings.bulk_register_roles.
   - Add an option to specify a limit on the number of users that can be 
   registered at a time (with some reasonable default, such as 100).
   - Maybe provide a script or a function in admin/appadmin that can clean 
   up db.auth_user by expunging bulk registrations that were not completed 
   within some (configurable) time frame.
   - Apply auth.settings.formstyle to the form.
   
Anthony

On Sunday, June 28, 2015 at 10:19:46 AM UTC-4, Massimo Di Pierro wrote:

 Hello web2py users,

 a new feature is in trunk, please help us test it.
 Originally developed here https://github.com/web2py/web2py/pull/985 as 
 invite has been renamed as bulk_register. It is available to all web2py 
 applications at this user:

 http://127.0.0.1:8000/welcome/default/user/bulk_register

 It allows you to specify a list of emails and an email messages. Those 
 people will be registered and will receive the email with a link to 
 complete registration.

 Please send comments, suggestions for improvements, bug reports.

 Massimo


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


[web2py] New feature in trunk: API tokens

2015-06-28 Thread Massimo Di Pierro
There is a new feature in trunk. Support for native API tokens.

To enable in models/db.py use:

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


Then where appropriate replace 

@auth.requires_login()

def test(): return 'hello %s' % auth.user.first_name

with

@auth.requires_login_or_token()

def test(): return 'hello %s' % auth.user.first_name

Now your users can go to

http:///welcome/default/user/manage_tokens

create and expire tokens and call the decorated functions with

http:///welcome/default/test?_token=one-of-the-tokens


The token will give access to the function (test in the example) as if the 
user were logged in.

This will make it easier for you to create API for your app and delegate to 
your users the job of creating and expiring their tokens.


This is an EXPERIMENTAL feature. It works but it may change.


Please test, and submit comments/suggestions.


Massimo

-- 
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: Layout problem

2015-06-28 Thread Chaitu P
I appreciate your help. That worked.

On Sat, Jun 27, 2015 at 6:49 PM, Selman Kocael selciu...@gmail.com wrote:

 Every thing okay. But one thing missing. It is css file.

 In that page, right click and open source code, then search .css
 keyword. You must see this link:

 link rel=stylesheet href=/[your_app_name]/static/css/bootstrap.min.css
 /

 click the link, if you can't see this file check the static folder, if
 missing these files.

 you can copy other aplplications static folder to this application.
 (warning: if you didn't any addition in this folder.)







 2015-06-25 21:40 GMT+03:00 Chaitu P chaitanya.pochampa...@gmail.com:

 Thank you for reply.
 Iam using windows operating system.
 I have created a new application in web2py and copied all the .html,
 controller, db files and it is working fine.
 Iam just anxious to know the reason why it was happend.

 I don't think there is something wrong in my code because it worked fine
 when I copied files to new application.

 Here is my one of my view code.

 {{extend 'layout.html'}}
 H3{{=A('Create a New Assignment',_href=URL(new))}}/H3
 ol
 {{for question in questions:}}
 {{=LI(A(H3(question.title), _href=URL(show, args=question.id)))}}
 [created on {{=question.created_on}}]
  {{=HR()}}
 {{pass}}
 /ol
 p




 On Thu, Jun 25, 2015 at 1:33 PM, JorgeH jorgeh...@gmail.com wrote:

 what is your development enviroment?
 Operating system
 Web server..


 On Thursday, June 25, 2015 at 3:17:13 AM UTC-5, Chaitu P wrote:


 Does anyone have idea why web2py default layout not working.

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




 --
 Chaitanya Pochampally

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




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




-- 
Chaitanya Pochampally

-- 
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] New feature in trunk. bulk_register/invite

2015-06-28 Thread Ovidio Marinho
ok - testing





   [image: http://itjp.net.br] http://itjp.net.br
 http://itjp.net.b http://itjp.net.brr
  *Ovidio Marinho Falcao Neto*
 ovidio...@gmail.com
Brasil


2015-06-28 11:19 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com:

 Hello web2py users,

 a new feature is in trunk, please help us test it.
 Originally developed here https://github.com/web2py/web2py/pull/985 as
 invite has been renamed as bulk_register. It is available to all web2py
 applications at this user:

 http://127.0.0.1:8000/welcome/default/user/bulk_register

 It allows you to specify a list of emails and an email messages. Those
 people will be registered and will receive the email with a link to
 complete registration.

 Please send comments, suggestions for improvements, bug reports.

 Massimo

 --
 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: New feature in trunk. bulk_register/invite

2015-06-28 Thread Massimo Di Pierro
I have done what you suggest, except for the cleanup-script.

I added auth.settings.bulk_register_enabled = False

We can than leave to the developer to do something like:

self.setting.bulk_register_enabled  =  auth.has_membership(role='whatever')

On Sunday, 28 June 2015 10:05:45 UTC-5, Massimo Di Pierro wrote:

 OK but notice, anybody, not even logged in, can already register using 
 somebody else's email address and that person would receive an unwanted 
 email with a link to verify their email. Unless 
 registration_requires_approval is set False.

 So perhaps the condition should only kick in if 
 registration_requires_approval is False.

 On Sunday, 28 June 2015 09:57:17 UTC-5, Anthony wrote:

 I don't think this should be exposed by default for all users -- it 
 should be disabled by default and only enabled when done so explicitly by 
 the developer. I would think you would only want to expose this kind of 
 functionality to admin/trusted users -- otherwise, you are providing a way 
 for users to spam people and load your db.auth_user table with an unlimited 
 number of phantom registrations. A few other suggestions:

- Provide an easy API for specifying a required Auth role or set of 
roles that are allowed access to this functionality (as I think in most 
cases you would want to restrict its usage) -- something like 
auth.settings.bulk_register_roles.
- Add an option to specify a limit on the number of users that can be 
registered at a time (with some reasonable default, such as 100).
- Maybe provide a script or a function in admin/appadmin that can 
clean up db.auth_user by expunging bulk registrations that were not 
completed within some (configurable) time frame.
- Apply auth.settings.formstyle to the form.

 Anthony

 On Sunday, June 28, 2015 at 10:19:46 AM UTC-4, Massimo Di Pierro wrote:

 Hello web2py users,

 a new feature is in trunk, please help us test it.
 Originally developed here https://github.com/web2py/web2py/pull/985 as 
 invite has been renamed as bulk_register. It is available to all web2py 
 applications at this user:

 http://127.0.0.1:8000/welcome/default/user/bulk_register

 It allows you to specify a list of emails and an email messages. Those 
 people will be registered and will receive the email with a link to 
 complete registration.

 Please send comments, suggestions for improvements, bug reports.

 Massimo



-- 
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: New feature in trunk. bulk_register/invite

2015-06-28 Thread Anthony
On Sunday, June 28, 2015 at 11:05:45 AM UTC-4, Massimo Di Pierro wrote:

 OK but notice, anybody, not even logged in, can already register using 
 somebody else's email address and that person would receive an unwanted 
 email with a link to verify their email. Unless 
 registration_requires_approval is set False.


True, but in order to do bulk spam, you would either have to spend a lot of 
time or have the technical sophistication to automate via a script -- we 
don't have to make it easier.

In any case, whether or not this facilitates abuse, I would still say it is 
not a feature that most developers would necessarily want available by 
default (unlike register, profile, login, recover password, which are all 
essential elements of a login system). This is specialized functionality 
that will only be desirable in some cases.

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: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
IMHO token should not be restricted to a var... it should be also possible 
to use an header...

Performance-wise...as it is it's as bad as it could possibly be.
1) the extra table needs a solid unique=True on the token field: we don't 
want to do a full scan of that table for every request protected by the 
decorator...and we protect ourselves from colliding uuids.
2) why do we need 2 separate queries (one for the token, the other for the 
id ) ?

Moreover, the grid embedded in manage_tokens is a quick - but dirty - way 
to manage those... There's no restrictions on the tokens that are generated 
(the whole table is exposed). Plus, it lacks any possibility of 
customization: given the abnormal abundance of arguments we added to grid 
initialization to accomodate zillions of users, I'd say it will pop up soon 
enough the need of passing something to that grid.
We should expose an API to manage tokens, not a grid...

On Sunday, June 28, 2015 at 4:56:35 PM UTC+2, Massimo Di Pierro wrote:

 There is a new feature in trunk. Support for native API tokens.

 To enable in models/db.py use:

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


 Then where appropriate replace 

 @auth.requires_login()

 def test(): return 'hello %s' % auth.user.first_name

 with

 @auth.requires_login_or_token()

 def test(): return 'hello %s' % auth.user.first_name

 Now your users can go to

 http:///welcome/default/user/manage_tokens

 create and expire tokens and call the decorated functions with

 http:///welcome/default/test?_token=one-of-the-tokens


 The token will give access to the function (test in the example) as if the 
 user were logged in.

 This will make it easier for you to create API for your app and delegate 
 to your users the job of creating and expiring their tokens.


 This is an EXPERIMENTAL feature. It works but it may change.


 Please test, and submit comments/suggestions.


 Massimo


-- 
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: expire user password

2015-06-28 Thread Massimo Di Pierro
There is no built-in mechanism since we do not store the time when a 
password changes but you can do it in this way:

auth.settings.extra_fields['auth_user'] = 
[Field('password_charged_on','datetime',compute=lambda row: row.password 
and request.now, writable=False)]

if auth.user and auth.user.password_charged_on + 
datetime.timedelta(days=30)request.now: redirect(URL('some_error_page'))

On Sunday, 28 June 2015 14:58:46 UTC-5, 黄祥 wrote:

 hi,

 just wondering is it possible to have expire password in web2py 
 application? perhaps something like the most os have (windows, linux) that 
 have an option to set the user password is expired let say in 90 days, or 
 30 days.

 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] expire user password

2015-06-28 Thread 黄祥
hi,

just wondering is it possible to have expire password in web2py 
application? perhaps something like the most os have (windows, linux) that 
have an option to set the user password is expired let say in 90 days, or 
30 days.

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: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
PS: the code doesn't take into consideration an expired token. the mere 
existance of the record allows the authentication.

-- 
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: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
Ok, read it carefullyAll of that IMHO isn't really what users wants to 
implement a token-based auth on top of an API.
Apart from the fact that if the scheme of the tokens table gets corrected 
(a FK to the user_id and token unique) the first two queries are 
collapsible into one, calling login_user() triggers update_groups() (not 
sure if an API needs it for every call), plus it renews the session (that 
in an API isn't there for sure), and creates a new Session (and again, the 
cookie-based Session isn't something an API uses or requires)

The way I see it, a token-based authentication is good for a kind of 
cached/speedy authentication. You expect zillion calls to an API and you 
don't want username/passwords flying around, so you publish something 
behind the usual auth that generates a code what identifies you. Or you 
have a zillions mini-programs that needs to call the api and you don't want 
to store username-password combo in each and every program, so you request 
a token. Usually the token is also generated for a scope, so, e.g., the 
authenticated user with the token can't invalidate all other tokens...of 
change the profile email, etc etc. This goes beyond the scope of a simple 
helper in web2py and goes towards being an oauth provider an entire 
different story.
Let's assume though that the token auth gets the same permissions as the 
usual one... who you are (when you generated the token) is only one piece 
of the info: the other piece is what you're allowed to do with that token.
For all intents and purposes, a token-based auth for an API IMHO 
resembles very closely what in non-API environments is persisted in web2py 
with the Session (under the hook a cookie with the sesson id). Specifically 
the session.auth part.

non-api: You login, the heavy auth thingies take place there and only 
there (are you a valid user, is your password correct, which groups are you 
in, did you complete the registration process, and so on), and from there 
on you are issued a lightweight Session that relieves web2py from 
constantly checking at every request who you are and what you can do 
(through membership)

api: you request a token for your login, the heavy auth thingies take 
place there and only there, and you're issued a lightweight token (with 
an optional expiration) that relieves web2py from costantly checking who 
you are and what can you do. 

This naming (api_tokens) collides with the implementation: it's slower than 
the default (thinking about basic auth) because it requires at least 3 
queries for any call (1) is there a token, 2) is there a user with that id 
(duh?), are there groups for that user). On top of that, it creates a new 
session for every call. As it is, it'd better implemented as a new login 
method (and BTW, it surely is just a login method), living in contrib.



-- 
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] Peculiar behavior of request.vars inside URL() (BUG?)

2015-06-28 Thread Robert Porter
I have lat/lng coordinates in my request.vars['coords'] saved with a '|' 
separating each coordinate.  When I use URL(request.vars['coords']), it 
converts the '|' into '%7C'.

This seems like a web2py error, but please let me know if I've made a 
mistake.  And please let me know if there's some workaround.

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] GUI crossroads: Cappuccino and/or web2py

2015-06-28 Thread Phillip Veda


I started a project in web2py aimed to store and manipulate user files, 
which at some point needs a dynamic GUI interface.


Due to the intensive nature of the file processing, I am unsure whether 
embedding this python code would be very price-sensitive as deployed to GAE 
with its server-side processing (but please correct me if I am 
misinterpreting how the code will be processed or if there is an easy way 
around this (a client-side processing implementation))


Due to the lack of information in cross-referencing Web2py with Cappuccino, 
I assume combining their mechanisms would be an untenable prospect.


If nothing else, web2py was a great place to start learning web development


Thank you for any input

-- 
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: Bug in XML(...,sanitize=True) ?

2015-06-28 Thread Brian M
Thank you Massimo!

On Saturday, June 27, 2015 at 12:34:18 AM UTC-5, Massimo Di Pierro wrote:

 The bug was introduced yesterday. Fixed in trunk now.


 On Saturday, 27 June 2015 00:12:10 UTC-5, Massimo Di Pierro wrote:

 I this with the latest trunk or earlier version. It may be a recent bug. 
 Will fix it today.

 On Friday, 26 June 2015 18:05:27 UTC-5, Brian M wrote:

 I'm working on upgrading to the latest web2py version and may have 
 uncovered a bug in the sanitizer. If you use XML(form.var.something, 
 sanitize=True) and form.var.something is just a plain string without any 
 tags then what you end up getting returned is an empty string rather than 
 the original string.  I don't think this is the intended behavior and 
 certainly wasn't the behavior in earlier versions.  Have I been using XML() 
 wrong all this time or is this a bug?



-- 
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: New feature in trunk: API tokens

2015-06-28 Thread Massimo Di Pierro
as you suggested I added unique=True
as you suggested I reduced the number of db queries from 2 to 1 (when not 
on GAE)
yes it should check for expiration (will add that)
as you suggested you can now use a header (web2py_api_token) instead of 
?_token=...
I think the manage_tokens page is useful so I will leave it there. 

I also agree with you that this is more like a login method except that it 
only works for decorated actions so developer can choose where to allow 
this. It does not have to create a session but it may. I would recommend 
using session.forget() within the decorated actions but I do not think it 
should be default. I can see programs that may want a session to be created.

I am happy to change api_tokens name with something else. What do you 
suggest?

Massimo


On Sunday, 28 June 2015 16:36:24 UTC-5, Niphlod wrote:

 Ok, read it carefullyAll of that IMHO isn't really what users wants to 
 implement a token-based auth on top of an API.
 Apart from the fact that if the scheme of the tokens table gets corrected 
 (a FK to the user_id and token unique) the first two queries are 
 collapsible into one, calling login_user() triggers update_groups() (not 
 sure if an API needs it for every call), plus it renews the session (that 
 in an API isn't there for sure), and creates a new Session (and again, the 
 cookie-based Session isn't something an API uses or requires)

 The way I see it, a token-based authentication is good for a kind of 
 cached/speedy authentication. You expect zillion calls to an API and you 
 don't want username/passwords flying around, so you publish something 
 behind the usual auth that generates a code what identifies you. Or you 
 have a zillions mini-programs that needs to call the api and you don't want 
 to store username-password combo in each and every program, so you request 
 a token. Usually the token is also generated for a scope, so, e.g., the 
 authenticated user with the token can't invalidate all other tokens...of 
 change the profile email, etc etc. This goes beyond the scope of a simple 
 helper in web2py and goes towards being an oauth provider an entire 
 different story.
 Let's assume though that the token auth gets the same permissions as the 
 usual one... who you are (when you generated the token) is only one piece 
 of the info: the other piece is what you're allowed to do with that token.
 For all intents and purposes, a token-based auth for an API IMHO 
 resembles very closely what in non-API environments is persisted in web2py 
 with the Session (under the hook a cookie with the sesson id). Specifically 
 the session.auth part.

 non-api: You login, the heavy auth thingies take place there and only 
 there (are you a valid user, is your password correct, which groups are you 
 in, did you complete the registration process, and so on), and from there 
 on you are issued a lightweight Session that relieves web2py from 
 constantly checking at every request who you are and what you can do 
 (through membership)

 api: you request a token for your login, the heavy auth thingies take 
 place there and only there, and you're issued a lightweight token (with 
 an optional expiration) that relieves web2py from costantly checking who 
 you are and what can you do. 

 This naming (api_tokens) collides with the implementation: it's slower 
 than the default (thinking about basic auth) because it requires at least 3 
 queries for any call (1) is there a token, 2) is there a user with that id 
 (duh?), are there groups for that user). On top of that, it creates a new 
 session for every call. As it is, it'd better implemented as a new login 
 method (and BTW, it surely is just a login method), living in contrib.





-- 
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: subprocess.call output to a file

2015-06-28 Thread Chaitu P
Thank you that worked..


On Thu, Jun 25, 2015 at 11:46 AM, Leonel Câmara leonelcam...@gmail.com
wrote:

 You need to set stdout to be a file like object, so just open a file in
 write mode and use that as the stdout.

 Something like:

 ofile = open(path_to_the_output_file, 'w')
 subprocess.call([./x], stdout=ofile)



 If you don't need to save the output to a file and you just want to
 compute something with it you can just do:

 output = subprocess.call([./x], stdout=subprocess.PIPE)



 And output will have the result.

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




-- 
Chaitanya Pochampally

-- 
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: Peculiar behavior of request.vars inside URL() (BUG?)

2015-06-28 Thread villas
Hi Robert,  
I think args and vars are all url encoded.  
I think I worked around it with urllib.unquote( string ) when I hit this 
problem.
Regards,  D

-- 
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: GUI crossroads: Cappuccino and/or web2py

2015-06-28 Thread villas
I do not know Cappuchino but it is an interesting concept for 'desktop' 
client-side apps.  
So a Cappuchino client-side app could connect to your Web2py server-side 
app.
At any rate,  I suppose Cappuchino must connect to a server for DB 
functionality,  so why not Web2py running on GAE or elsewhere.
However,  I find that web2py creates apps good enough for my business these 
days.

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


[web2py] new (actually old) feature in trunk: /welcome/appadmin/manage/auth

2015-06-28 Thread Massimo Di Pierro
How many of you know of the existence of this page?

http://... /welcome/appadmin/manage/auth

Nobody knows because of the number of steps required to give a user access 
to the page.
A recent change in trunk give the administrator access by default (that was 
not the case). So you can try it. 

If you find it useful and want to give some users of the app access to this 
page without giving them access to the full appadmin, create a group 
auth-managers, make them member of the group, and in your model:

auth.settings.auth_manager_role = auth-managers


Massimo

-- 
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] new (actually old) feature in trunk: /welcome/appadmin/manage/auth

2015-06-28 Thread Vinicius Assef
Is it documented anywhere?

 On 28 Jun 2015, at 19:13, Massimo Di Pierro massimo.dipie...@gmail.com 
 wrote:
 
 How many of you know of the existence of this page?
 
 http://... /welcome/appadmin/manage/auth
 
 Nobody knows because of the number of steps required to give a user access to 
 the page.
 A recent change in trunk give the administrator access by default (that was 
 not the case). So you can try it. 
 
 If you find it useful and want to give some users of the app access to this 
 page without giving them access to the full appadmin, create a group 
 auth-managers, make them member of the group, and in your model:
 
 auth.settings.auth_manager_role = auth-managers
 
 
 
 Massimo
 
 
 -- 
 Resources:
 - http://web2py.com http://web2py.com/
 - http://web2py.com/book http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py http://github.com/web2py/web2py (Source 
 code)
 - https://code.google.com/p/web2py/issues/list 
 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 
 https://groups.google.com/d/optout.

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


[web2py] Re: How do I check of the version of pysimplesoap in web2py.

2015-06-28 Thread Encompass solutions
Thanks for the hints.  I think mine is sending ok but there is something 
with the receiving side of things.  (response)  I am going to try to grab 
just what I need from the xml response when it doesn't work like it should.
BR,
Jason Brower


On Thursday, June 25, 2015 at 12:30:42 AM UTC+3, Limedrop wrote:

 SOAP can really be a world of pain.  I spent hours trying to connect to a 
 SOAP service and the best I could get was a 400 Bad Request.  It turned 
 out that they were using wsHttpBinding - which seems to only be supported 
 by .NET clients.  The work-around is to manually inject the WS-Security 
 headers into the SOAP envelope.  In the end I gave up and reverted to a 
 service using basicHttp binding.

 Long story, short: pysimplesoap works really well.  It is SOAP itself that 
 is overly complex and mostly broken.

 And for anyone out there experiencing the pain, here's some sample code 
 that I use as a sanity check.  The 'trace' option leaves a nice trail on 
 the console - but remember to turn it off in production.

 from gluon.contrib.pysimplesoap.client import SoapClient, 
 SoapFault
 url = http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL;
 client = SoapClient(wsdl=url, trace = True) 
 
 parameters = {}
 parameters['ZIP'] = 90210
 
 try:
 response = 
 client.GetCityWeatherByZIP(**parameters) 
 except SoapFault as e:
 response = ERROR {0}: {1}.format(e.faultcode, 
 e.faultstring)


 On Thursday, 25 June 2015 06:32:00 UTC+12, Dave S wrote:



 On Wednesday, June 24, 2015 at 4:39:57 AM UTC-7, Encompass solutions 
 wrote:

 Found it.  it's in the init.py file in gluon/contrib/pysimplesoap/
 It's version 1.11 which is a little behind, but there are some 
 regression as of last year, we should check before bumping up the version.


 FWIW, I also use pysimplesoap (it's what brought me to web2py), both with 
 a third party target and with my own SOAP target.  It works well with these.

 I tried using it with a different third party target that had some 
 special WSDL handling required , and I wasn't successful with that.  I had 
 some conversations here about it, and the dev (M Reingart) tried to help, 
 but I didn't know my way around the code well enough to nail things down, 
 and didn't have time then to come more up to speed.  (I have a TooManyTabs 
 bookmark for Fixing Broken WSDL)


 /dps



 On Wednesday, June 24, 2015 at 9:52:08 AM UTC+3, Encompass solutions 
 wrote:

 I am trying to use soap and I am comming across errors from 2012 is the 
 version included in web2py always the latest with each new version of 
 web2py?  I do I check what version is included?
 I am getting a Tag not found: service (No elements found) error when 
 trying to get the wsdl file. (The file seems very good and well tested)
 BR,
 Jason



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


Re: [web2py] Re: New feature in trunk: API tokens

2015-06-28 Thread Jason (spot) Brower
Name: Bearer Token?
http://self-issued.info/docs/draft-ietf-oauth-v2-bearer.html
Or am I wrong?


On Mon, Jun 29, 2015 at 1:08 AM Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 as you suggested I added unique=True
 as you suggested I reduced the number of db queries from 2 to 1 (when not
 on GAE)
 yes it should check for expiration (will add that)
 as you suggested you can now use a header (web2py_api_token) instead of
 ?_token=...
 I think the manage_tokens page is useful so I will leave it there.

 I also agree with you that this is more like a login method except that it
 only works for decorated actions so developer can choose where to allow
 this. It does not have to create a session but it may. I would recommend
 using session.forget() within the decorated actions but I do not think it
 should be default. I can see programs that may want a session to be created.

 I am happy to change api_tokens name with something else. What do you
 suggest?

 Massimo


 On Sunday, 28 June 2015 16:36:24 UTC-5, Niphlod wrote:

 Ok, read it carefullyAll of that IMHO isn't really what users wants
 to implement a token-based auth on top of an API.
 Apart from the fact that if the scheme of the tokens table gets corrected
 (a FK to the user_id and token unique) the first two queries are
 collapsible into one, calling login_user() triggers update_groups() (not
 sure if an API needs it for every call), plus it renews the session (that
 in an API isn't there for sure), and creates a new Session (and again, the
 cookie-based Session isn't something an API uses or requires)

 The way I see it, a token-based authentication is good for a kind of
 cached/speedy authentication. You expect zillion calls to an API and you
 don't want username/passwords flying around, so you publish something
 behind the usual auth that generates a code what identifies you. Or you
 have a zillions mini-programs that needs to call the api and you don't want
 to store username-password combo in each and every program, so you request
 a token. Usually the token is also generated for a scope, so, e.g., the
 authenticated user with the token can't invalidate all other tokens...of
 change the profile email, etc etc. This goes beyond the scope of a simple
 helper in web2py and goes towards being an oauth provider an entire
 different story.
 Let's assume though that the token auth gets the same permissions as the
 usual one... who you are (when you generated the token) is only one piece
 of the info: the other piece is what you're allowed to do with that token.
 For all intents and purposes, a token-based auth for an API IMHO
 resembles very closely what in non-API environments is persisted in web2py
 with the Session (under the hook a cookie with the sesson id). Specifically
 the session.auth part.

 non-api: You login, the heavy auth thingies take place there and only
 there (are you a valid user, is your password correct, which groups are you
 in, did you complete the registration process, and so on), and from there
 on you are issued a lightweight Session that relieves web2py from
 constantly checking at every request who you are and what you can do
 (through membership)

 api: you request a token for your login, the heavy auth thingies take
 place there and only there, and you're issued a lightweight token (with
 an optional expiration) that relieves web2py from costantly checking who
 you are and what can you do.

 This naming (api_tokens) collides with the implementation: it's slower
 than the default (thinking about basic auth) because it requires at least 3
 queries for any call (1) is there a token, 2) is there a user with that id
 (duh?), are there groups for that user). On top of that, it creates a new
 session for every call. As it is, it'd better implemented as a new login
 method (and BTW, it surely is just a login method), living in contrib.



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