[web2py] Re: passing arguments from view to a controller function

2016-06-18 Thread Anthony
Always show your code.

On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, @brooks wrote:
>
> Hi
> I am trying to make an online calendar.Now,to add an event to a particular 
> date I m doing the following:
> -the user clicks on a date and an event window pops up and the event 
> inserted is then added to the database.
> -so,when the user clicks the (date) element ,the "event" window has to 
> pop up which contains an SQLFORM for the event field and date field which 
> has to be prepopulated.i am able to pass the date to the "event" window 
> using javascript.but i am not able to access arguments(i.e. date) ,in fact 
> nothing is being displayed in the "event" window(i tried printing just 
> "hello".but even that is not working).please help
>
>

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


[web2py] Re: Overriding a button callback function in SQLFORM grid

2016-06-18 Thread Anthony
def Grid_Home():
if 'view' in request.args:
redirect(URL('default', 'displayContents', args=request.args[-1]))
grid = SQLFORM.grid(db.somedatabase,csv=False,user_signature=False,
   editable=False, create=False)
   return dict(grid=grid)

The id of the requested record will be in request.args[-1], so that is 
passed on to displayContents in the redirect.

Alternatively, if you want to avoid a redirect, you can instead disable the 
standard View button (by setting details=False), and instead use the 
"links" argument to create your own custom button/link, which could point 
directly to the displayContents URL.

Anthony


On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Natalie Cluck wrote:
>
> How do I override what the View button does when clicked in SQLFORM.grid? 
> This is what I have:
>
> def Grid_Home():
> grid = SQLFORM.grid(db.somedatabase,csv=False,user_signature=False,
> editable=False, create=False)
> return dict(grid=grid)
>
> def displayContents():
> # new page when View button is clicked
>
> I want to create a new grid on the displayContents page that uses my 
> existing databases to display contents of a item listed in the "home grid."
>

-- 
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: Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user

2016-06-18 Thread Anthony
What you are doing is roughly equivalent to just doing:

redirect(URL('default', 'user', args='login'), client_side=True)

When you call redirect during an Ajax request, setting client_side=True 
causes the parent window to redirect (via Javascript). So, you could do 
something like:

def get_index():
if not auth.user:
redirect(URL('default', 'user', args='login'), client_side=True)
if not auth.has_membership('role'):
raise HTTP(403, ...)

Anthony


On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Paco Bernal wrote:Hi all,

This is my first question here, although I use it sometimes to read a few 
questions that I make to myself when coding using this cool and great tool. 
Thanks.

A few months ago I started to use ajax to fill middle column of screen from 
clicks (interaction with the user) in the left sidebar and sometimes to 
show right side bar with more info when interacting with middel column. 
Maybe looking for ways to opotimaze data flow in the network and from the 
server, and for learning.

Something like this:

ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], 
'div_target');

But when the user lose his session (you can delete cookies for example) 
because of ajax to fill a div, nothing happens when the user clicks on the 
left side bar, no error and no redirect to user login even with 
@auth.requires_membership('roll') in defs inside the controller.

So, the only way I found is to add these lines at the beginning of the 
controller :

#--
if not auth.user and not session.not_auth:
session.not_auth = True
redirect (URL('not_auth'))
#--
def not_auth():
session.not_auth = None
return dict()
#--

and the view, no_auth.html:

{{include 'web2py_ajax.html'}}

$( document ).ready(function() {
$(location).attr('href', '{{=URL('user','login')}}');
});


The question is, is there any other more elegant way (or not) to do the 
same?

Thanks 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] Re: How to use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Anthony
OK, no worries. Thanks for clarifying.

One other option that would be entirely outside the application is putting 
something like the following in routes.py:

from gluon.settings import global_settings
global_settings.mysetting = 'some value'

Then you can import and access the global settings from within the 
application.

Anthony

On Saturday, June 18, 2016 at 9:05:01 PM UTC-4, Dominic Mayers wrote:
>
> Your description of what happened is accurate and I realize that I was 
> needlessly on the defensive, as if you were telling me that my question was 
> a bad one. There was no intention to be rude. I was just defending my 
> question.  I realize that you simply tried to help and feel bad about my 
> reply. As I am new with web2py, your help is very much appreciated. I am 
> still looking at the WSGI middleware option.  Thank you for your guidance. 
>
> On Saturday, 18 June 2016 20:16:03 UTC-4, Anthony wrote:
>>
>> On Saturday, June 18, 2016 at 1:35:40 PM UTC-4, Dominic Mayers wrote:
>>>
>>> Had I been happy with "you just have to ensure that the update mechanism 
>>> doesn't allow that file to be overwritten or deleted.", then I would not 
>>> have asked the question.
>>>
>>
>> Hi Dominic,
>>
>> You seem to be new here. For future reference, note that we generally try 
>> to be more respectful with our responses, particularly as everyone who 
>> contributes here does so voluntarily.
>>
>> Anyway, as I noted, it was difficult to know what you would have "been 
>> happy with," as you did not articulate the nature of the update mechanism. 
>> For example, if someone sends you a zipped application folder, you could 
>> simply unzip it over a fixed "wrapper" application (setting the unzip 
>> options to prevent overwriting). Furthermore, I only offered that option as 
>> a possibly simpler alternative depending on your use case, already having 
>> explained the more robust WSGI middleware option.
>>
>> Anthony
>>
>

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


[web2py] Re: Question on BEAUTIFY with list of tuples

2016-06-18 Thread Anthony
Probably something else is going on. I suggest you create a minimal app 
that reproduces the problem and post it.

Anthony

On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, DNeuman wrote:
>
> Hi - first time posting here! First let me say thanks to Professor Di 
> Pierro and all the people who have done a great job on Web2Py. I am new to 
> web development, and Python, so I really appreciate all the work you did to 
> make this subject approachable. Now for my question:
>
> I am having some difficulty passing a list of tuples from a controller 
> using  'return locals()'  sometimes it hangs the web2py server.
>
> I have spent a week narrowing this down, and here is what I have; some 
> works, some does not...
>
> If I create a simple list named bob = [(2L, 0.2075327747768832), (16L, 
> 0.19108106970048253), (3L, 0.13288897732583363), (15L, 
> 0.11511204575971237), (12L, 0.10369170755981243), (7L, 0.1033849215142939), 
> (8L, 0.0957849868092478), (5L, 0.05052350890092832)]
>
> then return locals()  I can see this in response._vars  in the debugger 
> and {{=BEAUTIFY(response._vars)}} works fine.  (thats good)
>
>
> However, if I create the same exact list as an output of a sorting 
> operation from a dictionary, it hangs the web2py server when I use return 
> locals() and {{=BEAUTIFY(response._vars)}}   (but only sometimes)
>
>
> Here is what the code is used to generate the sorted list:
>
> def make_list():
> from operator import itemgetter
> #dbg.set_trace() # stop here!
>
> test_dict ={}
>
> test_dict[2L] = 0.773
> test_dict[5L] = 0.003
> test_dict[1L] = 0.31
> test_dict[9L] = 0.0402
> test_dict[12L] = 0.12
> test_dict[7L] = 0.214
>
> test_list = sorted(test_dict.iteritems(), key=itemgetter(1), 
> reverse=True)
>
> return test_list #this should be a list of tuples 
> [(x,y),(w,z)...()]
>
>
> But here is the weird part - if I have this test case standalone, it 
> always works. If I use sorted() in a larger program, it exhibits the hang. 
> Very consistent. standalone test = no problem. larger problem = broken.
>
> More about the server hang:
>
> passing bob through locals() causes a hang, whether BEAUTIFY(bob) or 
> BEAUTIFY(response._vars)as long as bob is generated from the sorted() 
> function. Never hangs when generated from simply creating a list of tuples.
>
>
> passing bob through locals() doesn’t hang unless BEAUTIFY(bob).  So, if I 
> don't use bob in the view, it doesn't hang. There is something about 
> passing this through locals, AND using BEAUTIFY AND creating the list from 
> sorted() AND being in a larger program.
>
>
> making bob from sorted() in a large program = hang:
>
> use return locals() and BEAUTIFY(response._vars)  -- hang
>
> use return locals() and BEAUTIFY(bob)-- hang
>
>
> works:
>
> return locals() and BEAUTIFY(qlist)   
>  -- no hang; qlist is some other variable
>
> return locals() and use view {{=bob[0]   =bob[1]   =bob[2] }}   -- 
> no hang; here I simply don't use BEAUTIFY and it all works
>
> bob created without using sorted() 
>  -- no hang; can do whatever I like and it works.
>
>
>
> So I can only guess that I am using sorted() wrong, or using BEAUTIFY 
> wrong, or there is some very mysterious aspect of the list that is not 
> visible in the debugger which is confusing BEAUTIFY.
>
>
> when I examine response._vars in cases where there is a hang it is 
> identical to cases where there is no hang.
>
>
> details:
>
> Mac OS X El Capitan  10.11.5
>
> Web2py 2.14.2-stable+timestamp.2016.03.24.22.47.49
>
> modules installed: numpy
>
> browser: Safari
>
>
> Much appreciate any pointers here! 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: How to use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Dominic Mayers
Your description of what happened is accurate and I realize that I was 
needlessly on the defensive, as if you were telling me that my question was 
a bad one. There was no intention to be rude. I was just defending my 
question.  I realize that you simply tried to help and feel bad about my 
reply. As I am new with web2py, your help is very much appreciated. I am 
still looking at the WSGI middleware option.  Thank you for your guidance. 

On Saturday, 18 June 2016 20:16:03 UTC-4, Anthony wrote:
>
> On Saturday, June 18, 2016 at 1:35:40 PM UTC-4, Dominic Mayers wrote:
>>
>> Had I been happy with "you just have to ensure that the update mechanism 
>> doesn't allow that file to be overwritten or deleted.", then I would not 
>> have asked the question.
>>
>
> Hi Dominic,
>
> You seem to be new here. For future reference, note that we generally try 
> to be more respectful with our responses, particularly as everyone who 
> contributes here does so voluntarily.
>
> Anyway, as I noted, it was difficult to know what you would have "been 
> happy with," as you did not articulate the nature of the update mechanism. 
> For example, if someone sends you a zipped application folder, you could 
> simply unzip it over a fixed "wrapper" application (setting the unzip 
> options to prevent overwriting). Furthermore, I only offered that option as 
> a possibly simpler alternative depending on your use case, already having 
> explained the more robust WSGI middleware option.
>
> Anthony
>

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


[web2py] Re: How to get Month name instead of month number

2016-06-18 Thread 黄祥
i think you can use python strftime
e.g.
{{from datetime import date}}
{{=SPAN(row.f_start_time.strftime("%b") ) }}
*Result : Mar*
{{=SPAN(row.f_start_time.strftime("%B") ) }}
*Result : March*

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: solution for reuse code in modules directory for different application

2016-06-18 Thread Anthony
For modules shared among multiple applications, just make sure they are 
anywhere in sys.path (e.g., in the site-packages directory) -- they do not 
have to been in the modules folder of an application. If you want to keep 
the modules within a particular application, you can simply import them 
into other applications by specifying the full path:

from applications.otherapp.modules import mymodule

Anthony

On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, 刘志军 wrote:
>
> Hello web2pyer,
>
> I have a big project that I divided it into several applications based on 
> the user roles.
> Most of the code was written follow the model-less pattern that lots of 
> source file under modules directory.
> the problem is some of the source files need to be used in different 
> applications, so I have to copy the file across the applications, but it 
> could not be synced when one of them was edited or changed.
> Does someone can suggest some advice on how to share the source files 
> under modules directory?
>
> BTW: currently I am using git sub-module to manage all the modules in 
> three applications, but I won't like to share ALL the modules in each of 
> the application.
>
> Thank you!
>
> Zhijun
>
> Best,
> Regards
>

-- 
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: Execute Python code when pressing a button

2016-06-18 Thread Anthony
This is not how web2py works. You cannot call a Python function from 
Javascript -- they are two different languages running in different 
environments. If you need an action in the browser to trigger some code to 
run on the server, you must make an Ajax request. Please read 
http://web2py.com/books/default/chapter/29/11/jquery-and-ajax.

Anthony

On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, John Doe wrote:
>
> Hello, i am trying to remotely turn ON/OFF a LED that is connected to a 
> RaspberryPi.
> I have installed Web2Py on my PC (that is running Ubuntu). Additionaly i 
> have installed Paramiko for my SSH conection.
>
> I've put this code in a Controller called led.py:
>
> import paramiko
> def leds_set(state):
>   ssh = paramiko.SSHClient()
>   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>   ssh.connect('192.168.2.100', username='myuser', password='mypassword')
>   if state:
> state = 'on'
>   else:
> state = 'off'
>   stdin, stdout, stderr = ssh.exec_command('python /home/pi/led.py ' + state)
>   print(stdin, stdout, stderr)
>   return dict()
>
>
>
>
> I replaced index.html with this. It does not work.
>
> {{extend 'layout.html'}}
>
> 
> 
> 
> 
>
>
>
> The last piece of code (led.py) that is on my Raspberry Pi is for testing 
> purposes (i know that is completely broken, but i only need to know if it 
> works by turning the LED ON).
>
> import time
> import os
> import RPi.GPIO as GPIO
> GPIO.setmode(GPIO.BOARD)
> GPIO.setwarnings(False)
> GPIO.setup(11, GPIO.OUT)
>
> state = sys.argv[1]
>
> if state =='on':
> print('Led ON')
> GPIO.output(11,True)
> time.sleep(2)
> GPIO.output(11,False)
> time.sleep(2)
> GPIO.cleanup()
>
>
> So, i think that the problem is the HTML part because i got this error (in 
> console): 
>
> Uncaught ReferenceError: leds_set is not defined.
>
> What can i do so i could run led.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] Re: One-Step Production Deployment: Who Moved the Cheese?

2016-06-18 Thread Anthony
You can use any of the scripts here 
that start with 
"setup" (some may be outdated -- we recommend nginx+uwsgi). I think they 
generally assume a fresh server and are not necessarily idempotent. Feel 
free to simply look through the scripts (which are commented) and extract 
only the parts you need.

Anthony

On Saturday, June 18, 2016 at 7:49:25 PM UTC-4, horridohobbyist wrote:
>
> But what if my Ubuntu server is already setup for Apache. Do I have to 
> abandon or *uninstall* Apache?
>
> I don't have any experience with nginx. *Do I have to learn nginx*, or 
> will the setup-web2py-nginx-uwsgi-ubuntu.sh script *do everything for me* 
> (I presume that's what one-step deployment means)?
>
> Thanks.
>
> On Saturday, 18 June 2016 19:36:58 UTC-4, Anthony wrote:
>>
>> Oops. It is now recommended that you use nginx+uwsgi instead of 
>> Apache+mod_wsgi, so, you could change the URL to:
>>
>>
>> https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
>>
>> Anthony
>>
>> On Saturday, June 18, 2016 at 4:35:37 PM UTC-4, horridohobbyist wrote:
>>>
>>> Is the web2py book out of date or out of sync? For one-step production 
>>> deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode.
>>>
>>> How can I setup web2py to work on a headless Ubuntu server quickly and 
>>> easily?
>>>
>>

-- 
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 use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Anthony
On Saturday, June 18, 2016 at 1:35:40 PM UTC-4, Dominic Mayers wrote:
>
> Had I been happy with "you just have to ensure that the update mechanism 
> doesn't allow that file to be overwritten or deleted.", then I would not 
> have asked the question.
>

Hi Dominic,

You seem to be new here. For future reference, note that we generally try 
to be more respectful with our responses, particularly as everyone who 
contributes here does so voluntarily.

Anyway, as I noted, it was difficult to know what you would have "been 
happy with," as you did not articulate the nature of the update mechanism. 
For example, if someone sends you a zipped application folder, you could 
simply unzip it over a fixed "wrapper" application (setting the unzip 
options to prevent overwriting). Furthermore, I only offered that option as 
a possibly simpler alternative depending on your use case, already having 
explained the more robust WSGI middleware option.

Anthony

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


[web2py] Re: One-Step Production Deployment: Who Moved the Cheese?

2016-06-18 Thread horridohobbyist
But what if my Ubuntu server is already setup for Apache. Do I have to 
abandon or *uninstall* Apache?

I don't have any experience with nginx. *Do I have learn nginx*, or will 
the setup-web2py-nginx-uwsgi-ubuntu.sh script *do everything for me* (I 
presume that's what one-step deployment means)?

Thanks.

On Saturday, 18 June 2016 19:36:58 UTC-4, Anthony wrote:
>
> Oops. It is now recommended that you use nginx+uwsgi instead of 
> Apache+mod_wsgi, so, you could change the URL to:
>
>
> https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
>
> Anthony
>
> On Saturday, June 18, 2016 at 4:35:37 PM UTC-4, horridohobbyist wrote:
>>
>> Is the web2py book out of date or out of sync? For one-step production 
>> deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode.
>>
>> How can I setup web2py to work on a headless Ubuntu server quickly and 
>> easily?
>>
>

-- 
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: One-Step Production Deployment: Who Moved the Cheese?

2016-06-18 Thread Anthony
Oops. It is now recommended that you use nginx+uwsgi instead of 
Apache+mod_wsgi, so, you could change the URL to:

https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

Anthony

On Saturday, June 18, 2016 at 4:35:37 PM UTC-4, horridohobbyist wrote:
>
> Is the web2py book out of date or out of sync? For one-step production 
> deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode.
>
> How can I setup web2py to work on a headless Ubuntu server quickly and 
> easily?
>

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


[web2py] Re: Bootstrap is really killing web2py

2016-06-18 Thread Dominic Mayers

Yes Anthony, this was my understanding, but I am glad that you confirm.  I 
appreciate very much the time you spent to explain. And, Yes, it was 
debunked and there is even a scaffolding version with Bootstrap 3,  
confirming the point.  Still, I also appreciate the response of Massimo, 
pointing out that there is a general difficulty in the integration of 
arbitrary CSS + HTML approaches into any framework. Custom layout could 
easily be created with bootstrap 3 and yet there was still a difficulty in 
the integration process.  I do believe that the difficulty is inherent to 
the complexity of layouts + styles, which prevent the creation of an 
abstraction layer over templates similar to what we have in the case of 
database structures.

On Saturday, 18 June 2016 13:29:54 UTC-4, Anthony wrote:
>
> On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Dominic Mayers wrote:
>>
>> I am just starting to learn web2py and I want to better understand the 
>> issue.  Is the issue simply that Bootstrap 3 is not backward compatible 
>> with v2.x and therefore we cannot use Bootstrap3 with the templates in 
>> web2py that have been created with Bootstrap 2 ?
>>
>
> Yes, though this is not really an issue because even if you want a custom 
> Bootstrap 2 theme, you still cannot simply use the existing front-end 
> scaffolding app without making significant modifications. The front-end 
> scaffolding application is just intended as a quick and easy starting 
> point. If you want a custom layout, you need to implement that, and 
> implementing a custom layout is equally easy/difficult regardless of which 
> CSS framework you are using.
>  
>
>>   The issue seems to be bigger than that because we would need to modify 
>> "all parts of web2py that are tightly bound  to bootstrap", but what does 
>> this mean?
>>
>
> You should read back through this thread, as that statement has been 
> debunked. No parts of web2py are tightly bound to Bootstrap, as web2py 
> itself predates Bootstrap. The front-end scaffolding application is based 
> on Bootstrap 2, and web2py forms and the grid include some convenience 
> formatting options for Bootstrap 2 and 3, but you can use all of these 
> elements without Bootstrap at all, as they always had been used prior to 
> Bootstrap's existence.
>  
>
>>   Of course, we expect a coupling between the view and the remainder of 
>> the code. The code has to provide data as expected in the view. There is no 
>> way this can be avoided, even in a loosely coupled framework. So, is this 
>> the only issue? I would like to know if there was a fundamental flaw in the 
>> design of web2py?
>>
>
> Keep in mind that most server-side web frameworks don't provide a 
> front-end scaffolding application nor built-in formatting options for any 
> CSS frameworks. web2py happens to provide a bit more than other frameworks 
> in this regard. Some of what it provides happens to be based on Bootstrap, 
> but you can simply ignore all of that and use whatever CSS framework you 
> want -- and at that point, you are no worse off than you would be with one 
> of the many other server-side frameworks.
>
> Anthony
>

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


[web2py] How to get Month name instead of month number

2016-06-18 Thread Steve
Goodevening,

I loop through rows and am trying to show a date format like: 23 april.
What i get is : 23 4 ( as expected) and i would like to convert the month 
number to a month name.

this is the code that i have so far:

  {{for row in 
db(db.t_appointment.created_by==auth.user.id).select(orderby=~db.t_appointment.created_on):}}
 
  

  {{=row.f_start_time.day}} 
{{=row.f_start_time.month}}
  {{=row.f_start_time.hour}}:{{=row.f_start_time.minute}}


  {{=row.f_title}}
  {{=row.f_log}}

  
   {{pass}}

this works fine except month name ... not able to convert number to name

hope that someone can help me...

steve

-- 
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] One-Step Production Deployment: Who Moved the Cheese?

2016-06-18 Thread horridohobbyist
Is the web2py book out of date or out of sync? For one-step production 
deployment, the setup-web2py-ubuntu.sh file is no longer at Googlecode.

How can I setup web2py to work on a headless Ubuntu server quickly and 
easily?

-- 
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: Extract Models from MS SQL Server

2016-06-18 Thread Ron Chatterjee
Little clarification: 

 name of the dbase: "nameofmydb". Port is 80. username is root and no 
password. What would the equivalent call to this routine? I did this but 
didn't get any results:

python extract_mysql_models.py nameofmydb localhost 80 root > db_model.py

Am I missing anything? But I do the following in python and it works fine. 


import MySQLdb
import sys
import os

try:
db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '',db = 
'nameofmydb')
except Exception as e:
sys.exit('we cant get into the db');

cursor = db.cursor()
#Lets put some values into the db
cursor.execute('INSERT INTO catagory(name,id,text) VALUES("Peggy", "2", 
"Missing Tom here")') 

#lets fetch and output
cursor.execute('SELECT *FROM catagory')
results = cursor.fetchall()
print results


 >>>(('Peggy', 2L, 'Missing Tom here'))






On Saturday, June 18, 2016 at 9:12:17 AM UTC-4, Massimo Di Pierro wrote:
>
> Nice. In trunk!
>
> On Thursday, 16 June 2016 16:54:20 UTC-5, Kyle Flanagan wrote:
>>
>> I needed the ability to extract a DAL model from SQL Server. I based the 
>> script below on extract_pgsql_models by Mariano Reingart, based in turn on 
>> a script to "generate schemas from dbs" (mysql) by Alexandre Andrade. I'm 
>> posting it here in hopes that it will be useful for others.
>>
>> Tested on Windows 7 on a SQL Server 2012 database. Make sure to replace 
>> "mssql4://..." with the appropriate connection string if using a legacy SQL 
>> Server database. You might also need to modify the pyodbc.connect 
>> connection string driver to match a driver on your local PC.
>>
>> """Create web2py model (python code) to represent MS SQL Server tables.
>> Features:
>> * Uses ANSI Standard INFORMATION_SCHEMA (might work with other RDBMS)
>> * Detects legacy "keyed" tables (not having an "id" PK)
>> * Handles 'funny' column names. web2py requires all column names be valid 
>> python identifiers. This script uses rname
>> *   for column names that have spaces or are otherwise invalid python 
>> identifiers.
>> * Connects directly to running databases, no need to do a SQL dump
>> * Handles notnull, unique and referential constraints
>> * Detects most common datatypes and default values
>> * Supports running from the command line as well as from an IDE's debug 
>> menu. See the COMMAND_LINE_MODE constant below
>> *   for more info.
>>
>> Requirements:
>> * Needs pyodbc python connector
>>
>> Created by Kyle Flanagan. Based on a script by Mariano Reingart which was
>> based on a script to "generate schemas from dbs" (mysql) by Alexandre Andrade
>> """
>>
>> _author__ = "Kyle Flanagan "
>>
>> HELP = """
>> USAGE: extract_mssql_models db host port user passwd
>> Call with SQL Server database connection parameters,
>> web2py model will be printed on standard output.
>> EXAMPLE: python extract_mssql_models.py mydb localhost 3306 kflanaga pass
>> or
>> python extract_mssql_models.py mydb localhost 3306 kflanaga pass > 
>> db_model.py
>> """
>>
>> # Config options
>> DEBUG = False  # print debug messages to STDERR
>> SCHEMA = 'dbo'
>> COMMAND_LINE_MODE = True  # running from command prompt. Disable to specify 
>> variables and use in IDE
>> DB = None
>> HOST = None
>> USER = None
>> PASSWD = None
>> PORT = None
>>
>> # Constant for Field keyword parameter order (and filter):
>> KWARGS = ('type', 'length', 'default', 'required', 'ondelete',
>>   'notnull', 'unique', 'label', 'comment', 'rname')
>>
>> import sys
>> import re
>> # This is from pydal/helpers/regex.py as of 2016-06-16
>> # Use this to recognize if a field name need to have an rname representation
>> REGEX_VALID_TB_FLD = re.compile(r'^[^\d_][_0-9a-zA-Z]*\Z')
>> # For replacing invalid characters in field names
>> INVALID_CHARS = re.compile(r'[^a-zA-Z0-9_]')
>>
>>
>> def get_valid_column_name(field):
>> """Return a valid column name that follows Python's rules for 
>> identifiers, which is what web2py requires for column
>> names. Replaces invalid characters with underscores and leading digits 
>> with their associated English word."""
>> if not REGEX_VALID_TB_FLD.match(field):
>> # If the first character is a digit, replace it with its word 
>> counterpart
>> if re.match(r'^[0-9]', field):
>> numbers = ['Zero', 'One', 'Two', 'Three', 'Four',
>>'Five', 'Six', 'Seven', 'Eight', 'Nine']
>> field = numbers[int(field[0])] + field[1:]
>>
>> field = INVALID_CHARS.sub('_', field)
>> return field
>>
>>
>> def query(conn, sql, *args):
>> "Execute a SQL query and return rows as a list of dicts"
>> cur = conn.cursor()
>> ret = []
>> try:
>> if DEBUG: print >> sys.stderr, "QUERY: ", sql % args
>> cur.execute(sql % args)
>> for row in cur:
>> dic = {}
>> for i, value in enumerate(row):
>> field = cur.description[i][0]
>> dic[field] = value
>> if 

[web2py] Re: How to use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Dominic Mayers
Of course, if was happy with "you just have to ensure that the update 
mechanism doesn't allow that file to be overwritten or deleted.", then I 
would not have asked the question. The purpose was to avoid having to be 
careful at that level.  I am not the one that will manage the updates and a 
simple wrapper created only once would avoid this issue for every future 
updates.  However, this is only practical if it is easy to create the 
wrapper, as it is the case in PHP. 

On Saturday, 18 June 2016 13:17:43 UTC-4, Anthony wrote:
>
> It's not clear exactly what you want to make modular, and what elements of 
> the system need to be unmodifiable. If you want everything within a given 
> application folder inside the /web2py/applications folder to be modifiable 
> but need some unmodifiable component to be able to modify the request 
> and/or response, you might want to consider WSGI external middleware 
> , 
> which is the standard means for wrapping a WSGI application.
>
> But depending on your use case, it might also be sufficient to simply 
> include a special model file in the app that sets up the configuration on 
> each request -- you just have to ensure that the update mechanism doesn't 
> allow that file to be overwritten or deleted.
>
> Anthony
>
> On Saturday, June 18, 2016 at 11:11:25 AM UTC-4, Dominic Mayers wrote:
>>
>> The use case that I have in mind is that I create a wrapper web2py 
>> application over another web2py application that will be updated regularly 
>> by a third party. I do not want to have to update the wrapper at each  
>> update.  The specific use case that I have in mind is that the wrapper 
>> application only sets the location of a configuration file and then calls 
>> the actual application, which uses this configuration file.  However, never 
>> mind this specific use case, because the objective here is very standard 
>> and general - it's the usual concept of modularity: the web2py application 
>> is like a module that you can update without having to change the wrapper 
>> application.   How can we do that in web2py?It's perfectly fine if the 
>> web2py "application" is not exactly an application as long as it can be 
>> edited as an application and just need to be plugged in a simple wrapper 
>> application.  This is very easy to do in PHP: you simply include the PHP 
>> script. If needed, you reset the current directory before the include.  Is 
>> there an equivalent with web2py?  
>>
>

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


[web2py] Re: Bootstrap is really killing web2py

2016-06-18 Thread Anthony
On Saturday, June 18, 2016 at 8:47:42 AM UTC-4, Dominic Mayers wrote:
>
> I am just starting to learn web2py and I want to better understand the 
> issue.  Is the issue simply that Bootstrap 3 is not backward compatible 
> with v2.x and therefore we cannot use Bootstrap3 with the templates in 
> web2py that have been created with Bootstrap 2 ?
>

Yes, though this is not really an issue because even if you want a custom 
Bootstrap 2 theme, you still cannot simply use the existing front-end 
scaffolding app without making significant modifications. The front-end 
scaffolding application is just intended as a quick and easy starting 
point. If you want a custom layout, you need to implement that, and 
implementing a custom layout is equally easy/difficult regardless of which 
CSS framework you are using.
 

>   The issue seems to be bigger than that because we would need to modify 
> "all parts of web2py that are tightly bound  to bootstrap", but what does 
> this mean?
>

You should read back through this thread, as that statement has been 
debunked. No parts of web2py are tightly bound to Bootstrap, as web2py 
itself predates Bootstrap. The front-end scaffolding application is based 
on Bootstrap 2, and web2py forms and the grid include some convenience 
formatting options for Bootstrap 2 and 3, but you can use all of these 
elements without Bootstrap at all, as they always had been used prior to 
Bootstrap's existence.
 

>   Of course, we expect a coupling between the view and the remainder of 
> the code. The code has to provide data as expected in the view. There is no 
> way this can be avoided, even in a loosely coupled framework. So, is this 
> the only issue? I would like to know if there was a fundamental flaw in the 
> design of web2py?
>

Keep in mind that most server-side web frameworks don't provide a front-end 
scaffolding application nor built-in formatting options for any CSS 
frameworks. web2py happens to provide a bit more than other frameworks in 
this regard. Some of what it provides happens to be based on Bootstrap, but 
you can simply ignore all of that and use whatever CSS framework you want 
-- and at that point, you are no worse off than you would be with one of 
the many other server-side frameworks.

Anthony

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


[web2py] Re: Bootstrap is really killing web2py

2016-06-18 Thread Dominic Mayers
Naively, I am happy with an approach where, when we design a  controller,  
we consider the HTML + CSS + javascript together as one component, a 
template, and we only want to know the interface to this template.  We want 
a clean modular interaction between these templates and the code that 
generates the input that these templates need. We need an abstraction layer 
over the templates, in the same way as we have abstraction layers over 
database engines.  In the case of database engines, the abstraction layer 
translate database queries. In the case of templates, the abstraction layer 
translates a dictionary into the inputs needed by the template framework, 
perhaps a dictionary in another format.  However, the analogy with 
databases is broken. We can view two different database queries for 
different database engines as equivalent, but we cannot view two different 
inputs for two different templates as equivalent, because they are 
fundamentally different in terms of what is presented to human beings.  So, 
I believe that the best we can offer on the controller side is a general 
language to generate dictionaries as input to template, just as web2py 
does. On the abstraction layer side, I am happy if, for each template 
framework, we have a wrapper that accepts dictionaries as input and  a 
documentation of this interface. This is the natural situation in standard 
modular programming. We simply need well documented interfaces. Of course, 
the more we have already used templates that we can adapt, just as in the 
regular web2py philosophy, the better it will be. However, in this 
particular case, I strongly believe that it is also important to have well 
documented interfaces to the templates because in some cases a start from 
scratch approach would be preferable. Anyway, it is also perfectly in tune 
with a teaching view.  

 

On Saturday, 18 June 2016 09:27:41 UTC-4, Massimo Di Pierro wrote:
>
> This is a big can of worms. CSS was created to decouple style info from 
> structural info (HTML). Turns out most CSS today dictate both a class 
> naming convention and an HTML structure. You cannot take an arbitrary piece 
> of HTML and apply an arbitrary CSS. Moreover adding class names is often 
> not sufficient. Every time you change the CSS framework you have to change 
> the HTML. 
>
> This is a problem for all frameworks (like web2py) that generate HTML for 
> you. They must know what CSS framework you use. In web2py we support 
> multiple formstyle(s):
>
>
>table3cols, table2cols, divs, ul, bootstrap (2), bootstrap3_stacked, 
> bootstrap3_inline, inline
>
>
> as you can imagine this is turning into a maintenance nightmare. This is 
> against the original spirit. This is why I believe we need a new approach 
> to this problem and a new library for form generation.
>
>
> Massimo
>
>
> On Saturday, 18 June 2016 07:47:42 UTC-5, Dominic Mayers wrote:
>>
>> I am just starting to learn web2py and I want to better understand the 
>> issue.  Is the issue simply that Bootstrap 3 is not backward compatible 
>> with v2.x and therefore we cannot use Bootstrap3 with the templates in 
>> web2py that have been created with Bootstrap 2 ?  The issue seems to be 
>> bigger than that because we would need to modify "all parts of web2py that 
>> are tightly bound  to bootstrap", but what does this mean?  Of course, we 
>> expect a coupling between the view and the remainder of the code. The code 
>> has to provide data as expected in the view. There is no way this can be 
>> avoided, even in a loosely coupled framework. So, is this the only issue? I 
>> would like to know if there was a fundamental flaw in the design of 
>> web2py?  
>>
>> On Friday, 18 July 2014 15:17:34 UTC-4, Moustafa Mahmoud wrote:
>>>
>>> I have been using web2py for 3 years know, and I was really impressed by 
>>> it, I defended it in every discussion, even implemented all my projects 
>>> using it and even convinced my Graduation Project Team to use it in our GP. 
>>> However, as my skill increased and I began looking more into customizing my 
>>> applications, I have hit a brick wall discovering how tightly bound web2py 
>>> is to bootstrap2, I wanted to use bootstrap 3 but was faced with tons of 
>>> problems. If I want to move to another front end framework then I 
>>> discovered that it would be easier to use another framework because of the 
>>> time and effort I would need to invest in modifying all parts of web2py 
>>> that are tightly bound  to bootstrap.
>>> This will result in making web2py a headache to me rather than my best 
>>> friend. I am writing this message because I am really sad that an amazing 
>>> framework like web2py is forcing me to consider an alternative because I do 
>>> really feel it is constraining me at this point.
>>> Any help or ideas about that ?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

[web2py] Re: How to use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Anthony
It's not clear exactly what you want to make modular, and what elements of 
the system need to be unmodifiable. If you want everything within a given 
application folder inside the /web2py/applications folder to be modifiable 
but need some unmodifiable component to be able to modify the request 
and/or response, you might want to consider WSGI external middleware 
, 
which is the standard means for wrapping a WSGI application.

But depending on your use case, it might also be sufficient to simply 
include a special model file in the app that sets up the configuration on 
each request -- you just have to ensure that the update mechanism doesn't 
allow that file to be overwritten or deleted.

Anthony

On Saturday, June 18, 2016 at 11:11:25 AM UTC-4, Dominic Mayers wrote:
>
> The use case that I have in mind is that I create a wrapper web2py 
> application over another web2py application that will be updated regularly 
> by a third party. I do not want to have to update the wrapper at each  
> update.  The specific use case that I have in mind is that the wrapper 
> application only sets the location of a configuration file and then calls 
> the actual application, which uses this configuration file.  However, never 
> mind this specific use case, because the objective here is very standard 
> and general - it's the usual concept of modularity: the web2py application 
> is like a module that you can update without having to change the wrapper 
> application.   How can we do that in web2py?It's perfectly fine if the 
> web2py "application" is not exactly an application as long as it can be 
> edited as an application and just need to be plugged in a simple wrapper 
> application.  This is very easy to do in PHP: you simply include the PHP 
> script. If needed, you reset the current directory before the include.  Is 
> there an equivalent with web2py?  
>

-- 
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: Help with memory leak

2016-06-18 Thread Anthony

>
> If I download source and run from python 2.7.11, I get a slow memory leak 
> (1.1MB/minute before the server is started, 2.5MB/sec when the server is 
> started).
>

This sounds suspicious. How can web2py be causing a memory leak if you are 
not running it? Are you suggesting that if you merely download the web2py 
source code onto your computer but do absolutely nothing with it, a memory 
leak mysteriously materializes?

Anthony

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


[web2py] How to use a web2py application in a modular way, a way that supports update?

2016-06-18 Thread Dominic Mayers
The use case that I have in mind is that I create a wrapper web2py 
application over another web2py application that will be updated regularly 
by a third party. I do not want to have to update the wrapper at each  
update.  The specific use case that I have in mind is that the wrapper 
application only sets the location of a configuration file and then calls 
the actual application, which uses this configuration file.  However, never 
mind this specific use case, because the objective here is very standard 
and general - it's the usual concept of modularity: the web2py application 
is like a module that you can update without having to change the wrapper 
application.   How can we do that in web2py?

-- 
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: different table for every user

2016-06-18 Thread @brooks
Thanks Massimo.

On Saturday, June 18, 2016 at 6:59:02 PM UTC+5:30, Massimo Di Pierro wrote:
>
> Do not make a new table for each user. Look instead at 
> db.define_table(..., auth.signature) so that each record known who created 
> it, and then you can filter all records by creator using a common filter.
>
> On Saturday, 18 June 2016 07:47:42 UTC-5, @brooks wrote:
>>
>> Hi,
>> I am new to python as well as web2py.I am trying to make an application 
>> where i am thinking of having a different table for every user and store 
>> every user's data in his table.But i do not know how to do it?Moreover,is 
>> it better than just adding a "user" column in one single 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.


[web2py] Best approach to have a configuration file located in a non standard location.

2016-06-18 Thread Dominic Mayers
The use case is that you design a template application that will be 
installed and edited by some businesses that use a work flow from 
development to testing to staging  and finally to production. Most of the 
configuration values are shared in these different stages. These shared 
configuration values are moved together with the application in the work 
flow. In this way, when the business has to write or edit them, it needs to 
do that only once in the entire work flow. The few values that are specific 
to each stage in the workflow are not modified when the code moves in the 
work flow.  In this, way the people at each stage do not have to worry that 
their specific configuration values are erased in the work flow.  To 
support this I use two configuration files, one for the shared values one 
for values that are specific to each stage. However, the main aspect of the 
use case is that we do not want to rely on any standard location for the 
configuration file that is specific to each stage. We do not want to use a 
location relative to the application root, because it makes the move of the 
application more complicated. We do not want to use a fixed location 
outside the application root, because we do not want to assume anything 
regarding the environment where the application is installed.  This means 
that the location of this configuration file has to be specified when the 
application is installed. We cannot specify this location in a 
configuration file, because this creates a cycle: how do we know the 
location of this other configuration file?  We cannot also fix this 
location in the application, as we just explained.  One solution that I 
used with PHP is simply request that the installer at each stage creates a 
wrapper application that sets the location of the configuration file. The 
wrapper application is not moved in the work flow. A request is mapped to 
the wrapper application in the usual way. The wrapper application sets the 
location of the configuration file and then include the application, the 
one that is moved in the work flow.  How can I implement the equivalent 
with web2py?  

-- 
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 on BEAUTIFY with list of tuples

2016-06-18 Thread Massimo Di Pierro
in python dict keys are not sorted. sorted(dict(...)) only gives you a list 
of sorted keys, not a dict with sorted keys. What you want is replace dict 
with collections.OrderedDict

On Saturday, 18 June 2016 07:47:42 UTC-5, DNeuman wrote:
>
> Hi - first time posting here! First let me say thanks to Professor Di 
> Pierro and all the people who have done a great job on Web2Py. I am new to 
> web development, and Python, so I really appreciate all the work you did to 
> make this subject approachable. Now for my question:
>
> I am having some difficulty passing a list of tuples from a controller 
> using  'return locals()'  sometimes it hangs the web2py server.
>
> I have spent a week narrowing this down, and here is what I have; some 
> works, some does not...
>
> If I create a simple list named bob = [(2L, 0.2075327747768832), (16L, 
> 0.19108106970048253), (3L, 0.13288897732583363), (15L, 
> 0.11511204575971237), (12L, 0.10369170755981243), (7L, 0.1033849215142939), 
> (8L, 0.0957849868092478), (5L, 0.05052350890092832)]
>
> then return locals()  I can see this in response._vars  in the debugger 
> and {{=BEAUTIFY(response._vars)}} works fine.  (thats good)
>
>
> However, if I create the same exact list as an output of a sorting 
> operation from a dictionary, it hangs the web2py server when I use return 
> locals() and {{=BEAUTIFY(response._vars)}}   (but only sometimes)
>
>
> Here is what the code is used to generate the sorted list:
>
> def make_list():
> from operator import itemgetter
> #dbg.set_trace() # stop here!
>
> test_dict ={}
>
> test_dict[2L] = 0.773
> test_dict[5L] = 0.003
> test_dict[1L] = 0.31
> test_dict[9L] = 0.0402
> test_dict[12L] = 0.12
> test_dict[7L] = 0.214
>
> test_list = sorted(test_dict.iteritems(), key=itemgetter(1), 
> reverse=True)
>
> return test_list #this should be a list of tuples 
> [(x,y),(w,z)...()]
>
>
> But here is the weird part - if I have this test case standalone, it 
> always works. If I use sorted() in a larger program, it exhibits the hang. 
> Very consistent. standalone test = no problem. larger problem = broken.
>
> More about the server hang:
>
> passing bob through locals() causes a hang, whether BEAUTIFY(bob) or 
> BEAUTIFY(response._vars)as long as bob is generated from the sorted() 
> function. Never hangs when generated from simply creating a list of tuples.
>
>
> passing bob through locals() doesn’t hang unless BEAUTIFY(bob).  So, if I 
> don't use bob in the view, it doesn't hang. There is something about 
> passing this through locals, AND using BEAUTIFY AND creating the list from 
> sorted() AND being in a larger program.
>
>
> making bob from sorted() in a large program = hang:
>
> use return locals() and BEAUTIFY(response._vars)  -- hang
>
> use return locals() and BEAUTIFY(bob)-- hang
>
>
> works:
>
> return locals() and BEAUTIFY(qlist)   
>  -- no hang; qlist is some other variable
>
> return locals() and use view {{=bob[0]   =bob[1]   =bob[2] }}   -- 
> no hang; here I simply don't use BEAUTIFY and it all works
>
> bob created without using sorted() 
>  -- no hang; can do whatever I like and it works.
>
>
>
> So I can only guess that I am using sorted() wrong, or using BEAUTIFY 
> wrong, or there is some very mysterious aspect of the list that is not 
> visible in the debugger which is confusing BEAUTIFY.
>
>
> when I examine response._vars in cases where there is a hang it is 
> identical to cases where there is no hang.
>
>
> details:
>
> Mac OS X El Capitan  10.11.5
>
> Web2py 2.14.2-stable+timestamp.2016.03.24.22.47.49
>
> modules installed: numpy
>
> browser: Safari
>
>
> Much appreciate any pointers here! 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: different table for every user

2016-06-18 Thread Massimo Di Pierro
Do not make a new table for each user. Look instead at db.define_table(..., 
auth.signature) so that each record known who created it, and then you can 
filter all records by creator using a common filter.

On Saturday, 18 June 2016 07:47:42 UTC-5, @brooks wrote:
>
> Hi,
> I am new to python as well as web2py.I am trying to make an application 
> where i am thinking of having a different table for every user and store 
> every user's data in his table.But i do not know how to do it?Moreover,is 
> it better than just adding a "user" column in one single 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.


[web2py] Re: Bootstrap is really killing web2py

2016-06-18 Thread Massimo Di Pierro
This is a big can of worms. CSS was created to decouple style info from 
structural info (HTML). Turns out most CSS today dictate both a class 
naming convention and an HTML structure. You cannot take an arbitrary piece 
of HTML and apply an arbitrary CSS. Moreover adding class names is often 
not sufficient. Every time you change the CSS framework you have to change 
the HTML. 

This is a problem for all frameworks (like web2py) that generate HTML for 
you. They must know what CSS framework you use. In web2py we support 
multiple formstyle(s):


   table3cols, table2cols, divs, ul, bootstrap (2), bootstrap3_stacked, 
bootstrap3_inline, inline


as you can imagine this is turning into a maintenance nightmare. This is 
against the original spirit. This is why I believe we need a new approach 
to this problem and a new library for form generation.


Massimo


On Saturday, 18 June 2016 07:47:42 UTC-5, Dominic Mayers wrote:
>
> I am just starting to learn web2py and I want to better understand the 
> issue.  Is the issue simply that Bootstrap 3 is not backward compatible 
> with v2.x and therefore we cannot use Bootstrap3 with the templates in 
> web2py that have been created with Bootstrap 2 ?  The issue seems to be 
> bigger than that because we would need to modify "all parts of web2py that 
> are tightly bound  to bootstrap", but what does this mean?  Of course, we 
> expect a coupling between the view and the remainder of the code. The code 
> has to provide data as expected in the view. There is no way this can be 
> avoided, even in a loosely coupled framework. So, is this the only issue? I 
> would like to know if there was a fundamental flaw in the design of 
> web2py?  
>
> On Friday, 18 July 2014 15:17:34 UTC-4, Moustafa Mahmoud wrote:
>>
>> I have been using web2py for 3 years know, and I was really impressed by 
>> it, I defended it in every discussion, even implemented all my projects 
>> using it and even convinced my Graduation Project Team to use it in our GP. 
>> However, as my skill increased and I began looking more into customizing my 
>> applications, I have hit a brick wall discovering how tightly bound web2py 
>> is to bootstrap2, I wanted to use bootstrap 3 but was faced with tons of 
>> problems. If I want to move to another front end framework then I 
>> discovered that it would be easier to use another framework because of the 
>> time and effort I would need to invest in modifying all parts of web2py 
>> that are tightly bound  to bootstrap.
>> This will result in making web2py a headache to me rather than my best 
>> friend. I am writing this message because I am really sad that an amazing 
>> framework like web2py is forcing me to consider an alternative because I do 
>> really feel it is constraining me at this point.
>> Any help or ideas about that ?
>>
>

-- 
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: rss and unicode

2016-06-18 Thread Sepehr Mohamadi
2.14.6-stable+timestamp.2016.05.10.00.21.47
(Running on Rocket 1.2.6, Python 2.7.5)



On Saturday, June 18, 2016 at 5:50:44 PM UTC+4:30, Massimo Di Pierro wrote:
>
> strange. I do not get any error after adding the u"...". What python 
> version?
>
> On Saturday, 18 June 2016 07:46:50 UTC-5, Sepehr Mohamadi wrote:
>>
>> I have tried every thin including that!
>>
>> This:
>>
>> description = u"Some unicode here آزمایش زبان فارسی"
>>
>>
>> Generates this error:
>>
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 18: 
>> ordinal 
>>> not in range(128)
>>>
>>
>>
>> On Saturday, June 18, 2016 at 4:38:29 PM UTC+4:30, Kiran Subbaraman wrote:
>>>
>>> Try this - basically mark the content as a unicode string.
>>>
>>> description = u"Some unicode here آزمایش زبان فارسی"
>>>
>>> 
>>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>>
>>> On Sat, 18-06-2016 1:44 PM, Sepehr Mohamadi wrote:
>>>
>>> Exactly like this:
>>>
>>> Some unicode here   
>>> ??
>>>
>>>
>>>
>>>
>>> On Saturday, June 18, 2016 at 12:28:48 PM UTC+4:30, Sepehr Mohamadi 
>>> wrote: 

 Hey Guys, 

 I have problem using utf-8 codes in rss.

 As mentioned in doc:

 def feed():
> return dict(title="my feed",
> link="http://feed.example.com;,
> description="my first feed",
> entries=[dict(title="my feed",
>   link="http://feed.example.com;,
>   description="Some unicode here آزمایش زبان 
> فارسی")
>  ])
>
> When I use unicode in description I receive this in rss: 
>
>  

  
 What's wrong!
 Please guide

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

-- 
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: rss and unicode

2016-06-18 Thread Massimo Di Pierro
strange. I do not get any error after adding the u"...". What python 
version?

On Saturday, 18 June 2016 07:46:50 UTC-5, Sepehr Mohamadi wrote:
>
> I have tried every thin including that!
>
> This:
>
> description = u"Some unicode here آزمایش زبان فارسی"
>
>
> Generates this error:
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 18: 
> ordinal 
>> not in range(128)
>>
>
>
> On Saturday, June 18, 2016 at 4:38:29 PM UTC+4:30, Kiran Subbaraman wrote:
>>
>> Try this - basically mark the content as a unicode string.
>>
>> description = u"Some unicode here آزمایش زبان فارسی"
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Sat, 18-06-2016 1:44 PM, Sepehr Mohamadi wrote:
>>
>> Exactly like this:
>>
>> Some unicode here   ??
>>
>>
>>
>>
>> On Saturday, June 18, 2016 at 12:28:48 PM UTC+4:30, Sepehr Mohamadi 
>> wrote: 
>>>
>>> Hey Guys, 
>>>
>>> I have problem using utf-8 codes in rss.
>>>
>>> As mentioned in doc:
>>>
>>> def feed():
 return dict(title="my feed",
 link="http://feed.example.com;,
 description="my first feed",
 entries=[dict(title="my feed",
   link="http://feed.example.com;,
   description="Some unicode here آزمایش زبان 
 فارسی")
  ])

 When I use unicode in description I receive this in rss: 

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

-- 
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: Extract Models from MS SQL Server

2016-06-18 Thread Massimo Di Pierro
Nice. In trunk!

On Thursday, 16 June 2016 16:54:20 UTC-5, Kyle Flanagan wrote:
>
> I needed the ability to extract a DAL model from SQL Server. I based the 
> script below on extract_pgsql_models by Mariano Reingart, based in turn on 
> a script to "generate schemas from dbs" (mysql) by Alexandre Andrade. I'm 
> posting it here in hopes that it will be useful for others.
>
> Tested on Windows 7 on a SQL Server 2012 database. Make sure to replace 
> "mssql4://..." with the appropriate connection string if using a legacy SQL 
> Server database. You might also need to modify the pyodbc.connect 
> connection string driver to match a driver on your local PC.
>
> """Create web2py model (python code) to represent MS SQL Server tables.
> Features:
> * Uses ANSI Standard INFORMATION_SCHEMA (might work with other RDBMS)
> * Detects legacy "keyed" tables (not having an "id" PK)
> * Handles 'funny' column names. web2py requires all column names be valid 
> python identifiers. This script uses rname
> *   for column names that have spaces or are otherwise invalid python 
> identifiers.
> * Connects directly to running databases, no need to do a SQL dump
> * Handles notnull, unique and referential constraints
> * Detects most common datatypes and default values
> * Supports running from the command line as well as from an IDE's debug menu. 
> See the COMMAND_LINE_MODE constant below
> *   for more info.
>
> Requirements:
> * Needs pyodbc python connector
>
> Created by Kyle Flanagan. Based on a script by Mariano Reingart which was
> based on a script to "generate schemas from dbs" (mysql) by Alexandre Andrade
> """
>
> _author__ = "Kyle Flanagan "
>
> HELP = """
> USAGE: extract_mssql_models db host port user passwd
> Call with SQL Server database connection parameters,
> web2py model will be printed on standard output.
> EXAMPLE: python extract_mssql_models.py mydb localhost 3306 kflanaga pass
> or
> python extract_mssql_models.py mydb localhost 3306 kflanaga pass > db_model.py
> """
>
> # Config options
> DEBUG = False  # print debug messages to STDERR
> SCHEMA = 'dbo'
> COMMAND_LINE_MODE = True  # running from command prompt. Disable to specify 
> variables and use in IDE
> DB = None
> HOST = None
> USER = None
> PASSWD = None
> PORT = None
>
> # Constant for Field keyword parameter order (and filter):
> KWARGS = ('type', 'length', 'default', 'required', 'ondelete',
>   'notnull', 'unique', 'label', 'comment', 'rname')
>
> import sys
> import re
> # This is from pydal/helpers/regex.py as of 2016-06-16
> # Use this to recognize if a field name need to have an rname representation
> REGEX_VALID_TB_FLD = re.compile(r'^[^\d_][_0-9a-zA-Z]*\Z')
> # For replacing invalid characters in field names
> INVALID_CHARS = re.compile(r'[^a-zA-Z0-9_]')
>
>
> def get_valid_column_name(field):
> """Return a valid column name that follows Python's rules for 
> identifiers, which is what web2py requires for column
> names. Replaces invalid characters with underscores and leading digits 
> with their associated English word."""
> if not REGEX_VALID_TB_FLD.match(field):
> # If the first character is a digit, replace it with its word 
> counterpart
> if re.match(r'^[0-9]', field):
> numbers = ['Zero', 'One', 'Two', 'Three', 'Four',
>'Five', 'Six', 'Seven', 'Eight', 'Nine']
> field = numbers[int(field[0])] + field[1:]
>
> field = INVALID_CHARS.sub('_', field)
> return field
>
>
> def query(conn, sql, *args):
> "Execute a SQL query and return rows as a list of dicts"
> cur = conn.cursor()
> ret = []
> try:
> if DEBUG: print >> sys.stderr, "QUERY: ", sql % args
> cur.execute(sql % args)
> for row in cur:
> dic = {}
> for i, value in enumerate(row):
> field = cur.description[i][0]
> dic[field] = value
> if DEBUG: print >> sys.stderr, "RET: ", dic
> ret.append(dic)
> return ret
> finally:
> cur.close()
>
>
> def get_tables(conn, schema=SCHEMA):
> "List table names in a given schema"
> rows = query(conn, """SELECT table_name FROM information_schema.tables
> WHERE table_schema = '%s'
> ORDER BY table_name""", schema)
> return [row['table_name'] for row in rows]
>
>
> def get_fields(conn, table):
> "Retrieve field list for a given table"
> if DEBUG: print >> sys.stderr, "Processing TABLE", table
> rows = query(conn, """
> SELECT column_name, data_type,
> is_nullable,
> character_maximum_length,
> numeric_precision, numeric_precision_radix, numeric_scale,
> column_default
> FROM information_schema.columns
> WHERE table_name='%s'
> ORDER BY ordinal_position""", table)
> return rows
>
>
> def define_field(conn, table, field, pks):
> "Determine field type, default 

[web2py] Re: Pulling hair out on REST Example

2016-06-18 Thread Massimo Di Pierro
as pbreit suggests the problem is that you return a dict or None, instead 
you want to return json. Here is another option:

@request.restful()
def testRESTGET():
def GET():
id =1359
account = db.account(id)
return account.as_json() if account else '{}'
return locals()


On Thursday, 16 June 2016 04:26:01 UTC-5, pbreit wrote:
>
> How about trying some code more like in the book:
>
> @request.restful()
> def api():
> response.view = 'generic.json'
> def GET():
> return dict(account = db.account(1359))
> return locals()
>
> Then just hit http://localhost:8000/myapp/default/api in your browser
>
>

-- 
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: XML(sanitize=True) and incorrect HTML

2016-06-18 Thread Massimo Di Pierro
thanks for reporting this.

On Wednesday, 15 June 2016 02:29:53 UTC-5, Kirill Shatalaev wrote:
>
> Opened #1363
>
> вторник, 14 июня 2016 г., 22:25:05 UTC+4 пользователь Anthony написал:
>>
>>
>> Feel free to file a Github issue.
>>
>> Anthony
>>
>>

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


[web2py] Re: jquery-pjax

2016-06-18 Thread Massimo Di Pierro
Nice library.  It is a lot like web2py components but better. Perhaps 
web3py should use pjax.js

On Tuesday, 14 June 2016 09:48:44 UTC-5, Niphlod wrote:
>
> great, simple, done.
>
> On Tuesday, June 14, 2016 at 2:34:22 PM UTC+2, Carlos Cesar Caballero 
> wrote:
>>
>> Hi everyone, have you any experience with 
>> https://github.com/defunkt/jquery-pjax and web2py? it looks really 
>> interesting. 
>>
>> Greetings. 
>>
>> -- 
>> Este mensaje le ha llegado mediante el servicio de correo electronico que 
>> ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
>> Nacional de Salud. La persona que envia este correo asume el compromiso de 
>> usar el servicio a tales fines y cumplir con las regulaciones establecidas 
>>
>> Infomed: http://www.sld.cu/ 
>>
>>

-- 
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 increase the number of open forms that can be submitted (from 10) ?

2016-06-18 Thread Massimo Di Pierro
As suggested it is critical that multiple forms on the same name have 
different formname(s) and this is true even if the forms are LOADed because 
of the CSRF protection mechanism. Anyway, this one one case where you are 
looking for the wrong solution to the problem. You should use JS to 
generate those forms and submit them via ajax to different controller.

On Friday, 10 June 2016 16:54:51 UTC-5, Robert Pates wrote:
>
> Well, Thanks Anthony and Leonel for excellent suggestions --
> The issue went away when I ensure that each of the 16 forms generated had 
> a unique formname value.
> However, I spent some time trying to combine this with Leonel's suggestion 
> to use ajax (with LOAD= ?).  But didn't manage to figure that out in a 
> reasonable amount of time.  If either of you could point me to the best 
> (mdipierro) web2py example appliance(s) to study to be able to examine a 
> complete application I'd be (even more) grateful --
>
>
> On Thursday, April 28, 2016 at 11:56:59 AM UTC-4, Anthony wrote:
>>
>> On Thursday, April 28, 2016 at 11:44:34 AM UTC-4, Leonel Câmara wrote:
>>>
>>> I would probably change the way the application works. There is 
>>> absolutely no need for you to have all the 16 forms in the HTML at the same 
>>> time and then try to process each one in the controller to see which was 
>>> submitted. Just load the form you need when you need it using ajax. 
>>>
>>
>> Note, if it's multiple copies of the same form, each form will still need 
>> a unique name in order to generate unique formkeys in the session.
>>
>> Anthony
>>
>

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


[web2py] Re: Save Full Calendar event to Mysql

2016-06-18 Thread Massimo Di Pierro
try use the chrome javascript console to see the post body from fullcalendar

On Wednesday, 8 June 2016 14:34:41 UTC-5, Jeff Riley wrote:
>
> Hello all.  Has anyone figured out how to save a Jquery Full Calendar 
> event to their Mysql database?  I know I should use the Ajax function, but 
> I am not seeing how to get the information from the Full Calendar jquery 
> event dialog.
>

-- 
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: Jquery UI Datepicker

2016-06-18 Thread Massimo Di Pierro
You will have to replace the datepicker or write your own css instead of 
the one in calendar.css

On Tuesday, 7 June 2016 21:53:04 UTC-5, Winter Kryz wrote:
>
> Hello everybody,
>
> I'm trying to change the appearance of the default datepicker on a form 
> and I want to choose a theme from Jquery UI
>
> 
> I just want to display the datepicker, I downloaded the theme, and 
> uploaded:
> -static/css/jquery_ui.theme.min.css 
> 
> -static/css/ 
> 
>  
> jquery_ui.min.css 
> 
> -static/js/jquery_ui.min.js 
> 
>
> Now, I don't know how to implement just the datepicker. Can someone help 
> me? I'm newbie on web2py and I'd like a step-by-step.
>
> Thank you :)
>

-- 
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: Field.Virtual does not show up in db.table.fields

2016-06-18 Thread klimvv71
Hello! I see this is old topic by it actual to me. I'd like to use virtual 
field in your plugin_haystack but it doesn't appear neither in fields list 
nor in virtualfields list. 

could you please suggest any solution to the problem?

-- 
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] Any more elegant way to redirect to user login when updating a div by ajax callback if not auth.user

2016-06-18 Thread Paco Bernal
Hi all,

This is my first question here, although I use it sometimes to read a few 
questions that I make to myself when coding using this cool and great tool. 
Thanks.

A few months ago I started to use ajax to fill middle column of screen from 
clicks (interaction with the user) in the left sidebar and sometimes to 
show right side bar with more info when interacting with middel column. 
Maybe looking for ways to opotimaze data flow in the network and from the 
server, and for learning.

Something like this:

ajax('{{=URL('get_index', vars=dict(filters=''))}}' + filters_post, [], 
'div_target');

But when the user lose his session (you can delete cookies for example) 
because of ajax to fill a div, nothing happens when the user clicks on the 
left side bar, no error and no redirect to user login even with 
@auth.requires_membership('roll') in defs inside the controller.

So, the only way I found is to add these lines at the beginning of the 
controller :

#--
if not auth.user and not session.not_auth:
session.not_auth = True
redirect (URL('not_auth'))
#--
def not_auth():
session.not_auth = None
return dict()
#--

and the view, no_auth.html:

{{include 'web2py_ajax.html'}}

$( document ).ready(function() {
$(location).attr('href', '{{=URL('user','login')}}');
});


The question is, is there any other more elegant way (or not) to do the 
same?

Thanks 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] Execute Python code when pressing a button

2016-06-18 Thread John Doe
Hello, i am trying to remotely turn ON/OFF a LED that is connected to a 
RaspberryPi.
I have installed Web2Py on my PC (that is running Ubuntu). Additionaly i 
have installed Paramiko for my SSH conection.

I've put this code in a Controller called led.py:

import paramiko
def leds_set(state):
  ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh.connect('192.168.2.100', username='myuser', password='mypassword')
  if state:
state = 'on'
  else:
state = 'off'
  stdin, stdout, stderr = ssh.exec_command('python /home/pi/led.py ' + state)
  print(stdin, stdout, stderr)
  return dict()




I replaced index.html with this. It does not work.

{{extend 'layout.html'}}








The last piece of code (led.py) that is on my Raspberry Pi is for testing 
purposes (i know that is completely broken, but i only need to know if it 
works by turning the LED ON).

import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(11, GPIO.OUT)

state = sys.argv[1]

if state =='on':
print('Led ON')
GPIO.output(11,True)
time.sleep(2)
GPIO.output(11,False)
time.sleep(2)
GPIO.cleanup()


So, i think that the problem is the HTML part because i got this error (in 
console): 

Uncaught ReferenceError: leds_set is not defined.

What can i do so i could run led.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] How to return variable from controller function to view

2016-06-18 Thread Marko Brozović

Hello, 
I have a problem that can be simplified to this:

in controller:
def index():
imgSrc = 'bla'
...

def someFunction():
imgSrc += 'bla'
return imgSrc


in view:
...

$(function() {
setInterval(function() {
$.ajax("{{=URL('default', 'somefunction')}}");
$('#someid').attr('src', '{{=imgSrc}}');
}, 1000);
});

...

So, an idea is to call  someFunction() in time intervals and get new 
variable that can be used later in this script tag. For this purpose I am 
using $.ajax() to call  someFunction() and when it is executed I can for 
example print new value of imgSrc variable in shell. However imgSrc in the 
view is the same old imgSrc that was defined by index function when page 
was first loaded.
Please help.
Marko.

-- 
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] CSS styling error_message form validation fields

2016-06-18 Thread Auden RovelleQuartz
The *error_message *parameter allows customization of the failure text for 
a form field entry validation process.

For example: IS_NOT_EMPTY(error_message='cannot be empty')

If I want to apply CSS styling to the text area that the error message 
appears in, how do I do that?



-- 
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: run time error - auth_user.table appears corrupted

2016-06-18 Thread DNeuman
I thought I had the same problem, so followed the advice - I have done 
this, and now get the error: 

OperationalError: table auth_user already exists

This came about after Web2py ate all my memory and crashed overnight...so I am 
not really sure what is happening here. Any further suggestions? Also, I 
looked, and found that the file

c8b66..._auth_user.table does not exist. So I don't really thing the user table 
already exists. Any thoughts what remains broken? What to try next? Thanks.



On Thursday, July 2, 2015 at 12:09:12 PM UTC-7, Niphlod wrote:
>
> stop web2py, drop the databases/*_auth_user.table file, set 
> fake_migrate_all=True on the DAL connection, start web2py, hit the appadmin 
> page (which should trigger recreation of all *.table files), remove 
> fake_migrate_all statement from the DAL connection.
>
> On Wednesday, July 1, 2015 at 4:01:20 PM UTC+2, reddyreddy wrote:
>>
>> Can anyone help me?
>>
>> Iam getting runtime error auth_user.table appears corrupted.
>> Iam not sure why it is appearing. Here are my not tables.
>>
>>
>> db = DAL("sqlite://storage.sqlite")
>> from gluon.tools import Auth
>> auth = Auth(db)
>> auth.define_tables(username=True)
>> db.define_table('problem',
>> Field('title', unique=True),
>> Field('body', 'text'),
>> Field('file','upload'),
>> Field('ori_file',readable=False, writable=False),
>> Field('outputfile','upload'),
>> Field('created_on', 'date', default=request.now, readable=False, 
>> writable=False),
>> Field('Due date','date'),
>> Field('status', readable=False, writable=False))
>>
>>
>> db.define_table('submission', 
>> Field('name', requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()]), 
>> Field('email', requires=[IS_NOT_EMPTY(), IS_EMAIL()]),
>> Field('file','upload', requires=IS_NOT_EMPTY()),
>> Field('status', readable=False,writable=False),
>> Field('posted_on', 'date', default=request.now, readable=False, 
>> writable=False),
>> Field('problem_id','reference problem',readable=False, writable=False))
>>
>>

-- 
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] passing arguments from view to a controller function

2016-06-18 Thread @brooks
Hi
I am trying to make an online calendar.Now,to add an event to a particular 
date I m doing the following:
-the user clicks on a date and an event window pops up and the event 
inserted is then added to the database.
-so,when the user clicks the (date) element ,the "event" window has to 
pop up which contains an SQLFORM for the event field and date field which 
has to be prepopulated.i am able to pass the date to the "event" window 
using javascript.but i am not able to access arguments(i.e. date) ,in fact 
nothing is being displayed in the "event" window(i tried printing just 
"hello".but even that is not working).please help

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


[web2py] Overriding a button callback function in SQLFORM grid

2016-06-18 Thread Natalie Cluck
How do I override what the View button does when clicked in SQLFORM.grid? 
This is what I have:

def Grid_Home():
grid = SQLFORM.grid(db.somedatabase,csv=False,user_signature=False,
editable=False, create=False)
return dict(grid=grid)

def displayContents():
# new page when View button is clicked

I want to create a new grid on the displayContents page that uses my 
existing databases to display contents of a item listed in the "home grid."

-- 
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] different table for every user

2016-06-18 Thread @brooks
Hi,
I am new to python as well as web2py.I am trying to make an application 
where i am thinking of having a different table for every user and store 
every user's data in his table.But i do not know how to do it?Moreover,is 
it better than just adding a "user" column in one single 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.


[web2py] Re: [solved] Weird 'Row' object has no attribute 'id' and Ñ error

2016-06-18 Thread Abhijeet Deshani
'Row' object has no attribute 'id' can solve by using for loop for your 
entries,mine was solved by that.

-- 
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] Need a sample application

2016-06-18 Thread Sriram Bhamidipati
Hi
I am a newbie to web frameworks and finding myself frequently lost in 
getting what I want to achieve.
I am using a sample application which I d/l'ed from github but still not 
able to figure out routing and static content of a frame etc
 Here is my requierement:

A web interface to work with a couple of tables (preferably using 
PostgreSQL or MySQL) and a workflow with a state machine to interact with 
some network devices and a scheduler.
The Web interface will look at the inventory (DB table) to pick and start a 
work flow using a scheduler.
It is certainly not a unique requirement and hence I need some readily 
available open source web2py (or other?) code 
Do I need any ansible kind of orchestration engines (for workflow) which 
need to be integrated ? Or does web2py support the work flows?

The users of the system will be role based and need to be LDAP 
authenticated. The work flow will be role-based and multi-role enabled. 
That is, a state can only be modified by a specific role.

thanks for your help.
-Sriram
PS: If someone cares to help (1-1), here is my email: sriramb12ATgmailDOTcom

-- 
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] Help with memory leak

2016-06-18 Thread DNeuman
I'm having trouble running Web2py on Mac OS X 10.11.5  El Capitan - the 
memory consumed by Web2Py just keeps growing. Left overnight it crashes my 
application, corrupts my tables, and creates an unrecoverable mess.

I have uninstalled, and loaded a new download. This didn't work. Running 
from a new download Mac binary with nothing running but the server shows 
memory leak at a very consistent 3.4MB/minute.

No applications running - just download, and start the server.

If I download source and run from python 2.7.11, I get a slow memory leak 
(1.1MB/minute before the server is started, 2.5MB/sec when the server is 
started). Note: I am not running anything. No applications, no code of my 
own, nothing but the server. How can I fix this? Has anyone else 
experienced this? I suspect OS X, so I ran just python, with no program at 
all, and this is stable, with no memory leak.

Any hints what I can do next to try to fix this?

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: Bootstrap is really killing web2py

2016-06-18 Thread Dominic Mayers
I am just starting to learn web2py and I want to better understand the 
issue.  Is the issue simply that Bootstrap 3 is not backward compatible 
with v2.x and therefore we cannot use Bootstrap3 with the templates in 
web2py that have been created with Bootstrap 2 ?  The issue seems to be 
bigger than that because we would need to modify "all parts of web2py that 
are tightly bound  to bootstrap", but what does this mean?  Of course, we 
expect a coupling between the view and the remainder of the code. The code 
has to provide data as expected in the view. There is no way this can be 
avoided, even in a loosely coupled framework. So, is this the only issue? I 
would like to know if there was a fundamental flaw in the design of 
web2py?  

On Friday, 18 July 2014 15:17:34 UTC-4, Moustafa Mahmoud wrote:
>
> I have been using web2py for 3 years know, and I was really impressed by 
> it, I defended it in every discussion, even implemented all my projects 
> using it and even convinced my Graduation Project Team to use it in our GP. 
> However, as my skill increased and I began looking more into customizing my 
> applications, I have hit a brick wall discovering how tightly bound web2py 
> is to bootstrap2, I wanted to use bootstrap 3 but was faced with tons of 
> problems. If I want to move to another front end framework then I 
> discovered that it would be easier to use another framework because of the 
> time and effort I would need to invest in modifying all parts of web2py 
> that are tightly bound  to bootstrap.
> This will result in making web2py a headache to me rather than my best 
> friend. I am writing this message because I am really sad that an amazing 
> framework like web2py is forcing me to consider an alternative because I do 
> really feel it is constraining me at this point.
> Any help or ideas about that ?
>

-- 
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] Question on BEAUTIFY with list of tuples

2016-06-18 Thread DNeuman
Hi - first time posting here! First let me say thanks to Professor Di 
Pierro and all the people who have done a great job on Web2Py. I am new to 
web development, and Python, so I really appreciate all the work you did to 
make this subject approachable. Now for my question:

I am having some difficulty passing a list of tuples from a controller 
using  'return locals()'  sometimes it hangs the web2py server.

I have spent a week narrowing this down, and here is what I have; some 
works, some does not...

If I create a simple list named bob = [(2L, 0.2075327747768832), (16L, 
0.19108106970048253), (3L, 0.13288897732583363), (15L, 
0.11511204575971237), (12L, 0.10369170755981243), (7L, 0.1033849215142939), 
(8L, 0.0957849868092478), (5L, 0.05052350890092832)]

then return locals()  I can see this in response._vars  in the debugger and 
{{=BEAUTIFY(response._vars)}} works fine.  (thats good)


However, if I create the same exact list as an output of a sorting 
operation from a dictionary, it hangs the web2py server when I use return 
locals() and {{=BEAUTIFY(response._vars)}}   (but only sometimes)


Here is what the code is used to generate the sorted list:

def make_list():
from operator import itemgetter
#dbg.set_trace() # stop here!

test_dict ={}

test_dict[2L] = 0.773
test_dict[5L] = 0.003
test_dict[1L] = 0.31
test_dict[9L] = 0.0402
test_dict[12L] = 0.12
test_dict[7L] = 0.214

test_list = sorted(test_dict.iteritems(), key=itemgetter(1), 
reverse=True)

return test_list #this should be a list of tuples 
[(x,y),(w,z)...()]


But here is the weird part - if I have this test case standalone, it always 
works. If I use sorted() in a larger program, it exhibits the hang. Very 
consistent. standalone test = no problem. larger problem = broken.

More about the server hang:

passing bob through locals() causes a hang, whether BEAUTIFY(bob) or 
BEAUTIFY(response._vars)as long as bob is generated from the sorted() 
function. Never hangs when generated from simply creating a list of tuples.


passing bob through locals() doesn’t hang unless BEAUTIFY(bob).  So, if I 
don't use bob in the view, it doesn't hang. There is something about 
passing this through locals, AND using BEAUTIFY AND creating the list from 
sorted() AND being in a larger program.


making bob from sorted() in a large program = hang:

use return locals() and BEAUTIFY(response._vars)  -- hang

use return locals() and BEAUTIFY(bob)-- hang


works:

return locals() and BEAUTIFY(qlist) 
   -- no hang; qlist is some other variable

return locals() and use view {{=bob[0]   =bob[1]   =bob[2] }}   -- 
no hang; here I simply don't use BEAUTIFY and it all works

bob created without using sorted() 
 -- no hang; can do whatever I like and it works.



So I can only guess that I am using sorted() wrong, or using BEAUTIFY 
wrong, or there is some very mysterious aspect of the list that is not 
visible in the debugger which is confusing BEAUTIFY.


when I examine response._vars in cases where there is a hang it is 
identical to cases where there is no hang.


details:

Mac OS X El Capitan  10.11.5

Web2py 2.14.2-stable+timestamp.2016.03.24.22.47.49

modules installed: numpy

browser: Safari


Much appreciate any pointers here! 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] Immediate Need : Java Architect who can create New Framework

2016-06-18 Thread Best Recruiter
Greetings!


Please have a look at the below JD and send suitable resumes



*Java Architect *

*PHEONIX** , **ARIZONA *

*Long Term Contract*



JAVA ARCHITECT WHO CAN CREATE NEW FRAMEWORK AND HANDS ON CODING DEVELOPMENT






*Thanks Mike* *m...@eliteisinc.com *

-- 
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] solution for reuse code in modules directory for different application

2016-06-18 Thread 刘志军
Hello web2pyer,

I have a big project that I divided it into several applications based on 
the user roles.
Most of the code was written follow the model-less pattern that lots of 
source file under modules directory.
the problem is some of the source files need to be used in different 
applications, so I have to copy the file across the applications, but it 
could not be synced when one of them was edited or changed.
Does someone can suggest some advice on how to share the source files under 
modules directory?

BTW: currently I am using git sub-module to manage all the modules in three 
applications, but I won't like to share ALL the modules in each of the 
application.

Thank you!

Zhijun

Best,
Regards

-- 
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: rss and unicode

2016-06-18 Thread Sepehr Mohamadi
I have tried every thin including that!

This:

description = u"Some unicode here آزمایش زبان فارسی"


Generates this error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 18: 
ordinal 
> not in range(128)
>


On Saturday, June 18, 2016 at 4:38:29 PM UTC+4:30, Kiran Subbaraman wrote:
>
> Try this - basically mark the content as a unicode string.
>
> description = u"Some unicode here آزمایش زبان فارسی"
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Sat, 18-06-2016 1:44 PM, Sepehr Mohamadi wrote:
>
> Exactly like this:
>
> Some unicode here   ??
>
>
>
>
> On Saturday, June 18, 2016 at 12:28:48 PM UTC+4:30, Sepehr Mohamadi wrote: 
>>
>> Hey Guys, 
>>
>> I have problem using utf-8 codes in rss.
>>
>> As mentioned in doc:
>>
>> def feed():
>>> return dict(title="my feed",
>>> link="http://feed.example.com;,
>>> description="my first feed",
>>> entries=[dict(title="my feed",
>>>   link="http://feed.example.com;,
>>>   description="Some unicode here آزمایش زبان 
>>> فارسی")
>>>  ])
>>>
>>> When I use unicode in description I receive this in rss: 
>>>
>>>  
>>
>>  
>> What's wrong!
>> Please guide
>>
> -- Resources: - http://web2py.com - http://web2py.com/book 
> (Documentation) - http://github.com/web2py/web2py (Source code) - 
> https://code.google.com/p/web2py/issues/list (Report Issues) --- You 
> received this message because you are subscribed to the Google Groups 
> "web2py-users" group. To unsubscribe from this group and stop receiving 
> emails from it, send an email to web2py+un...@googlegroups.com 
> . For more options, visit https://groups.google.com/d/optout. 
>
>
>

-- 
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: rss and unicode

2016-06-18 Thread Kiran Subbaraman

Try this - basically mark the content as a unicode string.

description=u"Some unicode here آزمایش زبان فارسی"


Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Sat, 18-06-2016 1:44 PM, Sepehr Mohamadi wrote:

Exactly like this:

Some unicode here   ??



On Saturday, June 18, 2016 at 12:28:48 PM UTC+4:30, Sepehr Mohamadi 
wrote:


Hey Guys,

I have problem using utf-8 codes in rss.

As mentioned in doc:

def  feed():
 return  dict(title="my feed",
 link="http://feed.example.com;,
 description="my first feed",
 entries=[dict(title="my feed",
   link="http://feed.example.com;,
   description="Some unicode here آزمایش زبان 
فارسی")
  ])

When I use unicode in description I receive this in rss:



What's wrong!
Please guide

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


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: rss and unicode

2016-06-18 Thread Sepehr Mohamadi
Exactly like this:

Some unicode here   ??




On Saturday, June 18, 2016 at 12:28:48 PM UTC+4:30, Sepehr Mohamadi wrote:
>
> Hey Guys,
>
> I have problem using utf-8 codes in rss.
>
> As mentioned in doc:
>
> def feed():
>> return dict(title="my feed",
>> link="http://feed.example.com;,
>> description="my first feed",
>> entries=[dict(title="my feed",
>>   link="http://feed.example.com;,
>>   description="Some unicode here آزمایش زبان 
>> فارسی")
>>  ])
>>
>>
>
> When I use unicode in description I receive this in rss:
>
>  
>
>  
> What's wrong!
> Please guide
>

-- 
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] rss and unicode

2016-06-18 Thread Sepehr Mohamadi
Hey Guys,

I have problem using utf-8 codes in rss.

As mentioned in doc:

def feed():
> return dict(title="my feed",
> link="http://feed.example.com;,
> description="my first feed",
> entries=[dict(title="my feed",
>   link="http://feed.example.com;,
>   description="Some unicode here آزمایش زبان 
> فارسی")
>  ])
>
>

When I use unicode in description I receive this in rss:

 

 
What's wrong!
Please guide

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