[web2py] Re: MARKMIN problem with email addresses

2015-05-31 Thread Massimo Di Pierro
Actually technically all domain names are supposed to end in . 

http://www.dns-sd.org/trailingdotsindomainnames.html

The . is usually omitted because the DNS understand it anyway.

On Saturday, 30 May 2015 06:49:12 UTC-5, David Manns wrote:

 This can be resolved by changing one line in markmin2html.py
 554 regex_auto = 
 re.compile(r'(?![\w/=])(?Pk\w+://[\w\d\-+_=?%/:.,;#]+\w|[\w\-.]+@[\w\-.]+)',re.M)
 to 
 554 regex_auto = 
 re.compile(r'(?![\w/=])(?Pk\w+://[\w\d\-+_=?%/:.,;#]+\w|[\w\-.]+@[\w\-.]*\w+)',re.M)

 It seems reasonable that a domain name should not end in '.' or '-'


 On Wednesday, May 27, 2015 at 9:17:58 AM UTC-4, David Manns wrote:

 Using MARKMIN helper, if the string includes something like ... text 
 some...@somewhere.com. Another sentence ...  the period following the 
 email address is incorrectly included in the email link.



-- 
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] Fixing cursor issues in Web2Py on Google AppEngine?

2015-05-31 Thread Michael Jackson


I have a simple UI for interacting with a database set up on a Google 
AppEngine application using Web2Py. I'm using the default Grid builder to 
settings to display it. Here is my full controller function:

@auth.requires_login()def managePeople():

  # To hide the ID column from being seen on this page
  db.People.id.readable = False
  db.People.id.writable = False

  people = SQLFORM.grid(db.People, paginate = 15)

  # To allow for CSV imports on this page
  if request.vars.csvfile != None:
db.People.import_from_csv_file(request.vars.csvfile.file)
response.flash = 'Data uploaded'

  return dict(people=people)

I have over 15 records in the database, so when it's rendered it does 
correctly cut off just 15 people and displays the next button in the bottom 
of the grid. But when I click on it I get a: Query Not Supported: Unknown 
configuration option ('cursor') error. The resulting url was something 
like:

http://localhost:8080/peopleapp/ui/managePeople?cursor=Cursor%28%3CCjUSL2oWZGV2fmdyYWRzdHVkZW50Y2hlY2tpbnIVCxIIU3R1ZGVudHMYgICAgICAoAoMGAAgAA%3D%3D%3E%29page=2_signature=f3916524c6c595a8f15ed3acc2750b0d49af7702

I looked into this and apparently cursor is no longer an option in GAE 
according to this page: NDB Query Class 
https://cloud.google.com/appengine/docs/python/ndb/queryclass. I tried 
manually changing the option cursor in the url to start_cursor since this 
is one of the new supported options. After doing this it loads without any 
errors, but it just displays page 1 again instead of moving on to the 
second page.

At this point I was thoroughly confused and couldn't think of how to 
continue. Any suggestions or help is welcome. I'm sure I could build 
something like grid but I really don't want to if I have the option of 
using this robust built-in tool.

-- 
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: Syntax for exiting grid function

2015-05-31 Thread Massimo Di Pierro
I do not understand what you mean by return to the grid with a value. 
Anyway, you can't because the gird urls are signed.

On Sunday, 31 May 2015 08:07:37 UTC-5, Alex Glaros wrote:

 I want to send user to a child grid function to select a row value and 
 then return to the parent function with the value.

 Right now, I just send user to the child grid controller first from the 
 main menu, then user clicks button in the selected row, and a redirect 
 takes him to the parent controller.

 I think I can just embed a call to the child controller in the parent 
 controller so that I don't have to send user to child controller first, but 
 what is the syntax for exiting child function with the value?

 The button in child function for the current way looks like this:

 links=[dict(header='Add relationship',  body=lambda row: A('Assign person 
 to role',_class=btn btn-success btn-mini, _href=URL(
 'add_person_to_roles_and_relationships', args=row.id, vars=request.vars
 )))], links_placement = 'left')   
 return dict(grid=grid)

 If call to child is inside the parent controller what is syntax for 
 exiting child function and passing vars to parent?  Currently, it exits 
 with a redirect.  Also, what does the return statement look like in the 
 child function?

 The structure I want looks something like this:

 PARENT_FUNCTION():
 child_function, args=args # this child function selects a value parent 
 uses below
 continue doing work inside the parent function
 return locals()

 thanks,

 Alex Glaros


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


Re: [web2py] Re: web2py 2.11.2 is OUT

2015-05-31 Thread Vikash Sharma
Last time I raised this issue, I was asked to refresh chrome cache, as
chrome might be using old cached data.
And it worked for me.

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

On Sun, May 31, 2015 at 12:15 PM, Simon Ashley gregs...@gmail.com wrote:

 On windows 8.1 and Chrome, I'm finding the Welcome screen badly formatted
 (no visible menus, unusual buttons etc).
 Under Firefox and IE11. its fine.


 https://lh3.googleusercontent.com/-yQKhCtaMTqo/VWqtmgjCH9I/Aaw/hcHQ7F-pxCs/s1600/chrome%2B2.11.2.png


 On Sunday, 31 May 2015 02:37:25 UTC+10, Massimo Di Pierro wrote:

 There was a problem with 2.11.1 and it has been addressed in 2.11.2.
 Please skip 2.11.1 and report any issue you may find with 2.11.2.

 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] What is Hooks in Database Administration in appadmin ?

2015-05-31 Thread Πέτρος Χατζηλάμπρος
When I go to http://localhost:8000/[myapplication]/appadmin I see a tab 
which is named Hooks.

When I click on it it shows nothing.

What is this? Is it a feature that I miss ?

-- 
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: Initialise a list integer field with zeros on GAE with 2.10.4

2015-05-31 Thread Massimo Di Pierro
No. It is not can you please open a ticket about this?

On Thursday, 28 May 2015 00:16:55 UTC-5, Donald McClymont wrote:

 It seems the following field definition in a model file doesn't currently 
 work with GAE - however it is fine on SQLite?

 Field('questcounts','list:integer',default=[0, 0, 0, 0, 0],


 I think I can work around it by sticking an extra element that I don't use at 
 the end and giving it a value.


 Field('questcounts','list:integer',default=[0, 0, 0, 0, 0, 1],


 however I am presuming this is not intended behaviour?





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


[web2py] Re: web2py 2.11.2 is OUT

2015-05-31 Thread Massimo Di Pierro
This is strange because the folder should be created by web2py.
Anybody else having a similar problem?

On Sunday, 31 May 2015 00:49:19 UTC-5, 黄祥 wrote:

 just tested the newest version it seems that cache folder is very 
 important directory (not found any explaination about this on book)
 e.g.
 *Pack All*
 internal error: [Error 3] The system cannot find the path specified: 
 'C:/web2py/applications/test/cache/cache'

 *Clean*
 Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.

 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 227, in restricted
 exec ccode in environment
   File C:/web2py/applications/admin/controllers/default.py 
 https://127.0.0.1/admin/default/edit/admin/controllers/default.py, line 
 1945, in module
   File C:\web2py\gluon\globals.py, line 412, in lambda
 self._caller = lambda f: f()
   File C:/web2py/applications/admin/controllers/default.py 
 https://127.0.0.1/admin/default/edit/admin/controllers/default.py, line 
 448, in cleanup
 clean = app_cleanup(app, request)
   File C:\web2py\gluon\admin.py, line 122, in app_cleanup
 CacheOnDisk(folder=path).clear()
   File C:\web2py\gluon\cache.py, line 492, in clear
 self.initialize()
   File C:\web2py\gluon\cache.py, line 439, in initialize
 os.mkdir(folder)
 WindowsError: [Error 3] The system cannot find the path specified: 
 'C:/web2py/applications/test/cache/cache'


 the problem is in the scaffolding app don't have cache folder, but never 
 mind, i can create it manually, but the strange things is, i'm trying to 
 remove the folder one by one e.g. controllers, models, modules, views, 
 private, etc. but when trying to do clean or pack application, it still can 
 do (as long as the cache folders is still there). so i assume, that in the 
 newest version the cache folder is very important rather than other 
 folders. any explaination about this?

 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: web2py 2.11.2 is OUT

2015-05-31 Thread Massimo Di Pierro
What did you upgrade from? Could it be an issue with reloading the browser 
cache?

On Sunday, 31 May 2015 01:45:27 UTC-5, Simon Ashley wrote:

 On windows 8.1 and Chrome, I'm finding the Welcome screen badly formatted 
 (no visible menus, unusual buttons etc).
 Under Firefox and IE11. its fine.


 https://lh3.googleusercontent.com/-yQKhCtaMTqo/VWqtmgjCH9I/Aaw/hcHQ7F-pxCs/s1600/chrome%2B2.11.2.png


 On Sunday, 31 May 2015 02:37:25 UTC+10, Massimo Di Pierro wrote:

 There was a problem with 2.11.1 and it has been addressed in 2.11.2. 
 Please skip 2.11.1 and report any issue you may find with 2.11.2.

 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: web2py 2.11.2 is OUT

2015-05-31 Thread 黄祥
sometimes i face the similar situation when accessing welcome app, either, 
change browser, restart web2py, or directly goes to admin page.

best regards,
stifan

On Sunday, May 31, 2015 at 1:45:27 PM UTC+7, Simon Ashley wrote:

 On windows 8.1 and Chrome, I'm finding the Welcome screen badly formatted 
 (no visible menus, unusual buttons etc).
 Under Firefox and IE11. its fine.


 https://lh3.googleusercontent.com/-yQKhCtaMTqo/VWqtmgjCH9I/Aaw/hcHQ7F-pxCs/s1600/chrome%2B2.11.2.png


 On Sunday, 31 May 2015 02:37:25 UTC+10, Massimo Di Pierro wrote:

 There was a problem with 2.11.1 and it has been addressed in 2.11.2. 
 Please skip 2.11.1 and report any issue you may find with 2.11.2.

 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: web2py 2.11.2 is OUT

2015-05-31 Thread 黄祥
i tested using web2py source on windows 7 with python 2.78.
another have face the same situation before (not the newest version).

ref:
https://groups.google.com/forum/#!topic/web2py/fBZN1MMEmWE

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: What is Hooks in Database Administration in appadmin ?

2015-05-31 Thread 黄祥
yes, it is for database callbacks.

best regards,
stifan

On Monday, June 1, 2015 at 5:13:46 AM UTC+7, Niphlod wrote:

 if I'm not wrong it shows database callbacks (if any are defined.)

 On Sunday, May 31, 2015 at 11:11:20 PM UTC+2, Πέτρος Χατζηλάμπρος wrote:

 When I go to http://localhost:8000/[myapplication]/appadmin I see a tab 
 which is named Hooks.

 When I click on it it shows nothing.

 What is this? Is it a feature that I miss ?



-- 
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: my site is broken

2015-05-31 Thread Niphlod
this can be a good poster for why upgrade in the first place, why doing it 
on production without trying first on a VM, etc etc etc. 
Bashing whatever without knowing how to resolve issues afterwards hitting 
next,next,next seems a taddle bit counterproductive, if you want to learn 
to manage linux webservers :P... 

Anyway, 3 pieces are involved:
- nginx
- uwsgi
- web2py

web2py for an error logs the usual ticket, so it seems you're not affected 
by that problem (Internal Server Error is what you get back).
now, nginx usually logs under /var/log/nginx/access.log and 
/var/log/nginx/error.log
uwsgi instead under /var/log/uwsgi/* .
you may find additional /var/log/something depending on how you launch 
uwsgi (such as uwsgi-emperor and such)

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


[web2py] Re: What is Hooks in Database Administration in appadmin ?

2015-05-31 Thread Niphlod
if I'm not wrong it shows database callbacks (if any are defined.)

On Sunday, May 31, 2015 at 11:11:20 PM UTC+2, Πέτρος Χατζηλάμπρος wrote:

 When I go to http://localhost:8000/[myapplication]/appadmin I see a tab 
 which is named Hooks.

 When I click on it it shows nothing.

 What is this? Is it a feature that I miss ?


-- 
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: Syntax for exiting grid function

2015-05-31 Thread Alex Glaros
I want to return FROM the grid with a value.  The way we normally do using 
row.id, but in this case, instead of the grid being called outside of the 
parent function, it is called from within the parent function.   

PARENT_FUNCTION():
makes call to child function that has grid.  User selects something 
from grid, and returns row.id
now parent function uses the value received from the child grid

thanks for looking at it Massimo

Alex


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


[web2py] Re: web2py 2.11.2 is OUT

2015-05-31 Thread Simon Ashley
On windows 8.1 and Chrome, I'm finding the Welcome screen badly formatted 
(no visible menus, unusual buttons etc).
Under Firefox and IE11. its fine.

https://lh3.googleusercontent.com/-yQKhCtaMTqo/VWqtmgjCH9I/Aaw/hcHQ7F-pxCs/s1600/chrome%2B2.11.2.png


On Sunday, 31 May 2015 02:37:25 UTC+10, Massimo Di Pierro wrote:

 There was a problem with 2.11.1 and it has been addressed in 2.11.2. 
 Please skip 2.11.1 and report any issue you may find with 2.11.2.

 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: many to many with SQLFORM.grid

2015-05-31 Thread Massimiliano
Sorry. What I wrote is wrong.

Try this ways:

def test1():
id_company = 1

m, cm = db.meeting, db.co_meet

cm.ref_company.default = id_company
cm.ref_company.readable = cm.ref_company.writable = False

cm.ref_meeting.requires = IS_IN_DB(db, m.id ,'%(title)s')

q = cm.ref_company == id_company
q = q  (m.id == cm.ref_meeting)
grid = SQLFORM.grid(q, field_id=cm.id, fields=[m.title])

return locals()


def test2():
id_company = 1

m, cm = db.meeting, db.co_meet

cm.ref_company.default = id_company
cm.ref_company.readable = cm.ref_company.writable = False

cm.ref_meeting.represent = lambda value, row: m[value].title
cm.ref_meeting.requires = IS_IN_DB(db, m.id ,'%(title)s')
q = cm.ref_company == id_company
grid = SQLFORM.grid(q)

return locals()






On Sun, May 31, 2015 at 11:01 AM, Massimiliano mbelle...@gmail.com wrote:


 m, cm = db.meeting, db.co_meet
 q = m.id == cm.ref_meeting
 q = q  (cm.ref_company == 1)
 grid = SQLFORM.grid(q, field_id=m.id, fields=[m.id, m.title])


 On Sun, May 31, 2015 at 4:48 AM, Ben Lawrence benlawr...@gmail.com
 wrote:

 Both of your answers give a grid of co_meet.

 What would the query be in SQLFORM.grid such that it would be a grid of
 db.meeting for one company (not db.co_meet)?


 On Thursday, May 7, 2015 at 8:26:47 PM UTC-7, 黄祥 wrote:

 had you tried it?
 another work around is u can use smartgrid constraints
 e.g.
 def test():
 table = db.co_meet
 query = db.co_meet.ref_company == 1 # whatever value that refer to
 table company
 grid = SQLFORM.smartgrid(table, constraints = dict(co_meet=query) )
 return locals()
 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.




 --
 Massimiliano




-- 
Massimiliano

-- 
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: many to many with SQLFORM.grid

2015-05-31 Thread Massimiliano
m, cm = db.meeting, db.co_meet
q = m.id == cm.ref_meeting
q = q  (cm.ref_company == 1)
grid = SQLFORM.grid(q, field_id=m.id, fields=[m.id, m.title])


On Sun, May 31, 2015 at 4:48 AM, Ben Lawrence benlawr...@gmail.com wrote:

 Both of your answers give a grid of co_meet.

 What would the query be in SQLFORM.grid such that it would be a grid of
 db.meeting for one company (not db.co_meet)?


 On Thursday, May 7, 2015 at 8:26:47 PM UTC-7, 黄祥 wrote:

 had you tried it?
 another work around is u can use smartgrid constraints
 e.g.
 def test():
 table = db.co_meet
 query = db.co_meet.ref_company == 1 # whatever value that refer to
 table company
 grid = SQLFORM.smartgrid(table, constraints = dict(co_meet=query) )
 return locals()
 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.




-- 
Massimiliano

-- 
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] Syntax for exiting grid function

2015-05-31 Thread Alex Glaros
I want to send user to a child grid function to select a row value and then 
return to the parent function with the value.

Right now, I just send user to the child grid controller first from the 
main menu, then user clicks button in the selected row, and a redirect 
takes him to the parent controller.

I think I can just embed a call to the child controller in the parent 
controller so that I don't have to send user to child controller first, but 
what is the syntax for exiting child function with the value?

The button in child function for the current way looks like this:

links=[dict(header='Add relationship',  body=lambda row: A('Assign person 
to role',_class=btn btn-success btn-mini, _href=URL(
'add_person_to_roles_and_relationships', args=row.id, vars=request.vars)))], 
links_placement = 'left')   
return dict(grid=grid)

If call to child is inside the parent controller what is syntax for exiting 
child function and passing vars to parent?  Currently, it exits with a 
redirect.  Also, what does the return statement look like in the child 
function?

The structure I want looks something like this:

PARENT_FUNCTION():
child_function, args=args # this child function selects a value parent 
uses below
continue doing work inside the parent function
return locals()

thanks,

Alex Glaros

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


[web2py] Re: How to control authorization to REST api

2015-05-31 Thread horridohobbyist
I figured out what was wrong. It all comes down to CORS – CORS and user 
authentication are quite braindead 
(http://stackoverflow.com/questions/21850454/how-to-make-xmlhttprequest-cross-domain-withcredentials-http-authorization-cor).
 
I decided to bypass all this CORS shit and do my own user authorization. 
Works like a charm.


On Saturday, 30 May 2015 19:18:20 UTC-4, horridohobbyist wrote:

 I tried this decorator, too:

 auth.settings.allow_basic_login = True
 @auth.requires_login()

 jQuery still chokes on user authorization. Moreover, it tries to redirect 
 you to a login page, which in my case is not applicable.


 On Saturday, 30 May 2015 14:32:24 UTC-4, horridohobbyist wrote:

 I'm trying to implement a REST api. I've coded the following:

 @request.restful()
 def api():
 response.view = 'generic.json'
 # curl -k --user tyr...@yahoo.ca:Lannister -G -d var1=something1 
 -d var2=something2
 # 
 https://miramar21.com/tut_server/default/api/verify/person/:usr/:pwd
 # https://miramar21.com/tut_server/default/api/add/person
 # https://miramar21.com/tut_server/default/api/update/person/:id
 def GET(*args,**vars):
 auth.basic()
 if not auth.user:
 return dict(unauthorized=True)
 try:
 if args[0] == 'verify':
 if len(args)  3:
 table_name = args[1]
 usr = args[2]
 pwd = args[3]
 alg = 'pbkdf2(1000,20,sha512)'
 hash = str(CRYPT(digest_alg=alg,salt=False)(pwd)[0])
 row = db(db[table_name].email==usr).select().first()
 if row:
 status = True if row.password == hash else False
 return dict(verified=status,id=row.id)
 return locals()
 if args[0] == 'add':
 if len(args)  1:
 table_name = args[1]
 return db[table_name].validate_and_insert(**vars)
 return locals()
 if args[0] == 'update':
 if len(args)  2:
 table_name = args[1]
 record_id = args[2]
 return db(db[table_name]._id==record_id).
 validate_and_update(**vars)
 return locals()
 except:
 return dict(fatal=True)
 return locals()
 return locals()

 I have a feeling that I'm not doing user authorization for the REST api 
 correctly, although the following cURL command works fine:

 curl -k --user tyr...@yahoo.ca:Lannister https://
 miramar21.com/tut_server/default/api/verify/person/james.b...@outlook.com/Prometheus

 When I try to use jQuery ajax to perform the same operation, it chokes on 
 the user authorization, whether I use JS headers or beforeSend. So I 
 suspect I'm doing something wrong. (But why is cURL working???)

 I just want to control user authorization as simply and cleanly as 
 possible.



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