[web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
I am checking for existence of record in a table

cond = db.mytable(id=someid)
if not cond :
  do something

This works fine. The query executed selects *all* columns and adds LIMIT 1 
OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check for 
existence of a record, how can I rewrite this so that we have only the id 
column selected? I am trying to avoid a table scan and have just an index 
scan.

-- 
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/groups/opt_out.


[web2py] Re: running scheduler under a user

2014-01-22 Thread Jayadevan M
Sorry about that. I think the right approach was to have the python stubs 
to invoke scheduled jobs, under  models directory and the modules with 
python functions, under modules directory. That way I need not worry about 
a normal portal user attempting to invoke the scheduler jobs.
On Tuesday, January 21, 2014 9:33:55 PM UTC+5:30, Niphlod wrote:
>
> the wording is a little bit incorrect. 
>
> You may prevent users queuing tasks, and that's pretty much all about what 
> can you do with auth.has_membership.
>
> """
> python files being executed by other users
> """
> seems to point to the security of the server itself, that web2py can't 
> really manage.
>
> Can you be clearer ?
>
> On Tuesday, January 21, 2014 10:22:04 AM UTC+1, Jayadevan M wrote:
>>
>> I wanted to set up the scheduler and execute a few jobs. To prevent the 
>> python files being executed by other users, I have added a condition 
>> auth.has_membership('scheduler') in the functions. How can I make the 
>> scheduler start with a user who in in the scheduler group? Or I am going 
>> down the wrong path?
>>
>

-- 
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/groups/opt_out.


[web2py] Apache with mod_wsgi secure/insecure sessions

2014-01-22 Thread Colin Lee
I have set up apache to host the same applications via http and https. When 
I log on as a user with one protocol, I must always log on with that 
protocol or I get the following error:

Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 
> 2.7.3: /usr/bin/python (prefix: /usr)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/main.py", line 479, in wsgibase
> session._try_store_in_cookie_or_file(request, response)
>   File "/home/www-data/web2py/gluon/globals.py", line 1089, in 
> _try_store_in_cookie_or_file
> return self._try_store_in_file(request, response)
>   File "/home/www-data/web2py/gluon/globals.py", line 1096, in 
> _try_store_in_file
> or self._unchanged(response)):
>   File "/home/www-data/web2py/gluon/globals.py", line 1041, in _unchanged
> session_pickled = cPickle.dumps(self)
>   File "/usr/lib/python2.7/copy_reg.py", line 84, in _reduce_ex
> dict = getstate()
> TypeError: 'NoneType' object is not callable
>
> Error snapshot [image: help]
>
>   
> 'exceptions.TypeError'>('NoneType' object is not callable)


If I log out of the application via the browser and restart apache on the 
server, I can then log in using either protocol, but again, once I've 
logged in with http or https, all future logins must be done on that 
protocol. It's not the end of the world, it's just kind of irritating and 
I'm curious about it. Anyone have any thoughts?

Thanks,
Colin

-- 
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/groups/opt_out.


[web2py] pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
Hi,

When navigating to the Edit -> Graph Model on any web2py app, I get the 
error "pygraphviz library not found".
I have installed Graphviz (http://www.graphviz.org/Download_windows.php) 
and PyGraphviz (http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygraphviz) 
successfully but web2py doesn't seem to pick up on that and still returns 
the error above. 

I uninstalled PyGraphviz and tried to install it using the steps detailed 
here (https://groups.google.com/forum/#!topic/networkx-discuss/Xy1lWfMdB6U) 
and here 
(http://blog.ropardo.ro/2011/11/28/installing-pygraphviz-on-windows/) but 
none of the two attempts were successful - couldn't actually compile 
pygraphviz.

System: Windows 8
web2py: 2.8.2

Any help is greatly appreciated. 

Thanks,
Bogdan

-- 
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/groups/opt_out.


[web2py] WebAuth remote_user cookie based authentication

2014-01-22 Thread Kamil
I'm developing a site for my intranet, which already has an established 
authentication method, WebAuth.  I would like to continue using this method 
as only one login would be required to visit multiple sites on the intranet.

I would like to redirect the user to a website (say 
http://intranet/cgi-bin/auth?redirect=myweb2pysite ) which displays a form 
for login, and then redirects if the login was successful

By default, the authentication page sets a cookie and value of 
'48_byte_token:username:reserved_for_future_use'. At the time of login, a 
row is added to the authtable table in a database. Expiration time is by 
default 180 days from the time of authentication. Checking the cookie 
requires matching the token/username combination in the cookie against the 
token/username/expiration combination in the database.

This is the documentation for using it with apache:



For applications that can make use of the REMOTE_USER webserver variable, 
we have a mod_perl2 module that allows for the setting of the REMOTE_USER 
variable based on the scheme described above. The following httpd.conf 
configuration is required:


  AuthName "Foo Bar Authentication"
  #AuthType Basic
  #SetHandler perl-script
  Options +ExecCGI
  AddHandler cgi-script .cgi
  #PerlOptions +SetupEnv
  AuthType   Basic
  PerlAuthenHandler  Systems::Auth::ApacheAuthen
  Requirevalid-user
  PerlAuthzHandler   Systems::Auth::ApacheAuthz


This will require that any access to /sample_location and beyond will 
require the cookie above set. If it does, the REMOTE_USER variable will be 
set in the httpd 'session'; if not, the user will be redirected to the 
ldapauth login page.




I guess im looking for an authenticaion method similar to this: 
https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/

Any idea if this could be implemented using web2py? or do i have to switch 
to django :(

-- 
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/groups/opt_out.


[web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread NeoToren
Hello,

I have had the same issue trying to send email using Web2Py server.
This is not  mere luxury, emails are needed for a robust authentication 
process which Web2Py offers, IF one can send emails from W2P...

Seems the problem is with GMAIL as other have noted before, on this and on 
other blogs.
I have tried all the possible combinations of port with TLS and etc...

Nothing worked and some combinations actually caused Web2Py server to 
crash...

Eventually - went to https://mandrillapp.com/ and got SMTP service (for 
free).
It takes literally 5 minutes to register with these guys get SMTP 
definitions that you can then use in Web2Py  and it works !!!

Disclaimer - I have *nothing* to do with this company mandrillapp. I have 
actually got the name from one of the links that Alan Etkin has posted a 
few days ago.
Hope it helps


On Monday, January 6, 2014 6:04:06 PM UTC-5, Cliff Kachinske wrote:
>
> On webfaction you can set up an email account and access it directly from 
> within web2py, thus eliminating the transmission to gmail.
>
> On Saturday, January 4, 2014 3:40:11 AM UTC-5, Akash Agrawall wrote:
>>
>> Hie folks.. I know this question is already been asked but I didn't get 
>> any help from those answers. please hava look at this 
>> I am unable to send email in server(to be specific webfaction.com) ...
>> but it's running fine on local host
>> all these three lines in db.py are set to true.
>> auth.settings.registration_requires_verification = True
>> auth.settings.registration_requires_approval = True 
>> auth.settings.reset_password_requires_verification = True 
>>
>>  When I complete the registration form a flash appears on the top-right 
>> corner of the page with a flash message "Unable to send mail"
>> These are the settings of the mail server in db.py 
>>
>> mail = auth.settings.mailer
>> mail.settings.server = 'smtp.gmail.com:587'
>> mail.settings.sender = 'fakeid...@gmail.com'
>> mail.settings.tls = False
>> mail.settings.login ='fakeid425s...@gmail.com:secret'
>>
>>
>>

-- 
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/groups/opt_out.


Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Johann Spies
cond = db.mytable(id=someid).select(db.mytable.id)

Regards
Johann


On 22 January 2014 10:50, Jayadevan M  wrote:

> I am checking for existence of record in a table
>
> cond = db.mytable(id=someid)
> if not cond :
>   do something
>
> This works fine. The query executed selects *all* columns and adds LIMIT
> 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check for
> existence of a record, how can I rewrite this so that we have only the id
> column selected? I am trying to avoid a table scan and have just an index
> scan.
>
>  --
> 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/groups/opt_out.
>



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

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


[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-22 Thread 黄祥
done

sorry the batch file and exe file can not be attached, here is the script 
for bat file :

@echo off

powershell -Command "(New-Object 
Net.WebClient).DownloadFile('http://nchc.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920.msi',
 
'C:\7z920.msi')" 
C:\7z920.msi /quiet /passive
powershell -Command "(New-Object 
Net.WebClient).DownloadFile('http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi',
 
'C:\python-2.7.6.msi')" 
C:\python-2.7.6.msi /quiet /passive
powershell -Command "(New-Object 
Net.WebClient).DownloadFile('http://apache.mirrors.hoobly.com//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi',
 
'C:\httpd-2.2.25-win32-x86-openssl-0.9.8y.msi')"
C:\httpd-2.2.25-win32-x86-openssl-0.9.8y.msi /quiet /passive
powershell -Command "(New-Object 
Net.WebClient).DownloadFile('https://modwsgi.googlecode.com/files/mod_wsgi-win32-ap22py27-3.3.so',
 
'C:\mod_wsgi.so')"
powershell -Command "(New-Object 
Net.WebClient).DownloadFile('http://www.web2py.com/examples/static/web2py_src.zip',
 
'C:\web2py_src.zip')"
"C:\Program Files\7-Zip\7z" x C:\web2py_src.zip -oC:\ -r
setx Path "%PATH%;C:\Python27\Scripts;C:\Python27\"
cd C:\Program Files\Apache Software Foundation\Apache2.2\bin
openssl req -config ../conf/openssl.cnf -new -out ../conf/server.csr 
-keyout ../conf/server.pem
openssl rsa -in ../conf/server.pem -out ../conf/server.key
openssl x509 -in ../conf/server.csr -out ../conf/server.crt -req -signkey 
../conf/server.key -days 365
copy "C:\mod_wsgi.so" "C:\Program Files\Apache Software 
Foundation\Apache2.2\modules\mod_wsgi.so"
copy C:\web2py\handlers\wsgihandler.py C:\web2py\
copy C:\web2py\parameters_8000.py C:\web2py\parameters_80.py
copy C:\web2py\parameters_8000.py C:\web2py\parameters_443.py
type C:\web2py\web2py-httpd-mod_wsgi-conf.txt >> C:\Program Files\Apache 
Software Foundation\Apache2.2\conf\httpd.conf
sc stop Apache2.2
sc start Apache2.2






note :
1. you can check the source for autoit as well (using any editor), yet you 
must install autoit in order to execute *.au3 or compile the script (create 
an exe).
ref:
http://www.autoitscript.com/site/autoit/downloads/
2. the installation of *.msi using /quiet /passive, you can comment or 
delete those parameter if you want user interaction
3. during ssl creation, user must fill the info in command prompt (email, 
state, etc), sorry can not use quiet passive on this one
4. downloaded file stored in C:\, you can see in the script as well
5. @massimo, in those script i stdout to httpd.conf that i put in web2py 
folder
type C:\web2py\web2py-httpd-mod_wsgi-conf.txt >> C:\Program Files\Apache 
Software Foundation\Apache2.2\conf\httpd.conf

please kindly put the file on web2py folder as well, because pardon, i can 
not think any other sexier things to stdout httpd.conf except those 
e.g. bad script not sexy
echo   
 >> C:\Program Files\Apache Software 
Foundation\Apache2.2\conf\httpd.conf
echo   WSGIScriptAlias / 
"C:/Users/sugizo/Desktop/web2py/web2py/wsgihandler.py" >> C:\Program 
Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
echo   
 >> C:\Program Files\Apache Software 
Foundation\Apache2.2\conf\httpd.conf
echo   SSLEngine On 
>> C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
echo   SSLCertificateFile conf/server.crt   
>> C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
echo   SSLCertificateKeyFile conf/server.key   
 >> C:\Program Files\Apache Software 
Foundation\Apache2.2\conf\httpd.conf
echo   
 >> C:\Program Files\Apache Software 
Foundation\Apache2.2\conf\httpd.conf

of course you can put it anywhere and rename the file too, but please don't 
forget to change the script as well.

thanks and best regards,
stifan
>
>
>>
>>

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

Listen 443

LoadModule ssl_module modules/mod_ssl.so
LoadModule wsgi_module modules/mod_wsgi.so

NameVirtualHost *:80

  DocumentRoot "C:/web2py/applications"
  ServerName sugizo

  
Order allow,deny
Deny from all
  

  
Order deny,allow
Allow from all
  

  
Order Allow,Deny
Allow from all
  

  WSGIScriptAlias / "C:/web2py/wsgihandler.py"



NameVirtualHost *:443

  DocumentRoot "C:/web2py/applications"
  Se

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Johann Spies
Oops. That should be
cond = db(db.mytable.id==someid).select(db.mytable.id)


On 22 January 2014 13:50, Johann Spies  wrote:

> cond = db.mytable(id=someid).select(db.mytable.id)
>
> Regards
> Johann
>
>
> On 22 January 2014 10:50, Jayadevan M  wrote:
>
>> I am checking for existence of record in a table
>>
>> cond = db.mytable(id=someid)
>> if not cond :
>>   do something
>>
>> This works fine. The query executed selects *all* columns and adds LIMIT
>> 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check for
>> existence of a record, how can I rewrite this so that we have only the id
>> column selected? I am trying to avoid a table scan and have just an index
>> scan.
>>
>>  --
>> 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/groups/opt_out.
>>
>
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>



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

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


Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
I tried that. I get the error -
 'Row' object has no attribute 'select'
By the way, the "="  works. Additional information, this function is under
modules. Do I have to imprt something to make the select construct work?


On Wed, Jan 22, 2014 at 5:22 PM, Johann Spies wrote:

> Oops. That should be
> cond = db(db.mytable.id==someid).select(db.mytable.id)
>
>
> On 22 January 2014 13:50, Johann Spies  wrote:
>
>> cond = db.mytable(id=someid).select(db.mytable.id)
>>
>> Regards
>> Johann
>>
>>
>> On 22 January 2014 10:50, Jayadevan M wrote:
>>
>>> I am checking for existence of record in a table
>>>
>>> cond = db.mytable(id=someid)
>>> if not cond :
>>>   do something
>>>
>>> This works fine. The query executed selects *all* columns and adds
>>> LIMIT 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check
>>> for existence of a record, how can I rewrite this so that we have only the
>>> id column selected? I am trying to avoid a table scan and have just an
>>> index scan.
>>>
>>>  --
>>> 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/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/XYeLmZjQ6fY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/groups/opt_out.


Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
Sorry. It works (I got something wrong earlier) but the limit has gone
away. I just have to ensure that there is ay least one record.


On Wed, Jan 22, 2014 at 5:28 PM, Jayadevan M wrote:

> I tried that. I get the error -
>  'Row' object has no attribute 'select'
> By the way, the "="  works. Additional information, this function is under
> modules. Do I have to imprt something to make the select construct work?
>
>
> On Wed, Jan 22, 2014 at 5:22 PM, Johann Spies wrote:
>
>> Oops. That should be
>> cond = db(db.mytable.id==someid).select(db.mytable.id)
>>
>>
>> On 22 January 2014 13:50, Johann Spies  wrote:
>>
>>> cond = db.mytable(id=someid).select(db.mytable.id)
>>>
>>> Regards
>>> Johann
>>>
>>>
>>> On 22 January 2014 10:50, Jayadevan M wrote:
>>>
 I am checking for existence of record in a table

 cond = db.mytable(id=someid)
 if not cond :
   do something

 This works fine. The query executed selects *all* columns and adds
 LIMIT 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check
 for existence of a record, how can I rewrite this so that we have only the
 id column selected? I am trying to avoid a table scan and have just an
 index scan.

  --
 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/groups/opt_out.

>>>
>>>
>>>
>>> --
>>> Because experiencing your loyal love is better than life itself,
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>
>>
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/XYeLmZjQ6fY/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread Alan Etkin


> When navigating to the Edit -> Graph Model on any web2py app, I get the 
> error "pygraphviz library not found".
>

Can you import the library from an interactive session?
Maybe you have a path issue, i.e., you are using the built-in python 
interpreter of a compiled web2py installation without access to the system 
python path

-- 
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/groups/opt_out.


Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
Here is how it is now ..

1) cond = db.mytable(id=someid) 
generates
SELECT   FROM mytable WHERE (id = someid) LIMIT 1 OFFSET 0;

2) cond = db(db.mytable.id==someid).select(db.mytable.id,limitby=(0, 1))
generates
SELECT   FROM mytable WHERE (id = someid)  ORDER BY pk LIMIT 1 
OFFSET 0;

What I would like to have is 

SELECTFROM mytable WHERE (id = someid) LIMIT 1 ;

On Wednesday, January 22, 2014 5:36:00 PM UTC+5:30, Jayadevan M wrote:
>
> Sorry. It works (I got something wrong earlier) but the limit has gone 
> away. I just have to ensure that there is ay least one record.
>
>
> On Wed, Jan 22, 2014 at 5:28 PM, Jayadevan M 
> wrote:
>
>> I tried that. I get the error - 
>>  'Row' object has no attribute 'select'
>> By the way, the "="  works. Additional information, this function is 
>> under modules. Do I have to imprt something to make the select construct 
>> work?
>>
>>
>> On Wed, Jan 22, 2014 at 5:22 PM, Johann Spies wrote:
>>
>>> Oops. That should be
>>> cond = db(db.mytable.id==someid).select(db.mytable.id)
>>>
>>>
>>> On 22 January 2014 13:50, Johann Spies  wrote:
>>>
 cond = db.mytable(id=someid).select(db.mytable.id)

 Regards
 Johann


 On 22 January 2014 10:50, Jayadevan M wrote:

> I am checking for existence of record in a table
>
> cond = db.mytable(id=someid)
> if not cond :
>   do something
>
> This works fine. The query executed selects *all* columns and adds 
> LIMIT 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check 
> for existence of a record, how can I rewrite this so that we have only 
> the 
> id column selected? I am trying to avoid a table scan and have just an 
> index scan.
>
>  -- 
> 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/groups/opt_out.
>



 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)
  
>>>
>>>
>>>
>>> -- 
>>> Because experiencing your loyal love is better than life itself, 
>>> my lips will praise you.  (Psalm 63:3)
>>>  
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/XYeLmZjQ6fY/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>

-- 
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/groups/opt_out.


Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Anthony
If you want to get rid of the orderby, do:

db(db.mytable.id == someid).select(db.mytable.id, limitby=(0, 
1),orderby_on_limitby
=False)

When you specify a limitby, by default it will orderby the PK (or add the 
PK to the orderby). The reason for this is to ensure a consistent ordering 
if you repeat the query or are using the limitby for pagination purposes 
(otherwise, successive queries are not guaranteed to return results in the 
same order).

Anthony

On Wednesday, January 22, 2014 7:35:22 AM UTC-5, Jayadevan M wrote:
>
> Here is how it is now ..
>
> 1) cond = db.mytable(id=someid) 
> generates
> SELECT   FROM mytable WHERE (id = someid) LIMIT 1 OFFSET 0;
>
> 2) cond = db(db.mytable.id==someid).select(db.mytable.id,limitby=(0, 1))
> generates
> SELECT   FROM mytable WHERE (id = someid)  ORDER BY pk LIMIT 1 
> OFFSET 0;
>
> What I would like to have is 
>
> SELECTFROM mytable WHERE (id = someid) LIMIT 1 ;
>
> On Wednesday, January 22, 2014 5:36:00 PM UTC+5:30, Jayadevan M wrote:
>>
>> Sorry. It works (I got something wrong earlier) but the limit has gone 
>> away. I just have to ensure that there is ay least one record.
>>
>>
>> On Wed, Jan 22, 2014 at 5:28 PM, Jayadevan M 
>> 
>> > wrote:
>>
>>> I tried that. I get the error - 
>>>  'Row' object has no attribute 'select'
>>> By the way, the "="  works. Additional information, this function is 
>>> under modules. Do I have to imprt something to make the select construct 
>>> work?
>>>
>>>
>>> On Wed, Jan 22, 2014 at 5:22 PM, Johann Spies 
>>> 
>>> > wrote:
>>>
 Oops. That should be
 cond = db(db.mytable.id==someid).select(db.mytable.id)


 On 22 January 2014 13:50, Johann Spies 
 > wrote:

> cond = db.mytable(id=someid).select(db.mytable.id)
>
> Regards
> Johann
>
>
> On 22 January 2014 10:50, Jayadevan M 
> > wrote:
>
>> I am checking for existence of record in a table
>>
>> cond = db.mytable(id=someid)
>> if not cond :
>>   do something
>>
>> This works fine. The query executed selects *all* columns and adds 
>> LIMIT 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just 
>> check 
>> for existence of a record, how can I rewrite this so that we have only 
>> the 
>> id column selected? I am trying to avoid a table scan and have just an 
>> index scan.
>>
>>  -- 
>> 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/groups/opt_out.
>>
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  



 -- 
 Because experiencing your loyal love is better than life itself, 
 my lips will praise you.  (Psalm 63:3)
  
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/XYeLmZjQ6fY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com .
 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>
>>

-- 
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/groups/opt_out.


Re: [web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread Akash Agrawall
Can you explain it in a more brief way. Like where are you hosting the site
and which site you are using to send the mail from(like gmail, yahoo or ??)
and please fill in the mail settings(in db.py) that you have used to make
it work.
In my case the case was that the server was from US and gmail has some kind
of firewall to disable requests from this area. Finally I used the email of
the site itself which allowed me to host and the mail settings was given by
the site people themself...

Regards,
Akash


On Wed, Jan 22, 2014 at 2:43 AM, NeoToren  wrote:

> Hello,
>
> I have had the same issue trying to send email using Web2Py server.
> This is not  mere luxury, emails are needed for a robust authentication
> process which Web2Py offers, IF one can send emails from W2P...
>
> Seems the problem is with GMAIL as other have noted before, on this and on
> other blogs.
> I have tried all the possible combinations of port with TLS and etc...
>
> Nothing worked and some combinations actually caused Web2Py server to
> crash...
>
> Eventually - went to https://mandrillapp.com/ and got SMTP service (for
> free).
> It takes literally 5 minutes to register with these guys get SMTP
> definitions that you can then use in Web2Py  and it works !!!
>
> Disclaimer - I have *nothing* to do with this company mandrillapp. I have
> actually got the name from one of the links that Alan Etkin has posted a
> few days ago.
> Hope it helps
>
>
> On Monday, January 6, 2014 6:04:06 PM UTC-5, Cliff Kachinske wrote:
>>
>> On webfaction you can set up an email account and access it directly from
>> within web2py, thus eliminating the transmission to gmail.
>>
>> On Saturday, January 4, 2014 3:40:11 AM UTC-5, Akash Agrawall wrote:
>>>
>>> Hie folks.. I know this question is already been asked but I didn't get
>>> any help from those answers. please hava look at this
>>> I am unable to send email in server(to be specific webfaction.com) ...
>>> but it's running fine on local host
>>> all these three lines in db.py are set to true.
>>> auth.settings.registration_requires_verification = True
>>> auth.settings.registration_requires_approval = True
>>> auth.settings.reset_password_requires_verification = True
>>>
>>>  When I complete the registration form a flash appears on the top-right
>>> corner of the page with a flash message "Unable to send mail"
>>> These are the settings of the mail server in db.py
>>>
>>> mail = auth.settings.mailer
>>> mail.settings.server = 'smtp.gmail.com:587'
>>> mail.settings.sender = 'fakeid...@gmail.com'
>>> mail.settings.tls = False
>>> mail.settings.login ='fakeid425s...@gmail.com:secret'
>>>
>>>
>>>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/CU_1qWYixjI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
akash.wanteds

-- 
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/groups/opt_out.


[web2py] check if db field is empty

2014-01-22 Thread Yebach
Hello

How do I check is database field is empty?

eng_out = db(db.script.id == 
id_skripte).select(db.script.sc_engine_output)
 print "eng_out ",eng_out 

## this returns
##eng_out  script.sc_engine_output
##

if eng_out is None: ## check for nullability
print "field is Null"


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/groups/opt_out.


[web2py] Re: check if db field is empty

2014-01-22 Thread Yebach
I tryied with 

eng_out = db(db.script.id == 
id_skripte).select(db.script.sc_engine_output)[0]['sc_engine_output']
print "eng_out ", eng_out

if eng_out is None:
print "Ni podatkov"


but I am sure there has to be a better way. 

thanx again

-- 
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/groups/opt_out.


[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-22 Thread Willoughby
As a side note, Chocolatey is an attempt at apt-get like functionality in 
Windows:
http://chocolatey.org/

You can even make your own package...

-- 
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/groups/opt_out.


[web2py] How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Horst Horst
In my record-update controller, after SQLFORM.validate(), I'd like to 
programmatically change some of the submitted form values, and then present 
the form again (with the changed values) for further editing. Imagine a 
sort of autocomplete of partially filled forms. 

My controller has the standard control flow with self-submission, and 
returns dict(form=form) as usual. However, there should be no database 
update until the final (unaltered) submission. (I'm already doing this 
manually, without SQLFORM.process.)

How can I alter the submitted values? Simply assigning "form.vars.my_field 
= my_new_value", and then returning the form doesn't seem to work.

-- 
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/groups/opt_out.


[web2py] Re: check if db field is empty

2014-01-22 Thread Anthony
How about:

if db((db.script.id == id_skripte) & (db.script.sc_engine != None)).select
():

Anthony

On Wednesday, January 22, 2014 9:30:45 AM UTC-5, Yebach wrote:
>
> I tryied with 
>
> eng_out = db(db.script.id == 
> id_skripte).select(db.script.sc_engine_output)[0]['sc_engine_output']
> print "eng_out ", eng_out
> 
> if eng_out is None:
> print "Ni podatkov"
>
>
> but I am sure there has to be a better way. 
>
> thanx again
>

-- 
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/groups/opt_out.


[web2py] simplejson and datetime

2014-01-22 Thread Arnon Marcus
I know there is support for "encoding" datetime objects using the 
gluon.contrib flavor of simplejson.
(at least in the old version of web2py I am using)
But I opted for using 'pip install simplejson' as it compiles the latest 
version for me... So I use that.
I don't have issues in encoding, as I use it only in the cache (which is 
more-readable AND faster then cPickle), and so I don't even try to store 
complex-objects - not even 'Rows' objects - I always do ',as_list()' on all 
the queries in my lambdas...

What I am interested in doing, is have it turned back into a datetime 
object when 'decoding' - and THAT is not supported even in the web2py 
flavor - and I haven't found a single simple solution for it on the web for 
the standard simplejson either.

I tried to hack it in the redis_cache.py (since I use redis for caching). I 
added a function 'as_datetime' at the beginning of the file:

def as_datetime(dct):
if type(dct) is dict:
Created = dct.get('Created', None)
Modified = dct.get('Modified', None)
if Created: dct['Created'] = datetime.datetime.strptime(Created, 
'%Y-%m-%d 
%H:%M:%S')
if Modified: dct['Modified'] = datetime.datetime.strptime(Modified, 
'%Y-%m-%d 
%H:%M:%S')
return dct

Then, in the '__call__' function of the 'RedisClient' class, I replaced:
value = pickle.loads(obj)
with:
value = pickle.loads(obj, object_hook=as_datetime)

I tried some other variations of the, like going over the values of the 
dictionary, and looking for a non-empty string-type value that 
startswith('20') and/or matches a reg-ex pattern of isodatetime, and/or 
using 'dateutil.parse()' instead of 'datetime.strptime()' etc...

The problem I'm having is that this is all very 'taxing' on my 
caching-system - I am getting a slowdown of 40% on the entire 
cache-retrieval on each request, compared to leaving it as a string...

I am wondering, is that more a consequence of the way I am interjecting 
into the simplejson parser (the 'object_hoock' approach...)
I wonder, is there a better (more performant) way of doing this? Am I 
missing something?
I've seen there is a 'default=' something somewhere in the simplejson 
stuff, but there is very poor documentation on these things in simplejson...
It just seems such a trivial thing, I was sure I am missing something 
obvious for some reason...
If I do, I haven't ought it yet... Any thoughts?
Is there a way to interject the parsing process at the leaf-most value, and 
not the dictionary-level? Would that be faster?

* I know I should probably be using Massimo's implementations/wrapper-over 
simplejson, I just don't fully understand the whole _simplejson 
speed-improvement stuff, as I am using python 2.6 and not 2.7 - so I'm not 
clear on where I stand in that respect for using Massimo's code... I think 
I would still get better performance just using the 'pip install 
simplejson' approach and use that one directly...
I would consider using it, if it would solve my datetime problem, but it 
doesn't - all it solves, is *encoding *'Rows' objects with datetime 
objects, which I don't use anyway...

-- 
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/groups/opt_out.


[web2py] Re: Weird problems generating menu from database

2014-01-22 Thread web2pygroup
That works great, thank you!!!  My only remaining question is that when I 
try to edit the first record "main" in the appadmin I get the foreign key 
error.  I read here -> 
https://groups.google.com/forum/#!topic/web2py/klspqXpha4E <- about how to 
disable it.  Wasn't sure if I should do that or not...  The other records 
do not act up when changed, just that one so I'm sure I could work around 
that but, just in case someone else manages the site... I'm not sure.  
Thoughts?

On Tuesday, January 21, 2014 11:03:46 PM UTC-6, Massimo Di Pierro wrote:
>
> Sorry typo. Let's try again:
>
> db.define_table('store_catalog',
> Field('title'),
> Field('slug',requires=IS_SLUG(),compute=lambda row: 
> IS_SLUG.urlify(row.titl\
> e)),
> Field('parent_id','reference store_catalog'))
>
> id1 = db.store_catalog.insert(title='main')
> id2 = db.store_catalog.insert(title='one',parent_id=id1)
> id3 = db.store_catalog.insert(title='two',parent_id=id2)
>
> def menu_rec(items): return 
> [(x.title,None,URL('action',args=x.slug),menu_rec(x\
> .children)) for x in items or []]
> response.menu = menu_rec(db(db.store_catalog).select().as_trees())
> print response.menu
>
> On Tuesday, 21 January 2014 12:17:19 UTC-6, web2pygroup wrote:
>>
>> Here's what I've tried so far and here's the results if it helps any to 
>> get me on the right track, plus I hope this helps someone else looking for 
>> this to because this is something very commonly done in PHP.
>>
>> I have tried changing this:
>> response.menu3[-1]+=([[(T(subcat.subcategory)), False, 'link',]])
>>
>> to this:
>> response.menu3[-1]+=([(T(subcat.subcategory)), False, 'link',])
>>
>> Which changes the output in the shell to:
>> [,
>>  False,
>>  '',
>>  [,
>>   False,
>>   'link',
>>   ,
>>   False,
>>   'link',
>>   ,
>>   False,
>>   'link']]
>>
>> Which obviously isn't correct.  
>>
>> Continuing:
>>
>> original:
>> response.menu3[-1]+=([[(T(subcat.subcategory)), False, 'link',]])
>>
>> to this:
>> response.menu3+=([[(T(subcat.subcategory)), False, 'link',]])
>>
>> Gives this in the shell output:
>> [,
>>  False,
>>  '',
>>  [, False, 'link'],
>>  [, False, 'link'],
>>  [, False, 'link']]
>>
>> Again obviously incorrect.  Continuing:
>>
>> original:
>> response.menu3+=([[(T(subcat.subcategory)), False, 'link',]])
>>
>> changed:
>> response.menu3[-1]+=((T(subcat.subcategory)), False, 'link',)
>>
>> Shell output shows:
>> [,
>>  False,
>>  '',
>>  [,
>>   False,
>>   'link',
>>   ,
>>   False,
>>   'link',
>>   ,
>>   False,
>>   'link']]
>>
>> I tried additional variations but, not sure how much space we have here 
>> to keep going with my 2 weeks worth of work.  Essentially the end result is 
>> the same a bracket missing to seperate the subcategories.  I've been able 
>> to modify and add to lists before, however I've never really experienced a 
>> situation where the negative slice appears to be ignored (removing the 
>> bracket at the end of dogs and beginning of cats as it is doing for the 
>> main category Animals as can be seen), even removed the negative slice 
>> ([-1]) for the main categories iteration and when I do it clearly shows 
>> that it is actually doing the negative slice properly because the brackets 
>> come back at the end of Animals, unlike the subcategories that do not 
>> appear to be removing the bracket(s)
>>
>>
>> On Monday, January 20, 2014 2:33:50 PM UTC-6, web2pygroup wrote:
>>>
>>>
>>> Hi all,
>>>
>>> I have been trying for a little over 2 weeks to figure this out...
>>>
>>> I'm trying to generate a menu that drops down, I have been able to 
>>> statically create it by overwriting sample app that has the same drop down 
>>> menu like the web2py.com site.
>>>
>>> I have this in my db.py:
>>> db.define_table('store_catalog',
>>> Field('maincategory', 'string'),
>>> Field('subcategory', 'string'),
>>> Field('description', 'text'))
>>>
>>>
>>> in my menu.py I have gotten this so far:
>>> response.menu=[]
>>> response.menu.append([T('Catalog'), False, '',
>>>[(T('%s' % menucatchoice['maincategory']), False, 'link',
>>> [(T('%s' % menucatchoice['subcategory']), False, 
>>> 'link'),]) for menucatchoice in rows ] ])
>>>
>>> It gets me a drop down menu except that for each subcategory it repeats 
>>> adding it to the main category. Let's say there is only 1 main category and 
>>> 2 subs that go after that
>>> Catalog (this just shows with the caret next to it as intended)
>>> MainCategory
>>> Sub
>>> Sub
>>> What I have does put the "Catalog" for the first but, what I get is:
>>> MainCategory
>>> (blank)
>>> MainCategory(don't want this it's being repeated)
>>>Subcategory
>>> MainCategory(and this one is also a repeat)
>>>Subcategory
>>>
>>> I have tried to break out the response.menu with so many different 
>>> .appends it's not funny.  I have also tried adding the "[-1]".  This was 
>>> the closest I have gotten to what I want it to look like.  I'm at an 
>>> absolute lo

[web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread User
I also would like a non-null foreign key reference, but like OP 
experienced web2py will not create one.  Why is this?  And is there a 
workaround to make reference fields not null?  Or worst case can I add the 
not null constraint manually in the db without breaking anything?


On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote:

> Same problem here!
> The "notnull=True" parameter doesn't append the "NOT NULL" clause for 
> reference fields.
> The IS_IN_DB function activates the check at form-level while the notnull 
> parameter should set the constraint at db-level.
>
>

-- 
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/groups/opt_out.


[web2py] Re: Form input prolem

2014-01-22 Thread Lucas Schreiber
Hi, i thought the form worked good, but unfortunally i was wrong.
name = form.vars.name contains the data from 'Name', INPUT(_name='name'),
but
passwords = form.vars.password is always none

here again the code, with the improvements:

def login():
form = FORM(
'Name', INPUT(_name='name'),
'password', INPUT(_password='password'),
INPUT(_type='submit'))
if form.process().accepted:
name = form.vars.name
passwdb = dba(dba.user.name== name).select(dba.user.password).first
()
passwords = form.vars.password
dba.user.insert(name = 'justtest', password= form.vars.name, email=form
.vars.password, country= form.vars.name)
if passwdb == passwords:
   redirect(URL('index'))
else:
   redirect(URL('register'))
   
return dict(form=form)


Am Sonntag, 19. Januar 2014 19:28:23 UTC+1 schrieb Lucas Schreiber:
>
> Hi guys,
>
> i have this function:
>
> def login():
> form = FORM(
> 'Name', INPUT(_name='name'),
> 'password', INPUT(_password='password'), 
> INPUT(_type='submit'))
> if form.process().accepted:
> name = form.vars.name
> records = SQLTABLE(dba(dba.user.name== name).select(dba.user.
> password),headers='fieldname:capitalize')
> passworddb = records[1]
> password = form.vars.password
> dba.person.insert(name = 'test', email=password)
> if passworddb == password:
>redirect(URL('register'))
> else:
>redirect(URL('index'))
> 
> return dict(form=form)
>
>
> As you can see, you enter name and password into a form, and from a db it 
> choose a password correspondending to the username. that part works fine. 
> but the problem is on the part:
>
> password = form.vars.password
>
> i think this doesnt work, since the line below
>
>
> dba.person.insert(name = 'test', email=password)
>
> inserts into another db "test", "none"
>
> Do anyone has an idea how to fix this problem? Or can anyone tell me what 
> i did wrong?
>
> Thanks for the help,
> Darren
>

-- 
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/groups/opt_out.


Re: [web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread Richard Vézina
Of cours you can change you db manually with SQL DLL...

You can still adjust your web2py model and do fake_migrate=True,
migrate=False to get thing in sync...

Richard


On Wed, Jan 22, 2014 at 1:13 PM, User  wrote:

> I also would like a non-null foreign key reference, but like OP
> experienced web2py will not create one.  Why is this?  And is there a
> workaround to make reference fields not null?  Or worst case can I add the
> not null constraint manually in the db without breaking anything?
>
>
> On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote:
>
>> Same problem here!
>> The "notnull=True" parameter doesn't append the "NOT NULL" clause for
>> reference fields.
>> The IS_IN_DB function activates the check at form-level while the notnull
>> parameter should set the constraint at db-level.
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.


[web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread Anthony
This is a bug, and an issue has been created. Yes, you should be able to 
make the change directly in the database.

Anthony

On Wednesday, January 22, 2014 1:13:30 PM UTC-5, User wrote:
>
> I also would like a non-null foreign key reference, but like OP 
> experienced web2py will not create one (I'm using postgresql).  Why is 
> this?  And is there a workaround to make reference fields not null?  Or 
> worst case can I add the not null constraint manually in the db without 
> breaking anything?
>
>
> On Tuesday, June 19, 2012 11:40:37 AM UTC-4, Ivan wrote:
>
>> Same problem here!
>> The "notnull=True" parameter doesn't append the "NOT NULL" clause for 
>> reference fields.
>> The IS_IN_DB function activates the check at form-level while the notnull 
>> parameter should set the constraint at db-level.
>>
>>

-- 
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/groups/opt_out.


Re: [web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread NeoToren
Not hosting it yet, still building and testing...
I have tried to use gmail (I am located in USA) and had encountered same 
problems you and others did. 
Since I am not hosted YET, and for testing purposes I needed be able to 
send email I decided to go with this company I found yesterday...
In this regard it seems like the same solution you found when you mentioned 
*"the 
mail settings was given by the site people themself... "*

The Web2Py book on this subject is correct - it just doesn't work with 
gmail as SMTP.

This is what I have in my db.py and it works:

##configure email 
from gluon.tools import Mail
mail=auth.settings.mailer
mail.settings.server ='smtp.mandrillapp.com:587' # this is the SMTP and port
mail.settings.sender = 'mya...@gmail.com' # note that a gmail adrs CAN BE 
USED as sender 
mail.settings.login = 'mya...@gmail.com:pwdYouGonnaGetFromMandrillapp'

Take care,
NeoToren

On Wednesday, January 22, 2014 9:00:35 AM UTC-5, Akash Agrawall wrote:
>
> Can you explain it in a more brief way. Like where are you hosting the 
> site and which site you are using to send the mail from(like gmail, yahoo 
> or ??) and please fill in the mail settings(in db.py) that you have used to 
> make it work.
> In my case the case was that the server was from US and gmail has some 
> kind of firewall to disable requests from this area. Finally I used the 
> email of the site itself which allowed me to host and the mail settings was 
> given by the site people themself... 
>
> Regards,
> Akash
>
>
> On Wed, Jan 22, 2014 at 2:43 AM, NeoToren 
> > wrote:
>
>> Hello,
>>
>> I have had the same issue trying to send email using Web2Py server.
>> This is not  mere luxury, emails are needed for a robust authentication 
>> process which Web2Py offers, IF one can send emails from W2P...
>>
>> Seems the problem is with GMAIL as other have noted before, on this and 
>> on other blogs.
>> I have tried all the possible combinations of port with TLS and etc...
>>
>> Nothing worked and some combinations actually caused Web2Py server to 
>> crash...
>>
>> Eventually - went to https://mandrillapp.com/ and got SMTP service (for 
>> free).
>> It takes literally 5 minutes to register with these guys get SMTP 
>> definitions that you can then use in Web2Py  and it works !!!
>>
>> Disclaimer - I have *nothing* to do with this company mandrillapp. I 
>> have actually got the name from one of the links that Alan Etkin has posted 
>> a few days ago.
>> Hope it helps
>>
>>
>> On Monday, January 6, 2014 6:04:06 PM UTC-5, Cliff Kachinske wrote:
>>>
>>> On webfaction you can set up an email account and access it directly 
>>> from within web2py, thus eliminating the transmission to gmail.
>>>
>>> On Saturday, January 4, 2014 3:40:11 AM UTC-5, Akash Agrawall wrote:

 Hie folks.. I know this question is already been asked but I didn't get 
 any help from those answers. please hava look at this 
 I am unable to send email in server(to be specific webfaction.com) ...
 but it's running fine on local host
 all these three lines in db.py are set to true.
 auth.settings.registration_requires_verification = True
 auth.settings.registration_requires_approval = True 
 auth.settings.reset_password_requires_verification = True 

  When I complete the registration form a flash appears on the 
 top-right corner of the page with a flash message "Unable to send mail"
 These are the settings of the mail server in db.py 

 mail = auth.settings.mailer
 mail.settings.server = 'smtp.gmail.com:587'
 mail.settings.sender = 'fakeid...@gmail.com'
 mail.settings.tls = False
 mail.settings.login ='fakeid425s...@gmail.com:secret'


  -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/CU_1qWYixjI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
> akash.wanteds 
>

-- 
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/groups/opt_out.


[web2py] Multiple one-to-many join query help.

2014-01-22 Thread Apple Mason

I have the following tables:


db.define_table('person',
Field('name', 'string'))

db.define_table('pet',
Field('name', 'string'),
Field('person_id', 'reference person'))

db.define_table('thing',
Field('name', 'string'),
Field('person_id', 'reference person'))

I have a person_id given to me, so I want all information about that person 
(person's name, all pets, all things).

I am trying left join, but I am not getting it quite right:

 person = db(db.person.id==person_id).select(db.person.ALL, db.pet.ALL, 
db.thing.ALL, 
 
left=[db.person.on(db.person.id==db.pet.person_id),
 
db.person.on(db.person.id==db.thing.person_id)])

I get an error:

OperationalError: ambiguous column name: person.id

-- 
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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread Massimo Di Pierro
Are you using the windows web2py binary? You need the source.

On Wednesday, 22 January 2014 01:06:06 UTC-6, Bogdan Nechita wrote:
>
> Hi,
>
> When navigating to the Edit -> Graph Model on any web2py app, I get the 
> error "pygraphviz library not found".
> I have installed Graphviz (http://www.graphviz.org/Download_windows.php) 
> and PyGraphviz (http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygraphviz) 
> successfully but web2py doesn't seem to pick up on that and still returns 
> the error above. 
>
> I uninstalled PyGraphviz and tried to install it using the steps detailed 
> here (https://groups.google.com/forum/#!topic/networkx-discuss/Xy1lWfMdB6U) 
> and here (
> http://blog.ropardo.ro/2011/11/28/installing-pygraphviz-on-windows/) but 
> none of the two attempts were successful - couldn't actually compile 
> pygraphviz.
>
> System: Windows 8
> web2py: 2.8.2
>
> Any help is greatly appreciated. 
>
> Thanks,
> Bogdan
>

-- 
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/groups/opt_out.


Re: [web2py] Re: filepaths for library and images ?

2014-01-22 Thread Stef Mientki

thanks,
got in not working yet.
I also tried the solution suggested in  "pass as parameter or import" 
about an our later, but that didn't worked either.


I don't understand the path philosophy of web2py at this moment.

e.g.
why is this working:



and why is this NOT working:



while the images are in both directories.

cheers,
Stef

On 22-01-14 4:07, Anthony wrote:
Please see 
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules.


On Tuesday, January 21, 2014 7:14:05 PM UTC-5, aapaap wrote:

thanks Anthony,
the import now works partially.

The lib needs to know the database "db" is it possible to import that.
from db import db
doesn't work

cheers,
Stef

On 21-01-14 23:55, Anthony wrote:


 Filename = os.path.join ( 'applications',
request.application,'static\images\pic_%s.png' %
Edit_Select), 'wb')


|
os.path.join(request.folder,'static','images','pic_%s.png'%Edit_Select)
|

Q2:
I made some libraries that I want to use more than one project.
Now I stored these in
..controllers/my_support_libs.py


Controllers are not Python modules and cannot be imported. If you
need to share a module, put it anywhere in the pythonpath and
import from there. You can put it in the /modules folder of a
given app and import from other apps via:

|
importapplications.myapp.modules.mymodule
|

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+un...@googlegroups.com .
For more options, visit https://groups.google.com/groups/opt_out
.


--
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/groups/opt_out.


--
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/groups/opt_out.


[web2py] Path to static files

2014-01-22 Thread horridohobbyist
I'm trying to do an os.listdir() of the files in 'static', but I can't 
figure out the correct pathname. Is this documented somewhere?

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/groups/opt_out.


[web2py] Re: Multiple one-to-many join query help.

2014-01-22 Thread Niphlod
I'm guessing you had it wrong

db(main_table.filter == something).select(
main_table, other_table, 
left=[other_table.on(main_table.some_id == other_table.reference), 
]
)



On Wednesday, January 22, 2014 10:24:14 PM UTC+1, Apple Mason wrote:
>
>
> I have the following tables:
>
>
> db.define_table('person',
> Field('name', 'string'))
>
> db.define_table('pet',
> Field('name', 'string'),
> Field('person_id', 'reference person'))
>
> db.define_table('thing',
> Field('name', 'string'),
> Field('person_id', 'reference person'))
>
> I have a person_id given to me, so I want all information about that 
> person (person's name, all pets, all things).
>
> I am trying left join, but I am not getting it quite right:
>
>  person = db(db.person.id==person_id).select(db.person.ALL, db.pet.ALL, 
> db.thing.ALL, 
>  
> left=[db.person.on(db.person.id==db.pet.person_id),
>  
> db.person.on(db.person.id==db.thing.person_id)])
>
> I get an error:
>
> OperationalError: ambiguous column name: person.id
>

-- 
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/groups/opt_out.


Re: [web2py] Re: filepaths for library and images ?

2014-01-22 Thread Anthony
web2py URL are not based on filepaths, with the exception of files in the 
/static folder. All other URLs are in /app/controller/function/list/of/args 
format. You cannot access a file in the /uploads folder simply by putting 
/uploads in the URL. Rather, the URL must point to a controller and 
function that handles retrieving and streaming the file (the 
/default/download function in the welcome app does this for files that have 
been uploaded via a DAL upload field).

Anthony

On Wednesday, January 22, 2014 4:30:24 PM UTC-5, aapaap wrote:
>
>  thanks,
> got in not working yet.
> I also tried the solution suggested in  "pass as parameter or import" 
> about an our later, but that didn't worked either.
>
> I don't understand the path philosophy of web2py at this moment.
>
> e.g.
> why is this working:
> 
>
> and why is this NOT working:
> 
>
> while the images are in both directories.
>
> cheers,
> Stef
>
> On 22-01-14 4:07, Anthony wrote:
>  
> Please see 
> http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules
> .
>
> On Tuesday, January 21, 2014 7:14:05 PM UTC-5, aapaap wrote: 
>>
>>  thanks Anthony,
>> the import now works partially.
>>
>> The lib needs to know the database "db" is it possible to import that.
>> from db import db 
>> doesn't work
>>
>> cheers,
>> Stef
>>
>> On 21-01-14 23:55, Anthony wrote:
>>  
>>   Filename = os.path.join ( 'applications', 
>>> request.application,'static\images\pic_%s.png' % Edit_Select), 'wb') 
>>>
>>
>>  os.path.join(request.folder, 'static', 'images', 'pic_%s.png' % 
>> Edit_Select) 
>>  
>>  Q2: 
>>> I made some libraries that I want to use more than one project. 
>>> Now I stored these in 
>>> ..controllers/my_support_libs.py
>>>
>>
>>  Controllers are not Python modules and cannot be imported. If you need 
>> to share a module, put it anywhere in the pythonpath and import from there. 
>> You can put it in the /modules folder of a given app and import from other 
>> apps via:
>>
>>  import applications.myapp.modules.mymodule
>>  
>>  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+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>   -- 
> 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/groups/opt_out.
>
>
>  

-- 
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/groups/opt_out.


[web2py] Re: Path to static files

2014-01-22 Thread Niphlod
os.path.join(request.folder, 'static')
the core functionalities are documented here 
http://web2py.com/books/default/chapter/29/04/the-core

On Wednesday, January 22, 2014 10:39:35 PM UTC+1, horridohobbyist wrote:
>
> I'm trying to do an os.listdir() of the files in 'static', but I can't 
> figure out the correct pathname. Is this documented somewhere?
>
> 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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread 黄祥
same here, pygraphiz library not found, tested on windows 7 32 bit with 
web2py_src and web2py_win

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/groups/opt_out.


[web2py] error creating table using sql server

2014-01-22 Thread 黄祥
hello folks,

is there any adjustment for table when change database connection? i have 
define table that running fine on postgresql, mysql, sqlite (without any 
modification when i change database connection), but sadly when tested on 
sql server it throw me an error

*error :*
 (u'42000', u"[42000] 
[Microsoft][ODBC SQL Server Driver][SQL Server]Introducing FOREIGN KEY 
constraint 'customer_created_by__constraint' on table 'customer' may cause 
cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE 
NO ACTION, or modify other FOREIGN KEY constraints.")

*my code on models\db.py*
## Use SQLite
#db = DAL('sqlite://testagain.sqlite', pool_size = 30, check_reserved = 
['all'], migrate = True, lazy_tables = True)

## Use MySQL
# db = DAL('mysql://root:whateverpasswordyoulike@localhost/testagain', 
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables = 
True)

## Use PostgreSQL
# db = 
DAL('postgres://postgres:whateverpasswordyoulike@localhost/testagain', 
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables = 
True)

from gluon.dal import MSSQLAdapter
if not (MSSQLAdapter.driver):
  MSSQLAdapter.driver = globals().get('pyodbc',None)

db = 
DAL('mssql://sa:whateverpasswordyoulike@localhost\SQLEXPRESS/testagain', 
pool_size = 30, check_reserved = ['all'], migrate = True, lazy_tables = 
True)

as you can see i just define the database connection (sqlite, postgresql, 
mysql, sql server), i just test it running from empty database, yet only 
sql server is return an error.

any suggestions or hints about creating table using sql server?

and another question is why i must explicit import sqlserver driver because 
when i'm running web2py server it said : 
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), 
Ingres(pyodbc), IMAP(imaplib)

as for sqlite, mysql and postgresql i didn't have to import the driver

thanks and best regards,
stifan

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


[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Jaime Sempere

I don't understand completely the flow of the process...  do you have two 
submitt buttons, one for "autocomplete" and the other for "final submit?

I am not very sure, but here are my thoughts: What I would do is use 
SQLFORM.factory something like this:

new_post_form = SQLFORM.factory(db.posts)
if new_thread_form.process().accepted:
 if (autocomplete):
  Do your process, and save it in the form.vars
 else: 
  Do the final update using db().update()




And check this topic too to return the prepolutaded form, keeping the 
values that you processed after "if (autocomplete)"

-- 
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/groups/opt_out.


[web2py] Re: Important New Year News: Edison Award

2014-01-22 Thread Jaime Sempere

Good luck! And glad to hear news like this. I am using again web2py and I 
am loving it. It was long time ago since I didn't enjoy programming so 
much. And I think you can see almost everywhere of 'him' the effort of the 
creators for develope something easy and fast to use. So.. as everyone say 
best wishes, Massimo & web2py community!

-- 
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/groups/opt_out.


[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Anthony
I think it will be easier to help if you show some code so we can see 
exactly what you need to do.

On Wednesday, January 22, 2014 9:43:48 AM UTC-5, Horst Horst wrote:
>
> In my record-update controller, after SQLFORM.validate(), I'd like to 
> programmatically change some of the submitted form values, and then present 
> the form again (with the changed values) for further editing. Imagine a 
> sort of autocomplete of partially filled forms. 
>
> My controller has the standard control flow with self-submission, and 
> returns dict(form=form) as usual. However, there should be no database 
> update until the final (unaltered) submission. (I'm already doing this 
> manually, without SQLFORM.process.)
>
> How can I alter the submitted values? Simply assigning "form.vars.my_field 
> = my_new_value", and then returning the form doesn't seem to work.
>
>

-- 
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/groups/opt_out.


[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Jaime Sempere
Damn... I forgot the 
link:  
https://groups.google.com/forum/#!searchin/web2py/prepopulate$20form/web2py/GF2sDS7uWi8/x8SVU09CFIoJ

El jueves, 23 de enero de 2014 02:07:19 UTC+1, Jaime Sempere escribió:
>
>
> I don't understand completely the flow of the process...  do you have two 
> submitt buttons, one for "autocomplete" and the other for "final submit?
>
> I am not very sure, but here are my thoughts: What I would do is use 
> SQLFORM.factory something like this:
>
> new_post_form = SQLFORM.factory(db.posts)
> if new_thread_form.process().accepted:
>  if (autocomplete):
>   Do your process, and save it in the form.vars
>  else: 
>   Do the final update using db().update()
>
>
>
>
> And check this topic too to return the prepolutaded form, keeping the 
> values that you processed after "if (autocomplete)"
>

-- 
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/groups/opt_out.


Re: [web2py] Re: error ('', 'SQL_INVALID_HANDLE') when DAL is mssq

2014-01-22 Thread Gianganh Nguyen
Oh, I'm sorry because now I'm checking mail.
I didn't get that error. But I use driver pyodbc-3.0.7.win32-py2.7.exe for
python2.7.5.
Are you using what is python's version?


On Fri, Jan 17, 2014 at 5:57 AM, Josh Myers wrote:

> I was also getting this same error and I thank Gianganh for his help in
> moving me along.
>
> Now, using the solution above, instead of getting the SQL_INVALID_HANDLE,
> I am getting the following:
>
> " ('HY000', 'The driver did not supply an error!')"
>
> Gianganh, did you also get this error?  Or, if you didn't, do you know how
> I can fix this?
>
>
> - Josh
>
>
>
>
> On Thursday, December 26, 2013 10:13:36 PM UTC-5, Gianganh Nguyen wrote:
>>
>> Hey,
>> I resolved this issue follow:
>> 1. Setup pyodbc-3.0.7.win32-py2.7.exe (download from
>> http://code.google.com/p/pyodbc/downloads/list)
>> 2. Insert to the db.py file:
>>
>>
>>
>>
>> *import pyodbc from gluon.dal import MSSQLAdapterif not
>> (MSSQLAdapter.driver):MSSQLAdapter.driver =
>> globals().get('pyodbc',None)*
>>
>> And everything is okay.
>>
>> Thanks!
>> *(^_^)*
>>
>> Vào 00:21:28 UTC+7 Thứ sáu, ngày 27 tháng mười hai năm 2013, Alan Etkin
>> đã viết:
>>>
>>> This error is produced when the controller files execute a query string,
 example db(db.usr).select() or db(db.usr).count(). It does not always occur
 but frequently occur!

>>>
>>> Have you checked /databases/sql.log?
>>>
>>> Maybe you can post the last commands stored for debugging.
>>>
>>>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/gaP-XmMhMg0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 

*GianganhnguyenCS - Soict - Hust - K52*
*Mobile: 0975814385*

-- 
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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
I started web2py from the source and I added the Graphviz to the PATH and 
now it works as a charm.

Thanks for the quick reply.

On Wednesday, January 22, 2014 4:29:47 PM UTC-5, Massimo Di Pierro wrote:
>
> Are you using the windows web2py binary? You need the source.
>
> On Wednesday, 22 January 2014 01:06:06 UTC-6, Bogdan Nechita wrote:
>>
>> Hi,
>>
>> When navigating to the Edit -> Graph Model on any web2py app, I get the 
>> error "pygraphviz library not found".
>> I have installed Graphviz (http://www.graphviz.org/Download_windows.php) 
>> and PyGraphviz (http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygraphviz) 
>> successfully but web2py doesn't seem to pick up on that and still 
>> returns the error above. 
>>
>> I uninstalled PyGraphviz and tried to install it using the steps detailed 
>> here (
>> https://groups.google.com/forum/#!topic/networkx-discuss/Xy1lWfMdB6U) 
>> and here (
>> http://blog.ropardo.ro/2011/11/28/installing-pygraphviz-on-windows/) but 
>> none of the two attempts were successful - couldn't actually compile 
>> pygraphviz.
>>
>> System: Windows 8
>> web2py: 2.8.2
>>
>> Any help is greatly appreciated. 
>>
>> Thanks,
>> Bogdan
>>
>

-- 
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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
Try starting web2py from the source code, as detailed 
here: http://web2py.com/books/default/chapter/29/04/the-core. 
I also added Graphviz (C:\Program Files (x86)\Graphviz2.36\bin) to the 
environment PATH, did a restart and now it works.

On Wednesday, January 22, 2014 6:59:05 PM UTC-5, 黄祥 wrote:
>
> same here, pygraphiz library not found, tested on windows 7 32 bit with 
> web2py_src and web2py_win
>
> 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/groups/opt_out.


[web2py] DAL definition when NOT deployed on localhost ? PythonAnywhere for example...

2014-01-22 Thread NeoToren
I have managed to deploy to *PythonAnywhere* (*PA*) the MySQL database in a 
matter of minutes!
Then I have re-created the Web2Py , uploaded and installed my application 
from the localhost - literally 5 minutes !!
The familiar Web2Py interface was ready like a charm...so the description 
of PA in the W2P book as the simplest solution was correct...
Life is good...All is great ...EXCEPT...

What should be the *DAL - database connection  definition* when *NOT* *on a 
localhost *?
The definitions from the local machine obviously need to change. So I have 
tried on PA in db.py:

db = DAL('mysql://
*username:mysqlpassw...@username.pythonanywhere.com/username$default'*)

*username* = the PA username (tried *root* - of course didn't  work)
*mysqlpassword* = the pwd for the mysql instance at PA
*username$default = * the database name which is equal to... *username$default 
*(tried *localhost* which didn't work)

The above doesn't work and W2P cannot connect to MySQL...
I must be doing something really stupid since I am a newbie with W2P and 
PA...
Any ideas ? 

-- 
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/groups/opt_out.


[web2py] Re: pygraphviz library not found

2014-01-22 Thread 黄祥
it's work now, i missed the environment path steps, thank you so much.

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/groups/opt_out.