[web2py] Is it a good idea to convert a jhomla website to web2py app for WHMCS integration?

2015-05-27 Thread at
Hi,

I've been asked to integrate WHMCS with a jhomla website. The website 
currently consists of just a few pages of information on the business, its 
services, products, clients and feedback/contact form. My most of the 
recent work experience is on python & web2py and I am intermediate-level 
developer. Would it be a good idea to convert the current website to first 
web2py to have more control on the functionalities? Any thoughts & 
advices?  

Thanks

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


[web2py] Re: project hire

2015-05-27 Thread rāma
Looking for something like this too

On Sunday, 15 March 2015 22:34:06 UTC+8, pumplerod wrote:
>
> The web2py support page lists experts4solutions as a group to inquire 
> about consulting or development, however, their home page has no method of 
> contact?  My coding chops are really just good enough to get me into 
> trouble and I'm interested in hiring someone that could create at least 
> some of the underlying components for the web application I'm trying to 
> build. 
>
> Primarily, I'm looking for OrientDB integration into web2py's DAL which 
> I'm more than happy to contribute back into the community.  Depending on 
> cost I'm sure there are many other components I could use help with.

-- 
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] wsgi / apache error

2015-05-27 Thread Johann Spies
Most parts of the app work on our server running apache2.4 and wsgi but on
after a query which takes some time I get this in the apache error log and
504 Gateway Timeout on my browser:

[Wed May 27 14:20:46.617759 2015] [wsgi:error] [pid 18286:tid
140225013630720] [remote x.x.x.x:10678] mod_wsgi (pid=18286): Exception
occurred processing WSGI script '/home/www-data/web2py/wsgihandler.py'.
[Wed May 27 14:20:46.617850 2015] [wsgi:error] [pid 18286:tid
140225013630720] [remote x.x.x.x:10678] IOError: failed to write data

Now my question: where did wsgi try to write data?

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] MARKMIN problem with email addresses

2015-05-27 Thread David Manns
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] ProgrammingError: column "worker_stats__tmp" is of type json but expression is of type text

2015-05-27 Thread Jose C
Greetings,

My postgresql server was upgraded from 9.1 to 9.3.  Web2py now crashes on 
startup with this error code:

Traceback (most recent call last):
  File "/home/jose/python-environments/silves/web2py/gluon/restricted.py", line 
227, in restricted
exec ccode in environment
  File 
"/home/jose/python-environments/silves/web2py/applications/silves/models/5_scheduler.py"
 , line 24, in 

scheduler = Scheduler(db, heartbeat=5 if RUNNING_LIVE else 20)
  File "/home/jose/python-environments/silves/web2py/gluon/scheduler.py", line 
587, in __init__
self.define_tables(db, migrate=migrate)
  File "/home/jose/python-environments/silves/web2py/gluon/scheduler.py", line 
679, in define_tables
migrate=self.__get_migrate('scheduler_worker', migrate)
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/base.py",
 line 817, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/base.py",
 line 856, in lazy_define_table
polymodel=polymodel)
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/adapters/base.py",
 line 491, in create_table
fake_migrate=fake_migrate
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/adapters/base.py",
 line 604, in migrate_table
self.execute(sub_query)
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/adapters/base.py",
 line 1326, in execute
return self.log_execute(*a, **b)
  File 
"/home/jose/python-environments/silves/web2py/gluon/packages/dal/pydal/adapters/base.py",
 line 1320, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
ProgrammingError: column "worker_stats__tmp" is of type json but expression is 
of type text
LINE 1: UPDATE scheduler_worker SET worker_stats__tmp=worker_stats;
  ^
HINT:  You will need to rewrite or cast the expression.


Not sure if this is a scheduler issue or pydal issue.  My migrate settings 
are explicitly set to False in the model definitions.

web2py version: 2.10.4

Suggestions appreciated.

Jose

-- 
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: var names in vars

2015-05-27 Thread Alex Glaros
So the data is generated and captured in vars correctly

{{=A('Delete whole meeting group', 
_href=URL('default','delete_object', 
args=specificMeetingGroup.superObjectID, 
vars=
 dict(displayHeader=specificMeetingGroup.meetingGroupTitle, 
 objectCreatedBy=specificMeetingGroup.created_by, 
   displayContent=specificMeetingGroup.MeetingGroupNarrativeDescription, 
  displayCreatedOnDate=prettydate(specificMeetingGroup.
created_on),
   pre_delete_message='Delete this meeting group, plus all related 
sub-meetings, comments and records',
   specificOrganizationID=specificOrganization.id,
   controller_to_return_to_if_delete = 'manage_meeting_groups', 
NAME_of_var_1_to_return_if_DELETE='specificOrganizationID', 
   
   var_1_to_return_if_delete=request.vars.specificOrganizationID,
   NAME_of_var_2_to_return_if_DELETE=False,
   var_2_to_return_if_delete=False,
   controller_to_return_to_if_cancel=
'view_meetings_for_specific_meeting_group', 
NAME_of_var_1_to_return_if_CANCEL='specificMeetingGroupID', 

var_1_to_return_if_cancel=specificMeetingGroup.id, 
 
   NAME_of_var_2_to_return_if_CANCEL='specificOrganizationID',
   var_2_to_return_if_cancel=specificOrganization.id)), 
_class='btn btn-warning')}}
See var values below:



Then, vars are copied to the controller below

def delete_object(): 
displayHeader = request.get_vars.displayHeader
   objectCreatedBy = request.get_vars.objectCreatedBy
   displayContent = request.get_vars.displayContent
   displayCreatedOnDate = request.get_vars.displayCreatedOnDate
   controller_to_return_to_if_delete = 
request.get_vars.controller_to_return_to_if_delete 

name=db(db.auth_user.id==objectCreatedBy).select()
   superObjectID = request.args(0)   
response.title=T('Delete')
   response.subtitle = T('Deletions are permanent and cannot be undone.')
   cancel_1A = request.get_vars.NAME_of_var_1_to_return_if_CANCEL
   cancel_1B = request.get_vars.var_1_to_return_if_cancel
   cancel_2A = request.get_vars.NAME_of_var_2_to_return_if_CANCEL
   cancel_2B = request.get_vars.var_2_to_return_if_cancel
   delete_1A = request.get_vars.NAME_of_var_1_to_return_if_DELETE
   delete_1B = request.get_vars.var_1_to_return_if_delete
   delete_2A = request.get_vars.NAME_of_var_2_to_return_if_DELETE
   delete_2B = request.get_vars.var_2_to_return_if_delete
   form = FORM.confirm('Are you sure?',{'Cancel and go back':URL(request.
vars.controller_to_return_to_if_cancel, args=request.vars.
arg_to_return_if_cancel, vars=dict(cancel_1A=cancel_1B, cancel_2A=cancel_2B
))})
   if form.accepted: 
db(db.SuperObject.id==superObjectID).delete()
   redirect(URL(request.vars.controller_to_return_to_if_delete, args=
request.vars.arg_to_return_if_delete, vars=dict(delete_1A=delete_1B, 
delete_2A=delete_2B)))
   return locals()

but var names are not in var container any more:

cancel_1A now contain 10 (this should be correct value for var cancel1B)
cancel_1B now contain None
cancel_2A now contains 7 (this should be correct value for var cancel_2B
cancel_2B now contains None

How did data get scrambled or disappear?

-- 
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] wsgi / apache error

2015-05-27 Thread Marco Mansilla
El Wed, 27 May 2015 14:37:43 +0200
Johann Spies  escribió:

> Most parts of the app work on our server running apache2.4 and wsgi
> but on after a query which takes some time I get this in the apache
> error log and 504 Gateway Timeout on my browser:
> 
> [Wed May 27 14:20:46.617759 2015] [wsgi:error] [pid 18286:tid
> 140225013630720] [remote x.x.x.x:10678] mod_wsgi (pid=18286):
> Exception occurred processing WSGI script
> '/home/www-data/web2py/wsgihandler.py'. [Wed May 27 14:20:46.617850
> 2015] [wsgi:error] [pid 18286:tid 140225013630720] [remote
> x.x.x.x:10678] IOError: failed to write data
> 
> Now my question: where did wsgi try to write data?
> 
> Regards
> Johann
> 

Check permissions of applications/[your-app], I think that's the only
place where wsgi should write something.

Something like this happened when I moved an app to a git repo and
pulled changes.

Marco.

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


[web2py] Re: Robots.txt paramete router

2015-05-27 Thread Jose C


On Thursday, 21 May 2015 19:58:53 UTC+1, Ruud Schroen wrote:
>
> Hi,
>
> I'm using a parameter based router like this:
>
> routers = dict(
>>
>>
>>> # base router
>>
>> BASE=dict(
>>
>> default_application='welcome',
>>
>> default_controller = "default",
>>
>> default_function = "index",
>>
>> domains={'www.mydomain.nl':'myapp'}
>>
>> ),
>>
>> )
>>
>>
> Now how do I expose my robots.txt so google can find it? 
>

Add this to your BASE dictionary:
root_static = [
'favicon.ico',
'robots.txt',
'google.html',
'BingSiteAuth.xml',
'your_website_sitemap.xml.gz',
],

 

-- 
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] synchronizning databases

2015-05-27 Thread Dave S
I've done a quick scan of the archives about "synchronizing databases", but 
there seem to have been few posts on it since
https://groups.google.com/d/msg/web2py/myTf5eedMc8/6xLmScVVH48J> in 
2011.
And that post, referencing
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-and-remote-database-synchronization>
seems to be more concerned about occasional synchronization than continuous 
synchronization.

Has anybody done the latter?  On StackOverflow, there's mentions of 
SymmetricDS and MySQL master-master synchronization

http://www.symmetricds.org/about/overview>

By using database triggers, SymmetricDS guarantees that data changes are 
> captured and atomicity is preserved. Support for database vendors is 
> provided through a Database Dialect layer, with implementations for MySQL, 
> Oracle, SQL Server, SQL Server Azure, PostgreSQL, DB2, Informix, Interbase, 
> Firebird, HSQLDB, H2, Apache Derby, Greenplum, and SQLite included. 
>

and

SymmetricDS is developed and maintained by JumpMind, Inc, a commercial open 
> source company. JumpMind sponsors the open source project and dedicates its 
> software developers to lead the development. The software is made available 
> as both open source and the commercial SymmetricDS Pro product. 
>

and more info on MySQL M2M is at
https://www.howtoforge.com/mysql_master_master_replication>
 
 There's a hint here in W2P-Users that PostGRES also has replication or 
synchronization.

I see this as being primarily a fail-over need or supporting multiple 
deployments (think in terms of a company with worksites in multiple cities, 
and a local server for each), but while I'd like to synchronize properly, 
honesty requires me to admit that in my own current usage I'm only talking 
about tens of updates per week, so I'm sort of shopping for a 3/4 ton 
pickup truck to make sure I can carry a couple of bags of groceries and the 
occasional bag of catfood.

That said, anyone here have experience in such synchronization?  What's a 
realistic expectation for the propagation delay?  Is this subject to loads, 
such that a flurry of activity would adversely impact synchronization?  Is 
this all hidden in the database plumbing, or does it have an effect on 
controllers for W2P apps?

Thanks for your thoughts and experiences.

/dps

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


[web2py] how to put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Alex Glaros
is there a trick to putting a controller name in a var so that it can be 
executed?

let's say "list_people_and_thier_dogs" is a controller name

I put the the string "list_people_and_thier_dogs" in var "name_of_contoller"

then when code  

redirect(URL(name_of_contoller))

I get None as name_of_controller

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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Anthony
Please show some code.

On Wednesday, May 27, 2015 at 3:07:50 PM UTC-4, Alex Glaros wrote:
>
> is there a trick to putting a controller name in a var so that it can be 
> executed?
>
> let's say "list_people_and_thier_dogs" is a controller name
>
> I put the the string "list_people_and_thier_dogs" in var 
> "name_of_contoller"
>
> then when code  
>
> redirect(URL(name_of_contoller))
>
> I get None as name_of_controller
>
> 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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Alex Glaros
I'm trying to pass controller name and var name to vars 

you can follow one of the vars in yellow highlight

cancel_1A = request.get_vars.NAME_of_var_1_to_return_if_CANCEL
cancel_1B = request.get_vars.var_1_to_return_if_cancel
form = FORM.confirm('Are you sure?',{'Cancel and go 
back':URL(request.vars.controller_to_return_to_if_cancel, 
args=request.vars.arg_to_return_if_cancel, vars=dict(cancel_1A=cancel_1B, 
cancel_2A=cancel_2B))})

I seem to get "None" as a value

So the data is generated and captured in vars correctly

{{=A('Delete whole meeting group',
_href=URL('default','delete_object',
args=specificMeetingGroup.superObjectID,
vars=
  dict(displayHeader=specificMeetingGroup.meetingGroupTitle,
 objectCreatedBy=specificMeetingGroup.created_by,
   displayContent=specificMeetingGroup.MeetingGroupNarrativeDescription,
  
displayCreatedOnDate=prettydate(specificMeetingGroup.created_on),
   pre_delete_message='Delete this meeting group, plus all related 
sub-meetings, comments and records',
   specificOrganizationID=specificOrganization.id,
   controller_to_return_to_if_delete = 'manage_meeting_groups',
NAME_of_var_1_to_return_if_DELETE='specificOrganizationID', 
   
   var_1_to_return_if_delete=request.vars.specificOrganizationID,
   NAME_of_var_2_to_return_if_DELETE=False,
   var_2_to_return_if_delete=False,
  
 controller_to_return_to_if_cancel='view_meetings_for_specific_meeting_group', 

NAME_of_var_1_to_return_if_CANCEL='specificMeetingGroupID', 

var_1_to_return_if_cancel=specificMeetingGroup.id, 
 
   NAME_of_var_2_to_return_if_CANCEL='specificOrganizationID',
   var_2_to_return_if_cancel=specificOrganization.id)), 
_class='btn btn-warning')}}
See var values below:



Then, vars are copied to the controller below

def delete_object():
displayHeader = request.get_vars.displayHeader
   objectCreatedBy = request.get_vars.objectCreatedBy
   displayContent = request.get_vars.displayContent
   displayCreatedOnDate = request.get_vars.displayCreatedOnDate
   controller_to_return_to_if_delete = 
request.get_vars.controller_to_return_to_if_delete
name=db(db.auth_user.id==objectCreatedBy).select()
   superObjectID = request.args(0)   
response.title=T('Delete')
   response.subtitle = T('Deletions are permanent and cannot be undone.')
   cancel_1A = request.get_vars.NAME_of_var_1_to_return_if_CANCEL
   cancel_1B = request.get_vars.var_1_to_return_if_cancel
   cancel_2A = request.get_vars.NAME_of_var_2_to_return_if_CANCEL
   cancel_2B = request.get_vars.var_2_to_return_if_cancel
   delete_1A = request.get_vars.NAME_of_var_1_to_return_if_DELETE
   delete_1B = request.get_vars.var_1_to_return_if_delete
   delete_2A = request.get_vars.NAME_of_var_2_to_return_if_DELETE
   delete_2B = request.get_vars.var_2_to_return_if_delete
   form = FORM.confirm('Are you sure?',{'Cancel and go 
back':URL(request.vars.controller_to_return_to_if_cancel, 
args=request.vars.arg_to_return_if_cancel, vars=dict(cancel_1A=cancel_1B, 
cancel_2A=cancel_2B))})
   if form.accepted:
db(db.SuperObject.id==superObjectID).delete()
   redirect(URL(request.vars.controller_to_return_to_if_delete, 
args=request.vars.arg_to_return_if_delete, vars=dict(delete_1A=delete_1B, 
delete_2A=delete_2B)))
   return locals()

but var names are not in var container any more:

cancel_1A now contains 10 (this should be correct value for var cancel1B)
cancel_1B now contains None
cancel_2A now contains 7 (this should be correct value for var cancel_2B
cancel_2B now contains None

How did data get scrambled or disappear?  Do I need to put another 
apostrophe around controller name so it acts as string instead of a value?

-- 
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: ProgrammingError: column "worker_stats__tmp" is of type json but expression is of type text

2015-05-27 Thread Niphlod
Please drop the scheduler_worker table from the database and remove the 
file *_scheduler_worker.table from the databases/ folder of your 
application, then set migrate to True (a single request with migrate=True 
will suffice). The table will be recreated properly and the error will go 
away.

The error comes from the fact that the adapter chooses "at connection time" 
the "nicest" column type to play with based on the backend version. The 
definition of the scheduler_worker table has a "json" Field, that on 
postgresql 9.3 maps to a "json" column, while on 9.1 was a "text" column, 
hence the misbehaviour if you don't drop and re-create the table.

-- 
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] wsgi / apache error

2015-05-27 Thread Niphlod
I suspect instead it's due to 
https://code.google.com/p/modwsgi/issues/detail?id=29&can=1


for reference (i.e. even if I don't think it's the issue at hand) web2py 
just needs to write:
- to the cache/ folder (if you're using cache.disk)
- the session/ folder (if you're using the default file-storage backend and 
not, e.g., memcache or redis)
- the uploads/ folder (if you're using "upload" Fields)


-- 
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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Derek
cancel_1A=cancel_1B, cancel_2A=cancel_2B))})

uh, you aren't setting 'specificMeetingGroup.id' equal to 10 by doing that, 
you know... you're setting cancel_1A and your FORM is called without 
anything assigned to cancel_1B or cancel_2B.

On Wednesday, May 27, 2015 at 12:46:58 PM UTC-7, Alex Glaros wrote:
>
> I'm trying to pass controller name and var name to vars 
>
> you can follow one of the vars in yellow highlight
>
> cancel_1A = request.get_vars.NAME_of_var_1_to_return_if_CANCEL
> cancel_1B = request.get_vars.var_1_to_return_if_cancel
> form = FORM.confirm('Are you sure?',{'Cancel and go 
> back':URL(request.vars.controller_to_return_to_if_cancel, 
> args=request.vars.arg_to_return_if_cancel, vars=dict(cancel_1A=cancel_1B, 
> cancel_2A=cancel_2B))})
>
> I seem to get "None" as a value
>
> So the data is generated and captured in vars correctly
>
> {{=A('Delete whole meeting group',
> _href=URL('default','delete_object',
> args=specificMeetingGroup.superObjectID,
> vars=
>   dict(displayHeader=specificMeetingGroup.meetingGroupTitle,
>  objectCreatedBy=specificMeetingGroup.created_by,
>   
>  displayContent=specificMeetingGroup.MeetingGroupNarrativeDescription,
>   
> displayCreatedOnDate=prettydate(specificMeetingGroup.created_on),
>pre_delete_message='Delete this meeting group, plus all related 
> sub-meetings, comments and records',
>specificOrganizationID=specificOrganization.id,
>controller_to_return_to_if_delete = 'manage_meeting_groups',
> NAME_of_var_1_to_return_if_DELETE='specificOrganizationID',   
>  
>var_1_to_return_if_delete=request.vars.specificOrganizationID,
>NAME_of_var_2_to_return_if_DELETE=False,
>var_2_to_return_if_delete=False,
>   
>  
> controller_to_return_to_if_cancel='view_meetings_for_specific_meeting_group', 
> 
> NAME_of_var_1_to_return_if_CANCEL='specificMeetingGroupID',   
>   
> var_1_to_return_if_cancel=specificMeetingGroup.id, 
>  
>NAME_of_var_2_to_return_if_CANCEL='specificOrganizationID',
>var_2_to_return_if_cancel=specificOrganization.id)),   
>   
> _class='btn btn-warning')}}
> See var values below:
>
>  'var_1_to_return_if_cancel': '10', 'displayHeader': "Glen's style of auto", 
> 'displayContent': 'Glen', 'pre_delete_message': 'Delete this meeting group, 
> plus all related sub-meetings, comments and records', 
> 'NAME_of_var_2_to_return_if_DELETE': 'False', 
> 'NAME_of_var_1_to_return_if_DELETE': 'specificOrganizationID', 
> 'var_2_to_return_if_cancel': '7', 'var_2_to_return_if_delete': 'False', 
> 'specificOrganizationID': '7', 'NAME_of_var_2_to_return_if_CANCEL': 
> 'specificOrganizationID', 'controller_to_return_to_if_delete': 
> 'manage_meeting_groups', 'var_1_to_return_if_delete': '7', 
> 'controller_to_return_to_if_cancel': 
> 'view_meetings_for_specific_meeting_group', 'displayCreatedOnDate': '1 day 
> ago', 'objectCreatedBy': '4'}>
>
> Then, vars are copied to the controller below
>
> def delete_object():
> displayHeader = request.get_vars.displayHeader
>objectCreatedBy = request.get_vars.objectCreatedBy
>displayContent = request.get_vars.displayContent
>displayCreatedOnDate = request.get_vars.displayCreatedOnDate
>controller_to_return_to_if_delete = 
> request.get_vars.controller_to_return_to_if_delete
> name=db(db.auth_user.id==objectCreatedBy).select()
>superObjectID = request.args(0)   
> response.title=T('Delete')
>response.subtitle = T('Deletions are permanent and cannot be undone.')
>cancel_1A = request.get_vars.NAME_of_var_1_to_return_if_CANCEL
>cancel_1B = request.get_vars.var_1_to_return_if_cancel
>cancel_2A = request.get_vars.NAME_of_var_2_to_return_if_CANCEL
>cancel_2B = request.get_vars.var_2_to_return_if_cancel
>delete_1A = request.get_vars.NAME_of_var_1_to_return_if_DELETE
>delete_1B = request.get_vars.var_1_to_return_if_delete
>delete_2A = request.get_vars.NAME_of_var_2_to_return_if_DELETE
>delete_2B = request.get_vars.var_2_to_return_if_delete
>form = FORM.confirm('Are you sure?',{'Cancel and go 
> back':URL(request.vars.controller_to_return_to_if_cancel, 
> args=request.vars.arg_to_return_if_cancel, vars=dict(cancel_1A=cancel_1B, 
> cancel_2A=cancel_2B))})
>if form.accepted:
> db(db.SuperObject.id==superObjectID).delete()
>redirect(URL(request.vars.controller_to_return_to_if_delete, 
> args=request.vars.arg_to_return_if_delete, vars=dict(delete_1A=delete_1B, 
> delete_2A=delete_2B)))
>return locals()
>
> but var names are not in var container any more:
>
> cancel_1A now contains 10 (this should be correct value for var cancel1B)
> cancel_1B now contains None
> cancel_2A now contains 7 (this should be correct value for var cancel_2B
> cancel_2B now contains None
>
> How did data get scrambled or disap

[web2py] Re: how to put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Niphlod
a simple example can be better than a thousand words


>>> a = 'hello'
>>> b = 'world'
>>> example = dict(a=a, b=b)
>>> print example
{'a': 'hello', 'b': 'world'}
>>> example2 = {a : a, b : b}
>>> print example2
{'world': 'world', 'hello': 'hello'}
>>> 



-- 
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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Alex Glaros
you're right Derek

so how would have the end result be

vars(dict(specificMeetingGroupID=10))

thanks,

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] Structure of compiled apps

2015-05-27 Thread Scott Hunter
When an app gets compiled, each function in each controller that takes no 
arguments (i.e. has an exposed URL) is represented by a .pyc file.  But 
where do the controller functions that do not correspond to exposed URLs go?

- Scott

-- 
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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Derek
varsdict = dict()

varsdict[cancel_1a]=cancel_1b

vars=varsdict

something like that.


On Wednesday, May 27, 2015 at 1:15:56 PM UTC-7, Alex Glaros wrote:
>
> you're right Derek
>
> so how would have the end result be
>
> vars(dict(specificMeetingGroupID=10))
>
> thanks,
>
> 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: synchronizning databases

2015-05-27 Thread Dan Feeney
My experience with replication is primarily with Oracle in a non-web2py 
environment. Oracle's Multi-Master Replication has a ton of parameters that 
let you customize the replication window, but my systems are configured for 
a 5 minute delay target, but the databases are rarely out of sync more than 
a minute. However, in any asynchronous replication system, there is always 
the possibility that some part of the process will break, and the two will 
diverge. To Oracle's credit, there is a lot of database magic to help you 
get out of that situation, and I've had databases that were two days out of 
sync resync in about 15 minutes once the issue was fixed and replication 
restarted. These applications field about 10k-15k requests an hour, each 
request generating or modifying potentially 50-100 table rows at a time.

One issue that you'd run into with respect to using Oracle MMR with web2py 
would be handling primary key collisions. ID collisions arise when you have 
an auto-incremented primary key column on a table that can receive updates 
on both replicated databases which results in a single id number being 
assigned to two records. You would avoid these collisions by modifying the 
sequence objects that generate the id numbers so that one database in the 
pair would generate only even id numbers, and the other would generate only 
odd. In the Oracle DAL adapter, there is code to generate sequence objects 
and triggers to assign the sequence numbers to newly-created records. You 
would install your application on each local server connected to its 
respective database, and once the tables were built on both, you could find 
the sequence objects, drop them, and re-create them with something like

On the first server

CREATE SEQUENCE mytable_pk START WITH 1 INCREMENT BY 2;

On the second server

CREATE SEQUENCE mytable_pk START WITH 2 INCREMENT BY 2;

Note, I'm fairly sure that the actual name that web2py uses is not 
"mytable_pk" so you'd have to look that up. Once the new sequence objects 
are in place, the triggers should automatically recompile.

It is also a good idea to include a last update audit field on all 
replicated tables that can be used to set up conflict resolution in the 
Oracle MMR system. I would use auth.signature and the updated_on field.

Of course, if you are really interested in Oracle's replication (and can 
afford their ridiculous licensing fees), I would recommend reading their 
Advanced Replication manual, which goes into a ton more detail on the 
architecture, components, and how-to of a setup like this.

But TL;DR: Oracle Multi-Master Replication, once you get through the 
complexities of setting up the replication process itself, would have no 
problem running the setup you described. But it'd be more like using a 7 
ton Mack truck to carry those groceries...

-dan


On Wednesday, May 27, 2015 at 2:05:20 PM UTC-5, Dave S wrote:
>
> I've done a quick scan of the archives about "synchronizing databases", 
> but there seem to have been few posts on it since
> https://groups.google.com/d/msg/web2py/myTf5eedMc8/6xLmScVVH48J> in 
> 2011.
> And that post, referencing
>  http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-and-remote-database-synchronization
> >
> seems to be more concerned about occasional synchronization than 
> continuous synchronization.
>
> Has anybody done the latter?  On StackOverflow, there's mentions of 
> SymmetricDS and MySQL master-master synchronization
>
> http://www.symmetricds.org/about/overview>
>
> By using database triggers, SymmetricDS guarantees that data changes are 
>> captured and atomicity is preserved. Support for database vendors is 
>> provided through a Database Dialect layer, with implementations for MySQL, 
>> Oracle, SQL Server, SQL Server Azure, PostgreSQL, DB2, Informix, Interbase, 
>> Firebird, HSQLDB, H2, Apache Derby, Greenplum, and SQLite included. 
>>
>
> and
>
> SymmetricDS is developed and maintained by JumpMind, Inc, a commercial 
>> open source company. JumpMind sponsors the open source project and 
>> dedicates its software developers to lead the development. The software is 
>> made available as both open source and the commercial SymmetricDS Pro 
>> product. 
>>
>
> and more info on MySQL M2M is at
> https://www.howtoforge.com/mysql_master_master_replication>
>  
>  There's a hint here in W2P-Users that PostGRES also has replication or 
> synchronization.
>
> I see this as being primarily a fail-over need or supporting multiple 
> deployments (think in terms of a company with worksites in multiple cities, 
> and a local server for each), but while I'd like to synchronize properly, 
> honesty requires me to admit that in my own current usage I'm only talking 
> about tens of updates per week, so I'm sort of shopping for a 3/4 ton 
> pickup truck to make sure I can carry a couple of bags of groceries and the 
> occasional bag of catfood.
>
> That said, anyone here have experience in such s

[web2py] Re: synchronizning databases

2015-05-27 Thread Dave S


On Wednesday, May 27, 2015 at 2:37:28 PM UTC-7, Dan Feeney wrote:
 

> But TL;DR: Oracle Multi-Master Replication, once you get through the 
> complexities of setting up the replication process itself, would have no 
> problem running the setup you described. But it'd be more like using a 7 
> ton Mack truck to carry those groceries...
>
>
I appreciate both the serious part of the answer, and the quip.

Thanks.

/dps
 

 

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


[web2py] Re: how to put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Alex Glaros
correct data now appears for first var, but what is syntax for two vars in 
dictionary?

E.g., varsdict[cancel_1a]=cancel_1b* + varsdict[cancel_2a]=cancel_2b*

I've tried looking it up and every possible combination


-- 
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 put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Dave S


On Wednesday, May 27, 2015 at 3:39:33 PM UTC-7, Alex Glaros wrote:
>
> correct data now appears for first var, but what is syntax for two vars in 
> dictionary?
>
> E.g., varsdict[cancel_1a]=cancel_1b* + varsdict[cancel_2a]=cancel_2b*
>
> I've tried looking it up and every possible combination
>
>
You don't really have a '+' in your code there, do you?

2 separate statements should do it:
varsdict[cancel_1a]=cancel_1b
varsdict[cancel_2a]=cancel_2b


as shown by
>>> t4 = dict()
>>> t4['albert']='victoria'
>>> t4['phillip']='elizabeth'
>>> print t4
{'phillip': 'elizabeth', 'albert': 'victoria'}
>>> 

(Yes, proper names should have an initial capital letter. I'll do better 
next time.)

/dps

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


[web2py] Re: how to put a controller name in a var if later want to execute the the controller name

2015-05-27 Thread Alex Glaros
no Dave, I didn't try the '+' sign; was just to describe intent

thanks Dave and Niphlod for the lesson

code works great!

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] Q: Efficiently searching by tag / field widths

2015-05-27 Thread Paul Coy
In the Web2Py Cookbook, Ch3 there is a section called "Efficiently 
searching by tag" which works quite well, thanks. I've been playing with it 
and when I enter more than 16 characters to the data.value the data shows 
up as 15 characters followed by "...". this happens with the results "rows" 
also. How do I expand the size of the field or fields to show the whole 
data string". The view seems quite simple but it's just not obvious to me 
where to adjust field sizes. If someone could point me in the right 
direction that would be appreciated. Thanks
 

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


[web2py] Object request isn't working

2015-05-27 Thread Marlysson Silva
People I'm trying to verify the host of user, and make this way:

if request.env.server_name == '127.0.0.1':

But the admin show me a error:

if request.env.server_name == '127.0.0.1':
NameError: name 'request' is not defined

Theoretically was to working,What I'm making of the wrong?

-- 
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] GAE list:integer fields on v2.10.4 and beyond

2015-05-27 Thread Donald McClymont
I am having major problems using Google App Engine with v2.10.4 as I use a 
number of list integer types field types.  It seems the only way to get 
zero to be stored as a value on  a list integer field is to send it as a 
character string  eg ['0','0','0']  - surely it should be possible to send 
a list of integers (some of which may be 0) and have that stored in the 
field?

I can't see any open issues and believe I have tested latest version - can 
somebody confirm or advise if I have done something silly.

Regards
Donald


-- 
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] Specifying which fields are searchable with Smartgrid

2015-05-27 Thread Peter Gibson
The default search widget gives option to search on every field on the 
table.  How do I restrict it to just a couple of fields (title, 
description).

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


[web2py] Problem in SQLFORM.factory with foreignkeys in multiple tables

2015-05-27 Thread Fabian Haeger
Hello there,

I am getting despair on this problem after 6 hours now and I hope I can get 
some help here.
After creating 3 models of a legacy database, and adding a SQLFORM in my 
controller, I'm always getting the error message

 (1452, u'Cannot add or 
update a child row: a foreign key constraint fails (`immobilia`.`property`, 
CONSTRAINT `fk_property_adress` FOREIGN KEY (`propertyAdressID`) REFERENCES 
`adress` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION)')

Here is the model definition

legacy_db.define_table('adress',
Field('street','string', label='Street'),
Field('postalcode','string', label='Postal Code'),
Field('city','string', label='City'),
migrate=False)

#
legacy_db.define_table('propertydata',
Field('size','double', label='Size (in m²)'),
Field('nbed','integer', label='# Bedrooms'),
Field('nbath','integer', label='# Bathrooms'),
Field('buildingheight','double', label='Building height (in m)'),
Field('floor','integer', label='Floor'),
Field('price','double', label='Price in €'),
migrate=False)

#
legacy_db.define_table('property',
Field('propertyAdressID','id', 'reference adress.id', writable=False, 
readable=False),
Field('propertyDataID','id', 'reference propertydata.id', 
writable=False, readable=False),
Field('propertyApproved','integer', default=0, writable=False, 
readable=False),
migrate=False)


And this is what my controller looks like:

def index():
form=SQLFORM.factory(legacy_db.adress, legacy_db.property, 
legacy_db.propertydata)
if form.accepts(request.vars):
id = 
legacy_db.adress.insert(**legacy_db.adress._filter_fields(form.vars))
form.vars.adress = id
id = 
legacy_db.propertydata.insert(**legacy_db.propertydata._filter_fields(form.vars))
form.vars.propertydata = id
id = 
legacy_db.property.insert(**legacy_db.property._filter_fields(form.vars))
response.flash='Property added'
else:
response.flash='Error in adding'
return dict(message="", form=form)

Can you tell me what I'm doing wrong? I just have no idea anymore and 
google doesn't help me anymore.

Greetings and thank you in advance.


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


[web2py] mail.send() feature in web2py for bounced email/ email address that doesnt exist

2015-05-27 Thread Lasya Venneti
So I made a small app that sends emails from web2py, connected to the gmail 
smtp server. The problem here is that it always gives me a success message! 
Even when the email-id is invalid. I have tested the bounce back feature of 
gmail by sending mails from gmail to invalid email ids to which gmail says 
'Your message has been sent', but on going to the sent folder gives the 
mailer daemon with a time lag(this differs for different mailing services). 


I think the mail.send() feature of web2py is unable to capture that and 
takes the 'Your message has been sent' as confirmation. How can one capture 
mails that haven't been sent using web2py?


if mail.send(session.email,subject=session.subject,message= session.message):
response.flash = 'email sent sucessfully.'else:
response.flash = 'fail to send email sorry!




















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


[web2py] smartgrid 'searchable' options

2015-05-27 Thread Peter Gibson
Hopefully a simple question...

I have a smartgrid on a table which contains a lot of fields that are only 
for internal use of the application and are of no direct interest/relevance 
to the user.

When I set searchable=True in the smartgrid then it allows searching on all 
these fields which is not what I want.

How do I restrict which fields the user can search on (e.g. just allow 
searching on 'title' and 'description')?  It hints this is possible in the 
docs 
(http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=searchable)
 
but there is no detailed reference that I can find.

Many thanks

Peter

-- 
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] admin static files fail to load after web2py upgrade

2015-05-27 Thread Juozas Masiulis
I've upgraded web2py to version 2.9.12-stable+timestamp.2015.01.17.06.11.03 
via web interface. Now, when I go to any admin page it looks broken, 
because it fails to load any static files. It tries to load the files from 
the wrong path, for example it tries to load jquery 
from https://mydomain.com/admin/static/*_2.9.12/_2.9.12*/js/jquery.js and 
the same for all static files. 

how can this be solved?

-- 
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] Datetime fields in 2.11.0 Alpha

2015-05-27 Thread Donald McClymont
I am getting an error on form validation of a datetime field with latest 
version.  Error is must be -MM-DD HH:MM::SS! Note there are two colons 
between MM and SS which I am assuming is part of the problem - but I can't 
readily see how to fix it.


Regards
Donald

-- 
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] Reportlab, Platypus and tables

2015-05-27 Thread Felix Penetrante
I have just started using Reportlab for my app's pdf report needs and I 
can't find examples on how to control the table appearance (i.e. border, 
alignment, color, etc).  I already scoured through the web2py's 
documentation but it has a minimal example and is of no help on my table 
needs.  Is there any web resource out there that has a sample code snippet 
on the use of tables in Reportlab with platypus?  Or better yet can anyone 
provide a proper and comprehensive example on use of Reportlab platypus?  

Many thanks.


-- 
“This message contains confidential information and is intended only for 
the individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and 
delete this e-mail from your system. E-mail transmission cannot be 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
The sender therefore does not accept liability for any errors or omissions 
in the contents of this message, which arise as a result of e-mail 
transmission. If verification is required please request a hard-copy 
version.” Bicol University, Legazpi City, Philippines.

-- 
“This message contains confidential information and is intended only for 
the individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and 
delete this e-mail from your system. E-mail transmission cannot be 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. 
The sender therefore does not accept liability for any errors or omissions 
in the contents of this message, which arise as a result of e-mail 
transmission. If verification is required please request a hard-copy 
version.” Bicol University, Legazpi City, Philippines.

-- 
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] issues loading sessions

2015-05-27 Thread Wim Fournier
I'm having regular issues with the loading of sessions. Sometimes this 
happens after restarting the webserver, sometimes in the middle of a 
session.

I would see errors like;

Traceback (most recent call last):
  File "/var/web/xxx/web2py-2.10/gluon/main.py", line 484, in wsgibase
session._try_store_in_cookie_or_file(request, response)
  File "/var/web/xxx/web2py-2.10/gluon/globals.py", line 1167, in 
_try_store_in_cookie_or_file
return self._try_store_in_file(request, response)
  File "/var/web/xxx/web2py-2.10/gluon/globals.py", line 1174, in 
_try_store_in_file
or self._unchanged(response)):
  File "/var/web/xxx/web2py-2.10/gluon/globals.py", line 1119, in _unchanged
session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle : attribute lookup thread.lock 
failed

I'm using web2py 2.10.4-stable+timestamp.2015.04.26.15.11.54 with apache 
2.2.22-13+deb7u4, libapache2-mod-wsgi 3.3-4+deb7u1 on debian 7.8

I also often got errors for session.connect (gluon/main.py:437) coming from the 
__getnewargs__ in storage.py because the requested attribute was not a string. 
I have replaced:

__getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)

with

def __getnewargs__(self):
if self:
try:
return getattr(dict,self).__getnewargs__(self)
except Exception as e:

logging.getLogger().error('Storage: getnewargs: got exception: 
{}'.format(e))
return ()
else:
return ()

And this seems to counter that issue. I haven't found anything for the 
first error though.
Any thougths?

Wim

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


[web2py] Bug in scheduler.py ?

2015-05-27 Thread Meessen Christophe

Hello,

I recently encounter a problem when trying to serialize the model 
including the scheduler tables.


The default value of the uuid field in the scheduler_task table is set 
to the function web2py_uuid.

Shouldn't it be the value returned by web2py_uuid and thus web2py_uuid() ?

--
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: question about onvalidation function

2015-05-27 Thread chaitanya
Hi Iam very new to web2py.
According to my understanding, if the c value is greater than zero the c 
value has to be displayed.
I used the same code as yours but I did not see the c value printed.
Can you please clarify if Iam understanding it wrong.

On Friday, December 23, 2011 at 3:13:04 PM UTC-6, Massimo Di Pierro wrote:
>
> onvalidation = my_form_processing 
>
> registers a callback (called after validation and before accepting). 
> This does not work 
>
> def my_form_processing(table_name, form): form.vars.field1 = 
> table_name # I know useless, it just 
>
> because the callback function must take a single parameter, the form. 
> You can do instead 
>
> def my_form_processing(form): 
> form.vars.field1 = form.table.name # I know useless, it just 
>
> Hope this helps. 
>
>
> On Dec 23, 1:32 pm, Richard  wrote: 
> > Hello, 
> > 
> > In the book there is this example : 
> > 
> > db.define_table('numbers', 
> > Field('a', 'integer'), 
> > Field('b', 'integer'), 
> > Field('c', 'integer', readable=False, writable=False)) 
> > 
> > def my_form_processing(form): 
> > c = form.vars.a * form.vars.b 
> > if c < 0: 
> >form.errors.b = 'a*b cannot be negative' 
> > else: 
> >form.vars.c = c 
> > 
> > def insert_numbers(): 
> >form = SQLFORM(db.numbers) 
> >if form.process(onvalidation=my_form_processing).accepted: 
> >session.flash = 'record inserted' 
> >redirect(URL()) 
> >return dict(form=form) 
> > 
> > Where "my_form_processing" function is called without bracket and 
> > arguments... 
> > 
> > I try to do this that failed : 
> > 
> > def my_form_processing(table_name, form): 
> > form.vars.field1 = table_name # I know useless, it just 
> > demonstration for purpose of my question... 
> > 
> > ... 
> > 
> >  if form.process(onvalidation=my_form_processing(request.args(0), 
> > form)).accepted: 
> > 
> > Then I did : 
> > 
> > def my_form_processing(form): 
> > form.vars.field1 = request.args(0) 
> > 
> > ... 
> > 
> >  if form.process(onvalidation=my_form_processing).accepted: 
> > 
> > That actually works... 
> > 
> > I would like to make sure that I understand onvalidation properly... 
> > 
> > Is "my_form_processing" just a extension of the "insert_numbers()" 
> > function? 
> > 
> > And if so, does it have access to all the same variables 
> > (environnement) of "inser_numbers()"?? 
> > 
> > Thank you! 
> > 
> > Richard

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


[web2py] smartgrid constraints not working on the linked table

2015-05-27 Thread icodk
Hold your hat:-)
I have an SQLFORM.smartgrid with 'dog' as the main table and 'puppy' as the 
linked_table  that has a reference to the 'dog' table.
This will add an extra columne with a link 'puppy' on each dog row in the 
the dog grid. Clicking on that link
will show a new grid containing rows with only the puppies with reference 
to the specific dog row from the dog grid.
So far so good. Now : the dog table has a reference to the auth_user table 
 and the grid has a constraint 
: constraints={'dog':db.dog.owner==auth.user},
This also works fine: I get only the dogs of the currently logged in user. 
Clicking on the puppy link(mentioned above) in the dog grid brings up the 
puppy grid. clicking on an Edit button on one of the puppies row
brings up the edit form for this puppy. One of the fields in the edit form 
is a drop down list with dogs so I can assign the puppy to another dog. THE 
PROBLEM is that the list contains ALL the dogs
in the dog table instead of only the dogs of the current user. 
Help will be greatly appreciated

db.define_table('dog,
Field('name')
Field('owner',db.auth_user)
db.define_table('puppy',
Field('name')
Field('dog',db.dog)

grid = SQLFORM.smartgrid(db.dog,linked_tables=['puppy'],
constraints={'dog':db.dog.owner==auth.user},

-- 
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: PostgreSQL connection hangs on insert

2015-05-27 Thread Bilal Hasan
Thing is, when I check any processes with open connections, the database 
connection is idle.

Even if I stop the server, the connection process is still there until I 
kill the process manually. Not sure where it's hanging.

I'm using other databases on the same machine with PostgreSQL which have no 
problems. It's just this specific one.

May be just a deeper issue than Web2Py.

On Wednesday, May 20, 2015 at 2:16:25 AM UTC-5, Niphlod wrote:
>
> okay, okay, psycopg2 is slightly less buggy than pg8000 but "attempted to 
> connect"  is not something driver related. Your instance is completely 
> going offline for a long period of time. 
>
> On Wednesday, May 20, 2015 at 8:04:10 AM UTC+2, Auden RovelleQuartz wrote:
>>
>> have you tried using the psycopg2 driver?
>>
>>
>>
>> On Wednesday, May 20, 2015 at 12:38:51 AM UTC-5, Bilal Hasan wrote:
>>>
>>> I'm having a very annoying issue where the connection to a PostgreSQL 
>>> database hangs and I get a "Attempted to connect to this database 5 times 
>>> unsuccessfully" which renders the whole web application un-usable.
>>>
>>> I'm using PostgreSQL 9.3. Web2Py Version 
>>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>>
>>> Below is the only code I use for this database. I'm not sure why it's 
>>> happening.
>>>
>>> jobid = sprint.joblist.insert(**mydict)
>>> sprint.commit()
>>> result = sprint(sprint.joblist.id==jobid).select()
>>>
>>> db.py:
>>> sprint = 
>>> DAL('postgres://***:***@138.85.**.**:5432/nds_smart_sprint',pool_size=30)
>>>
>>> Updated pg8000 driver to latest version still no luck.
>>>
>>> I have to manually terminate the idle connection using "ps aux | grep 
>>> postgres"
>>>
>>

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

2015-05-27 Thread Donald McClymont
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.


Re: [web2py] return locals()

2015-05-27 Thread Felix Penetrante
Thanks for this post.  Now I know how to secure views.

-- 
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] SQLFORM.smartgrid with linked_table and constraints ot working 100%

2015-05-27 Thread icodk
Hold your hat:-)
I have an SQLFORM.smartgrid with 'dog' as the main table and 'puppy' as the 
linked_table  that has a reference to the 'dog' table.
This will add an extra communal with a link 'puppy' on each dog row of the 
main table. Clicking on that link
will show a grid containing rows with only the puppies that have reference 
to the specific dog row from the main table.
So far so good. Now : The dog table has a reference to the auth_user table 
 and the grid has a constraint 
: constraints={'dog':db.dog.owner==auth.user},
This also works fine: I get only the dogs of the currently logged in user. 
Clicking on the puppy link(mentioned above) in the dog grid brings up the 
puppy grid. clicking on an Edit button on one of the puppies row
brings up the edit form for this puppy. One of the fields in the edit form 
is a drop down list with dogs so I can assign the puppy to another dog. 
*THE PROBLEM* is that the list contains ALL the dogs in the dog table 
instead of only the dogs of the current user. 

Help will be greatly appreciated

db.define_table('dog',
Field('name'),
Field('owner','reference auth_user',default=auth.user
format = '%(name)s')
db.define_table('puppy',
Field('name'),
Field('dog', 'reference dog'),
format = '%(name)s')

grid = SQLFORM.smartgrid(db.dog,linked_tables=['sensor'],
constraints={'dog':db.dog.owner==auth.user},
deletable=dict(puppy=False,dog=True),
editable=dict(puppy=True,dog=True),
create=dict(puppy=False,dog=True),
csv=False)



-- 
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] _before_insert / update question

2015-05-27 Thread Ian Ryder
Hi, I'd like to modify the data on a record before it is inserted / 
updated. I was hoping I could do this with _before_insert / update but I 
don't think it's possible.

As an example from a previous life, in Salesforce on a before trigger you 
can change field values in memory on the way into the database and they 
will automatically get written on completion.

Am I right in thinking with web2py it's just a set of data in its own world 
that you can do something with? I would need to perform an update on the 
record after it's been inserted which seems like a waste, especially when 
dealing with large data sets.

Thanks
Ian

-- 
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] Database

2015-05-27 Thread Dan Hett
When I connect to an existing database, do I need to define the tables in 
DB.py?

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


[web2py] web2py Google Group

2015-05-27 Thread Ian Ryder
Hi there

I wonder if you could help - I've posted to the user group several times, I
think my last 2 posts have never been posted. Normally the ones that have
worked might take a day to arrive by which point they're down the list -
the upshot is I avoid using the list. Assuming it's not something specific
about my account this must be the same for others.

Is there anything I can do? It's generally holding back our use of web2py
as we effectively don't have access to the community and we're building a
pretty big application using it.

Thanks
Ian

-- 

Ian Ryder

*i.ry...@appichar.com.au * | *0414 815 457*

-- 
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: Email invite users - peer review

2015-05-27 Thread Massimo Di Pierro
think this is an excellent idea. Please submit a pull request.

On Wednesday, 20 May 2015 03:12:24 UTC-5, James Burke wrote:
>
> Hi,
>
> I'm looking for a peer review of some code I put together for email 
> inviting users to join an application. I couldn't find anything suitable 
> looking around, hopefully I didn't overlook anything!
>
> The idea is, you enter in email addresses into a form, click submit and it 
> will send an email to the email address with an invite to your application. 
> The email will contain a link which the user clicks to take them to a form 
> to fill in the rest of their required details, name etc.
>
> I've tested this and it works, but I would like to know what others 
> thoughts are and there are any improvements that could be made.
>
> Thank you!
>
> *default.py controller*
> def index():
> form=FORM('Enter a comma separated list of emails to send invites:',
>   BR(),
>   INPUT(_id='emails', _value=''),
>   INPUT(_type='submit'))
>
> if form.accepts(request,session):
> # send the invitations
> for email in form.vars.email.split(','):
> auth.invite_user(email=email)
> response.flash = 'Invitations sent'
>
> return dict(form=form)
>
> def confirm_registration():
> return dict(form=auth.confirm_registration())
>
>
>
>
> *gluon/tools.py*
> def confirm_registration(
> self,
> next=DEFAULT,
> onvalidation=DEFAULT,
> onaccept=DEFAULT,
> log=DEFAULT,
> ):
> """
> Modified version of Auth.reset_password()
> """
>
>
> table_user = self.table_user()
> request = current.request
> # response = current.response
> session = current.session
>
>
> if next is DEFAULT:
> next = self.get_vars_next() or self.settings.
> reset_password_next
>
>
> if self.settings.prevent_password_reset_attacks:
> key = request.vars.key
> if not key and len(request.args)>1:
> key = request.args[-1]
> if key:
> session._reset_password_key = key
> redirect(self.url('confirm_registration'))
> else:
> key = session._reset_password_key
> else:
> key = request.vars.key or getarg(-1)
> try:
> t0 = int(key.split('-')[0])
> if time.time() - t0 > 60 * 60 * 24:
> raise Exception
> user = table_user(reset_password_key=key)
> if not user:
> raise Exception
> except Exception as e:
> session.flash = self.messages.invalid_reset_password
> redirect(self.url('login', vars=dict(test=e)))
> redirect(next, client_side=self.settings.client_side)
> passfield = self.settings.password_field
> form = SQLFORM.factory(
> Field('first_name',
>   label='First Name',
>required=True),
> Field('last_name',
>   label='Last Name',
>required=True),
> Field('new_password', 'password',
>   label=self.messages.new_password,
>   requires=self.table_user()[passfield].requires),
> Field('new_password2', 'password',
>   label=self.messages.verify_password,
>   requires=[IS_EXPR(
>   'value==%s' % repr(request.vars.new_password),
> self.messages.mismatched_password)]),
> submit_button='Confirm Registration',
> hidden=dict(_next=next),
> formstyle=self.settings.formstyle,
> separator=self.settings.label_separator
> )
> if form.accepts(request, session,
> hideerror=self.settings.hideerror):
> user.update_record(
> **{passfield: str(form.vars.new_password),
>'first_name': str(form.vars.first_name),
>'last_name': str(form.vars.last_name),
>'registration_key': '',
>'reset_password_key': ''})
> session.flash = self.messages.password_changed
> if self.settings.login_after_password_change:
> self.login_user(user)
> redirect(next, client_side=self.settings.client_side)
> return form
>
>
> def email_registration(self, user):
> """
> Modified version of Auth.email_reset_password()
> """
> import
> ...

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

[web2py] Re: on_define in dummy table

2015-05-27 Thread Massimo Di Pierro
I do not think on_define is ever called in this case.

On Thursday, 21 May 2015 10:14:15 UTC-5, 黄祥 wrote:
>
> hi,
>
> i want to create table inheritance using dummy table (from web2py book), 
> but when i try to mix it with on_define, the result is not expected (no 
> errors occured)
> e.g.
> *not work*
> def on_define_detail_0(table):
> table.product.label = T('123')
>""" cutted """
>
> detail_0 = db.Table(db, 'detail_0',
> Field('product', 'reference product'), 
> on_define = on_define_detail_0)
> 
> *work*
> detail_0 = db.Table(db, 'detail_0',
> Field('product', 'reference product', label = T('123') ) )
>
> is it possible to use on_define in dummy table? 
>
> 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: Recommended strategy for passing complex query parameters to a REST API

2015-05-27 Thread Massimo Di Pierro
I assume what you mean by rest principles is that you want to do a GET and 
not a POST. Problem is some browsers (for example IE) have limits on the 
size of the path_info in GET methods. So if you do not care about that you 
can do

.../api/available_resources?query={...}


where query here is a url-encoded jsonobject.
web2py does offer two more sophisticated mechanisms:

http://stackoverflow.com/questions/11991678/can-web2py-serve-rest-data-of-many-to-may-tables-via-parse-as-rest

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


On Thursday, 21 May 2015 22:42:12 UTC-5, ke...@amplifieddevelopment.net 
wrote:
>
> Thanks, Massimo.  I can see how that would work well in the web2py 
> environment.
>
> In our organization, however, we have heterogeneous systems that use REST 
> interfaces to share data.  So, I am hoping to find a solution that aligns 
> as closely as possible with REST principles.
>
>
>
> On Tuesday, May 19, 2015 at 10:38:36 PM UTC-7, Massimo Di Pierro wrote:
>>
>> Hello Kevin,
>>
>> the best way is to make an Ajax request with content type 'application/json' 
>> and put the JSON search_criteria into the HTTP request body. For example:
>>
>> curl -H "Content-Type: application/json" - X POST -d "{...}" 
>> http:///mypage
>>
>> where {...} is your JSON object. Then in the web2py app
>>
>> def mypage():
>>  data = request.post_vars
>>  ...
>>
>> data will contain the parsed JSON as a python object.
>>
>>
>>
>>
>>
>>
>> On Tuesday, 19 May 2015 19:50:22 UTC-5, ke...@amplifieddevelopment.net 
>> wrote:
>>>
>>> We are developing a RESTful API.  One of our use cases requires that we 
>>> query a resource with somewhat complex search criteria.  Internally, the 
>>> search criteria would be represented by a data structure similar to this:
>>>
>>> search_criteria = {'date':'5/31/2015',
>>>'locations':[{'location_name':'Los Angeles',
>>>  'attendees':10,
>>>  'services':['Housekeeping','Catering']
>>> },
>>> {'location_name':'New York',
>>>  'attendees':5,
>>>  'services':['Housekeeping']
>>> }
>>>],
>>>'duration':60
>>>
>>> }
>>>
>>>
>>> What would be a recommended strategy for passing complex query parameters 
>>> to a RESTful API built with web2py?
>>>
>>>
>>> Our short term solution has been to provide simple query parameters that 
>>> can contain delimited values.  For example:
>>>
>>>
>>> GET  .../api/available_resources/?date=2015-05-31&locations=Los 
>>> Angeles|New 
>>> York&attendees=10|5&services=Housekeeping,Catering|Housekeeping&duration=60
>>>
>>>
>>> But, this seems less than ideal.  It is not intuitive that Los Angeles 
>>> should be associated with 10 attendees and the two specified services.
>>>
>>>
>>> Options we have considered include:
>>>
>>>
>>>- Treating the search criteria as a resource.  Thus, we would first POST 
>>> the complex search criteria and receive a handle in return.  Then, we would 
>>> GET available_resources, passing the search criteria handle.  (This seems 
>>> to be messy regarding how to handle the search criteria.  Is it stored 
>>> statefully in the session?  Is it written to the database?  When would it 
>>> get cleaned up?)
>>>- Treat the search as a command.  We would POST a resource search 
>>> command with a JSON representation of the search criteria in the body.  
>>>- Implement oData parsing for the query string.  (While it is true that 
>>> oData syntax could be constructed to meet the needs, yikes!, that's a lot 
>>> of overhead for the API consumer and the API parser.)
>>>
>>> Are any of these considered best practice?  Or, is there yet another 
>>> strategy that we could consider?
>>>
>>> Many thanks for your help!
>>>
>>> Kevin
>>>
>>>
>>>
>>>

-- 
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: Multiple apps with different DB and auth on same web2py

2015-05-27 Thread Massimo Di Pierro
You must have routes or some wrong redirection in one of the apps.

On Saturday, 23 May 2015 12:32:02 UTC-5, Saifuddin Rangwala wrote:
>
> Hi,
>
>   I have got 2 apps on my web2py. Both the apps are different and 
> having their own separate database and users.
>
>   In this situation for some reason if I try to login to any app, 
> it always defaults to login for one app. 
>
> i.e. I have app A and app B. Now if I hit http://127.0.0.1/B, it still 
> goes to login page of A.
>
>   Not sure what I am missing here. There is no routes.py file, and I have 
> deleted the default welcome app. There are only 2 apps in my applications 
> directory.
>
> Any help is appreciated!
>
>
> -- 
> Saif.
>  

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


[web2py] Re: great system login

2015-05-27 Thread Massimo Di Pierro
+1

On Sunday, 24 May 2015 19:43:34 UTC-5, villas wrote:
>
> This looks like an excellent project.
> Replace Janrain?  
>

-- 
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: Extra field in the register form

2015-05-27 Thread Massimo Di Pierro
To add fields to auth forms you have to use

auth.settings.extra_fields['auth_user'] = [ Field(...), Field(...) ]




On Monday, 25 May 2015 03:09:10 UTC-5, mweissen wrote:
>
> I want to have an extra field in the register form but not in the 
> auth_user table.
> There has been some threads about this topic in the past.
>
> In user.html I have added:
>
> elif request.args(0)=='register':
> form[0].insert(-1, DIV(
>  LABEL(T('registercode'),_class="control-label col-sm-3"),
>  DIV(
>   INPUT(_name='registercode', _placeholder="z.B. xs5trv", 
> _class="form-control string"),
>   SPAN(_class="help-block"),
>   _class="col-sm-9"),
>  _class="form-group"))
> pass
> =form
>
> ​and in db.py there is a simple validation code:
>
> def validate_registercode(form):
> print "reg", form.vars
> if form.vars.registercode!="123":
> form.errors.registercode="*** Error ***"
> 
> auth.settings.register_onvalidation=[validate_registercode]
>
> ​This creates a nice form containing the new field "registercode". auth 
> calls the validate_registercode, but form.vars does not contain the new 
> field "registercode", only the fields last_name, first_name and so on. 
> What is wrong?
>
> And: is there a better way to add a new field *together with its classes*?
>
> ​R
> ​egards, Martin​
>
>
> 

-- 
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: tornado 403 with websocket messaging

2015-05-27 Thread Massimo Di Pierro
Can you submit a pull request?

On Monday, 25 May 2015 11:54:35 UTC-5, Serbitar wrote:
>
>
>
> to fix this:
>
>
> http://stackoverflow.com/questions/24851207/tornado-403-get-warning-when-opening-websocket
>  
> with current web2py and tornado 4+
>
> you have to modify: gluon/contrib/websocket_messaging.py 
>
> to
>
> class DistributeHandler(tornado.websocket.WebSocketHandler):
>
> def check_origin(self, origin):
> return True
>
> def open(self, params):
> group, token, name = params.split('/') + [None, None]
> self.group = group or 'default'
> self.token = token or 'none'
> self.name = name or 'anonymous'
> # only authorized parties can join
> ...
>
> Thanks
>

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


[web2py] Re: GAE SDK: Getting ImportError for gluon.contrib.populate import populate

2015-05-27 Thread Massimo Di Pierro
There is this line in app.yaml:

skip_files:


 (contrib/(populate|taskbar_widget)\.py)|

by default we do not deploy populate on GAE because of its size. remove 
that line.

On Thursday, 29 September 2011 04:52:16 UTC-5, glomde wrote:
>
> Hi, 
>
> I am trying to use GAE but I get import error on populate in 
> db_wizard_populate.py. 
>
> It seems to do with the restricted environment. Do anybody know how to 
> fix this? 
>
> The traceback is: 
>
> Traceback (most recent call last): 
>   File "/home/g/web2py/gluon/restricted.py", line 192, in restricted 
> exec ccode in environment 
>   File "/home/g/web2py/applications/myapp2/models/ 
> db_wizard_populate.py", line 3, in  
> from gluon.contrib.populate import populate 
>   File "/home/g/web2py/gluon/custom_import.py", line 280, in __call__ 
> fromlist, level) 
>   File "/home/g/web2py/gluon/custom_import.py", line 74, in __call__ 
> level) 
> ImportError: No module named populate 
>

-- 
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] Reportlab, Platypus and tables

2015-05-27 Thread Jason (spot) Brower
Pdf reporting can take a lot of work. Is this for a single page report or
many pages. How are formated? And do you have an examole report in pdf
format?

On Thu, May 28, 2015, 08:16 Felix Penetrante  wrote:

> I have just started using Reportlab for my app's pdf report needs and I
> can't find examples on how to control the table appearance (i.e. border,
> alignment, color, etc).  I already scoured through the web2py's
> documentation but it has a minimal example and is of no help on my table
> needs.  Is there any web resource out there that has a sample code snippet
> on the use of tables in Reportlab with platypus?  Or better yet can anyone
> provide a proper and comprehensive example on use of Reportlab platypus?
>
> Many thanks.
>
>
> “This message contains confidential information and is intended only for
> the individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
> The sender therefore does not accept liability for any errors or omissions
> in the contents of this message, which arise as a result of e-mail
> transmission. If verification is required please request a hard-copy
> version.” Bicol University, Legazpi City, Philippines.
> “This message contains confidential information and is intended only for
> the individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
> The sender therefore does not accept liability for any errors or omissions
> in the contents of this message, which arise as a result of e-mail
> transmission. If verification is required please request a hard-copy
> version.” Bicol University, Legazpi City, Philippines.
>
> --
> 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] Database

2015-05-27 Thread Nico de Groot
Hello Dan,
You can only see and use tables and fields you define in a model file, see the 
web2py book for details.
Nico de Groot

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