Re: [web2py] Re: When will we have a proper forum ?

2015-08-06 Thread Limedrop
The first step would be to add it to the web2py roadmap :-)  I don't know 
enough about the code-base to comment on the implementation specifics.  
Would you see comment functionality being added to directly to the 
auth.wiki() code or developed as a separate app/plugin?


On Thursday, 6 August 2015 18:12:00 UTC+12, Massimo Di Pierro wrote:

 I very much agree with this. How do you propose we do it?

 On Wednesday, 5 August 2015 17:37:19 UTC-5, Limedrop wrote:

 I hesitate to comment on this as it's one of those topics were there's 
 not one obvious way to do it (obviously I'm not Dutch). Essentially, I 
 think google groups does an okay job and the benefits of any change are 
 likely to be outweighed by the heavy cost of that change.

 Having said that, I've always thought that we're missing a trick by not 
 integrating forum questions with the web2py book. Imagine having 
 medium.com-style side comments with the book, making it more of a living 
 document. Questions and answers would be right next to the relevant section 
 of the book, providing further explanation and reducing RTFM answers. I 
 guess you'd also add a better search facility, a stack-overflow style 
 'homepage' and possibly a slight re-structure of the book sections. Ask a 
 question and it gets tagged to a book section.  The book is already built 
 with auth.wiki() - so we would be adding to functionality/infrastructure 
 that has to be maintained anyway.

 We can always dream ;-)



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


[web2py] Problem with calling Field Methods after upgrading to 2.11.2 from 2.9.10

2015-08-06 Thread Umpei Kurokawa
I'm having problems after upgrading web2py to 2.11.2 from 2.9.10, that I 
wasn't getting before. 

The problem appears to happen when I make a select call with an inner join, 
and than trying to make calls to a Field Method associated with that table. 
I get this error: 

So for example I am doing something like : 

out = db((db.breed.id == 
db.dog.breed)).select().first() 


out.dog.do_something()

This will fail  with the below error

File 
/home/ukurokawa/Documents/web2py_2112/gluon/packages/dal/pydal/helpers/classes.py,
 
line 348, in __getattr__

raise AttributeError
AttributeError


-- 
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: Modifying web2py JS files -- best practices?

2015-08-06 Thread Jack Kuan
Often the starting point of making a web2py app is to copy the welcome app 
and base your repo on it.

But as you add/modify/delete files from your repo that's based on the 
welcome app to suit your need, you then face the problem of
merging updates to the welcome app back to your repo.

I did some googling and tests today, and found that using git subtree merge 
seems to provide a nice solution to this problem.
Here are the steps to create a new repo based on the welcome app:

1) Create an empty git repo:
mkdir myapp; cd myapp; git init

2) Add a file(e.g., .gitignore or README.md) as the first commit.
This first commit is required otherwise everything in web2py will be 
added later.

3) Add a web2py remote and fetch the repo
git remote add -f web2py https://github.com/web2py/web2py

4) Merge, using the 'ours' strategy, files from web2py's master branch into 
our master, squash all commits into 1 commit,
but don't commit, only create the tree object or something:

git merge --squash -s ours --no-commit web2py/master

5) Now add the above merge, taking only the applications/welcome tree, into 
index, under the root(/):

git read-tree --prefix=/ -u web2py/master:applications/welcome

NOTE: here I specified /, which makes everything being added directly under 
the root of the repo.
But you can use app/, for example, to add the files of the 
welcome app under a app/ directory of your repo instead.

6) git commit

Now you should have a repo that looks like the welcome app.
If later the welcome app is updated in web2py, here's how you can merge the 
changes to your repo:

git pull -s subtree -X subtree=applications/welcome web2py master


Hope this is useful
Jack

On Thursday, August 6, 2015 at 1:41:12 AM UTC-4, Joe Barnhart wrote:

 It seems more and more clear I'm going to be making changes to the 
 included web2py.js file.  I'm worried about keeping current when new 
 versions of web2py come out if I've mucked a lot with this javascript file.

 So what does everyone else do?  How do we customize the platform and still 
 keep current with its evolution?  Is there an accepted best practice in 
 this area?

 -- Joe



-- 
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: Problem with calling Field Methods after upgrading to 2.11.2 from 2.9.10

2015-08-06 Thread Massimo Di Pierro
what is out.dog.do_something()?
Is it an example of a VirtualMethod?

On Thursday, 6 August 2015 16:36:13 UTC-5, Umpei Kurokawa wrote:

 I'm having problems after upgrading web2py to 2.11.2 from 2.9.10, that I 
 wasn't getting before. 

 The problem appears to happen when I make a select call with an inner 
 join, and than trying to make calls to a Field Method associated with that 
 table. I get this error: 

 So for example I am doing something like : 

 out = db((db.breed.id == 
 db.dog.breed)).select().first()   
   

 out.dog.do_something()

 This will fail  with the below error

 File 
 /home/ukurokawa/Documents/web2py_2112/gluon/packages/dal/pydal/helpers/classes.py,
  
 line 348, in __getattr__

 raise AttributeError
 AttributeError



-- 
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: 127.0.0.1 and ip address are not interchangeable, and Port 80 Error

2015-08-06 Thread Dave S


On Thursday, August 6, 2015 at 8:23:30 PM UTC-7, Dave S wrote:



 On Thursday, August 6, 2015 at 7:57:27 PM UTC-7, Zhihong Zeng wrote:

 Hello,

 I just start using web2py, and get the following questions: 

 1) Based on my experience on apache, localhost, 127.0.0..1 and local ip 
 address obtained by ifconfig in linux are interchangeable. So I can use ip 
 address to visit my web page running in a remote computer in the same 
 network. 
 But when I run web2py, visiting localhost and 127.0.0.1 are successful 
 but not local ip address.


 This depends on how you start up web2py.

 I use 
 python web2py.py -i 0.0.0.0 -p 8000

 This accepts both local addresses (wget 127.0.0.1:8000/sample) and remote 
 access (wget 192.168.129.105:8000/sample).

 I use to use 
 python web2py.py -i 192.168.129.105 -p 8000
 and that worked if I used the remote address from the local machine, but 
 there were hiccups (IP lease expiration and admin access interactions) and 
 so I switched to the 0-0 form.


I think if you use 
python web2py.py -i 127.0.0.1 -p 8000
nobody can get in from outside.

 

 2) if I use 80 port on web2py server, I get error: Rocket.Error.Port80


 I'm not sure if Rocket excludes that port.  If it does not, then you may 
 have a conflict with another piece of code on your machines, or with a 
 general restriction on unprivileged users opening well-known ports.
  


 I would appreciate any answers to my questions.


 With luck, you'll get a good answer.  I hope mine helps.

 /dps
  


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


[web2py] Re: 127.0.0.1 and ip address are not interchangeable, and Port 80 Error

2015-08-06 Thread Dave S


On Thursday, August 6, 2015 at 7:57:27 PM UTC-7, Zhihong Zeng wrote:

 Hello,

 I just start using web2py, and get the following questions: 

 1) Based on my experience on apache, localhost, 127.0.0..1 and local ip 
 address obtained by ifconfig in linux are interchangeable. So I can use ip 
 address to visit my web page running in a remote computer in the same 
 network. 
 But when I run web2py, visiting localhost and 127.0.0.1 are successful but 
 not local ip address.


This depends on how you start up web2py.

I use 
python web2py.py -i 0.0.0.0 -p 8000

This accepts both local addresses (wget 127.0.0.1:8000/sample) and remote 
access (wget 192.168.129.105:8000/sample).

I use to use 
python web2py.py -i 192.168.129.105 -p 8000
and that worked if I used the remote address from the local machine, but 
there were hiccups (IP lease expiration and admin access interactions) and 
so I switched to the 0-0 form.
 

 2) if I use 80 port on web2py server, I get error: Rocket.Error.Port80


I'm not sure if Rocket excludes that port.  If it does not, then you may 
have a conflict with another piece of code on your machines, or with a 
general restriction on unprivileged users opening well-known ports.
 


 I would appreciate any answers to my questions.


With luck, you'll get a good answer.  I hope mine helps.

/dps
 

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


[web2py] 127.0.0.1 and ip address are not interchangeable, and Port 80 Error

2015-08-06 Thread Zhihong Zeng
Hello,

I just start using web2py, and get the following questions: 

1) Based on my experience on apache, localhost, 127.0.0..1 and local ip 
address obtained by ifconfig in linux are interchangeable. So I can use ip 
address to visit my web page running in a remote computer in the same 
network. 
But when I run web2py, visiting localhost and 127.0.0.1 are successful but 
not local ip address.

2) if I use 80 port on web2py server, I get error: Rocket.Error.Port80

I would appreciate any answers to my questions.

Zhihong

-- 
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] There appears to be a 1 GB limit to the size of a plugin on Windows

2015-08-06 Thread joseph simpson
Has anyone had issues with a plugin that is over 1 GB in size?

A 1.4 GB plugin works on the Mac and Linux but fails on Windows.

Any ideas on what might be the issue?

Take care and have fun,

Joe

-- 
Joe Simpson
“Reasonable people adapt themselves to the world. Unreasonable people
attempt to adapt the world to themselves. All progress, therefore, depends
on unreasonable people.”
George Bernard Shaw

-- 
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 share sessions between apps, having custom login and each app being served through a domain?

2015-08-06 Thread Lisandro
I have two web2py apps, and I want the user to log in in one app and keep 
logged in when accessing the second app. The apps are called *demo* and 
*demo_panel*.
Also I'm using a *custom login method* (that is, custom html with 
javascript and handling the controller/function). 
In addition, I'm *serving each app through a different domain* (using 
routes.py). This part works perfectly.

In this scenario, I'm having trouble to share the session between those two 
apps. Actually, I have partially achieved all this, except for one problem: 
*when 
the session expires accordingly to auth.settings.expiration, on Firefox I 
can't login anymore until I delete the cookies*.

So, I'll go for parts with what I have, and if someone sees something ugly 
or incorrect, I would be really appreciated to point it out :)


First, this is the section of the custom controller function that handles 
the login. 
It works ok on Firefox, Chrome, mobile, etc. Don't know if it's the correct 
way to do it, but it works for me:

# ... after received email and password by post vars and checked both are 
present
usuario = db(db.auth_user.email==request.post_vars.email).select().first()
if not usuario:
return response.json({'success':False, 'mensaje':'Email incorrecto'}
elif usuario.registration_key:
return response.json({'success':False, 'Registro pendiente de confirmar'
})
else:
usuario = auth.login_bare(request.post_vars.email, request.post_vars.
password)
if not usuario:
return response.json({'success':False, 'mensaje':'Datos de ingreso 
incorrectos'})
else:
session.auth.expiration = auth.settings.expiration
if request.post_vars.remember_me:
session.auth.expiration = auth.settings.long_expiration
session.auth.remember_me = True
response.cookies[response.session_id_name][expires] = session.
auth.expiration
return response.json({'success':True})


Accordingly to the book, in order to share sessions between apps, I do this 
on both app models/db.py:
#both apps connect to the same database
db = DAL(\
 'postgres://%s:%s@%s/%s' %(DB_USER, DB_PASSWORD, DB_HOST, DB_NAME), \
 folder = DATABASES_FOLDER) 

# and then connect to session
session.connect(request, response, db=db, masterapp='demo')


In addition, I'm *serving each app through a different domain* (using 
routes.py) so apps are served this way:
demo -- served by domain dev.demo
demo_panel -- served by domain panel.dev.demo

From this we can deduce that the browser will handle two cookies, one per 
domain (I've being inspecting cookies created with Firefox and Chrome, and 
its that way).
So, it wasn't enought with masterapp='demo'. *After loggin in in 
demo_panel, the sessiong wasn't shared when accesing demo app through 
dev.demo domain*.
I'm not sure about technical backgrounds of this, but I think it's correct, 
considering that each app is served through a different domain, so the 
browser handles that as that: different domains. 


However, I had partially resolved the problem, modifing models/db.py like 
this:

# connecting to session stays the same than before..
session.connect(request, response, db=db, masterapp='demo')

# and these new lines
if response.cookies.has_key(response.session_id_name):
response.cookies[response.session_id_name]['domain'] = 'dev.demo'


Ok, don't ask me why I added those lines, don't remember how I get there. 
But that got it working. I can login in panel.dev.demo domain (demo_panel 
app), and then I can go to dev.demo (demo app) and I'm still logged in.

The only problem is with Firefox when the session expires accordingly to 
auth.session.expire. 
After that, the first portion of code posted here (the one that handles the 
custom login) runs ok, no errors, returns success=True, but when the user 
is redirected to requested uri, is requeste to login again. That is, the 
user can't login anymore until I delete the browser cookies. This happens 
only on Firefox.

What could be the problem? Is something bad about my custom login? Or a bug 
handling sessions in firefox? 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: Error while importing from .csv file

2015-08-06 Thread Dave S


On Thursday, August 6, 2015 at 6:39:22 AM UTC-7, Sai Harsh Tondomker wrote:

 My db.py is 

 db.define_table(Questions,
   Field('quesno','integer',notnull=True,unique=True),
   Field('question', 'text'),
   Field('qupload','upload',label='Upload Image'),
   Field('optionA', 'string',label='optionA'),
   Field('optionB', 'string',label='optionB'),
   Field('optionC', 'string',label='optionC'),
   Field('optionD', 'string',label='optionD'),
   Field('answer', 'string'),
   )

 And error after uploading file is
 unable to parse csv file 
 UNIQUE constraint failed: Questions.quesno

 What I need to do for these.
 Please help me to solve the problem.
 Waiting for your response.


Does your CSV file have 2 (or more) entries with the same value in the 
quesno column?  If not, do the values match any that already in the DB?

/dps

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


[web2py] Re: gluon.contrib.populate didn't fill upload and password field type

2015-08-06 Thread Ben Lawrence
Hi,
Did you find out how to populate db.auth_user? I get
IntegrityError: FOREIGN KEY constraint failed


On Saturday, April 16, 2011 at 7:14:09 PM UTC-7, 黄祥 wrote:

 hi, 

 i've tested to using gluon.contrib.populate, but it seems that the 
 module didn't fill upload and password field type. 

 e.g. 

 from gluon.contrib.populate import populate 
 if not db(db.auth_user).count(): 
  populate(db.auth_user,10) 

 any other solutions to put dummy data for test and dev purpose for 
 upload and password field type? 

 thank you so much and best regards, 

 steve van christie

-- 
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 to many relationship

2015-08-06 Thread Yebach
Hello

How to solve the problem of one to many relationship:

Lets say I have a worker that has multiple skills. How to set up SQLFORM to 
add as many skills to the worker as possible.

So skills in one table workers in another.I guess a third table will be 
needed

Thank you

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: When will we have a proper forum ?

2015-08-06 Thread Massimo Di Pierro
I very much agree with this. How do you propose we do it?

On Wednesday, 5 August 2015 17:37:19 UTC-5, Limedrop wrote:

 I hesitate to comment on this as it's one of those topics were there's not 
 one obvious way to do it (obviously I'm not Dutch). Essentially, I think 
 google groups does an okay job and the benefits of any change are likely to 
 be outweighed by the heavy cost of that change.

 Having said that, I've always thought that we're missing a trick by not 
 integrating forum questions with the web2py book. Imagine having 
 medium.com-style side comments with the book, making it more of a living 
 document. Questions and answers would be right next to the relevant section 
 of the book, providing further explanation and reducing RTFM answers. I 
 guess you'd also add a better search facility, a stack-overflow style 
 'homepage' and possibly a slight re-structure of the book sections. Ask a 
 question and it gets tagged to a book section.  The book is already built 
 with auth.wiki() - so we would be adding to functionality/infrastructure 
 that has to be maintained anyway.

 We can always dream ;-)



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


[web2py] Re: postgresql json getitem function implementation

2015-08-06 Thread Massimo Di Pierro
Let's bring this up on web2py developers. I will support it. Can you submit 
a patch to pydal?

On Wednesday, 5 August 2015 17:15:54 UTC-5, Manuele wrote:

 Hi! 
 I have a table with a json field and I woul like to perform something 
 like: 

 db(db.mytable.id0).select(db.mytable.myjsonfield.getitem('myfield').with_alias(myfield))
  


 the only way I thought is the patch in attachment that works just fine 
 but I don't like to use a patched version of the framework. 
 Is these a way to monkeypath the two classes PostgreSQLAdapter and 
 Expression (I guess before the db definition) in my application? 

 On the other hand... do you think it could be a usefull implementation 
 for web2py itself? 

 Thanks a lot 

 Manuele 


-- 
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: Modifying web2py JS files -- best practices?

2015-08-06 Thread Niphlod
in addition to what mdpierro said, I'd argue that the best solution is 
overriding, which can be done with the recent web2py.js versions. If a new 
version comes out, you'd need to review the changed functionality and 
update the custom overrides accordingly.
We do this 
already 
https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py-bootstrap3.js

On Thursday, August 6, 2015 at 8:13:58 AM UTC+2, Massimo Di Pierro wrote:

 Why do you need to change web2py.js? I have nothing against. I just would 
 like to understand if there is something we can do to make it more general.

 On Thursday, 6 August 2015 00:41:12 UTC-5, Joe Barnhart wrote:

 It seems more and more clear I'm going to be making changes to the 
 included web2py.js file.  I'm worried about keeping current when new 
 versions of web2py come out if I've mucked a lot with this javascript file.

 So what does everyone else do?  How do we customize the platform and 
 still keep current with its evolution?  Is there an accepted best 
 practice in this area?

 -- Joe



-- 
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: Custom e-mail verification page that's not the default, from mobile mail app.

2015-08-06 Thread Jon M.
Woah!!! :D

Thanks, thanks, thanks!

So, at db.py I ended using one of these:

#auth.settings.verify_email_next = 
('http://domain/proyect_name/default/account_confirmation')
auth.settings.verify_email_next = URL ('default', args=
'account_confirmation')

Both work, fully working... When tapping the URL at GMail app at mobile 
device and selecting a browser, it really does redirect to the stablished 
page.

Does the referrer has something to do in with the hop from app to browser 
for the displaying of the login view web page instead of the custom one?

¡Buena vibra! :3

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


[web2py] Re: Custom e-mail verification page that's not the default, from mobile mail app.

2015-08-06 Thread Leonel Câmara
You can just put the URL you want instead of the login url in 
auth.settings.verify_email_next

-- 
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: Custom e-mail verification page that's not the default, from mobile mail app.

2015-08-06 Thread Leonel Câmara
No it's not because of the referrer it's 
because auth.settings.verify_email_next default value **is** the login URL.

-- 
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: Module is behaving different in web2py

2015-08-06 Thread David
I think it is something with pymssql, I can get pyodbc to work correctly. I 
guess I will just have to rewrite some of the module to use this. 

David

On Thursday, August 6, 2015 at 11:35:30 AM UTC-4, Anthony wrote:

 I'm not sure either. Maybe someone with pymssql experience can help.

 On Thursday, August 6, 2015 at 11:27:51 AM UTC-4, David wrote:


 I went and double checked on a local install of web2py and I am getting 
 the same result. I also logged into the web server and ran a python script 
 to test as the web server user and I do get the expected results from the 
 database.

 I am still confused at what could be causing this. 



 On Wednesday, August 5, 2015 at 9:36:11 PM UTC-4, David wrote:

 Running it from the web2py shell by importing the pymssql is returning 
 no results. I am not getting an error I just get: 

 In [10] : rows = cursor.execute(SELECT * FROM PERSON WHERE 
 PERSON.LAST_NAME = 'Palmer')

 In [11] : print len(rows)
 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/contrib/shell.py, line 234, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
 TypeError: object of type 'NoneType' has no len()


 As I continued to dig into it I have noticed that when pymssql is being 
 called from web2py nothing is hitting the freetds log. However executing 
 from the shell does. 




 On Wednesday, August 5, 2015 at 5:12:19 PM UTC-4, Anthony wrote:

 Can you go into a web2py shell and do some basic things, like import 
 pymssql, establish a connection, and issue a basic SQL command?

 Also, shouldn't you close the connection (i.e., call DestroyConnection) 
 *before* returning from the function?

 Anthony

 On Wednesday, August 5, 2015 at 4:55:14 PM UTC-4, David wrote:


 I like that idea about the __init__ function and will implement that 
 Thanks!!!

 I don't get any errors. I am just getting None returned in both the 
 controller and shell even when hard codeing a SamAccountName that works 
 within the Python shell. 
  

 On Wednesday, August 5, 2015 at 4:48:03 PM UTC-4, Anthony wrote:

 How are you using this in web2py (i.e., where/how does 
 get_GetEmployeeID get called)? Do you get any errors? When you run the 
 web2py shell, how are you starting it, and are you using the same Python 
 interpreter as when you use the basic Python shell?

 Also, is the only difference between your two classes the hard-coded 
 database connection string? If so, why not using a single class and just 
 make the connection string an argument of the __init__ function?

 Anthony

 On Wednesday, August 5, 2015 at 4:17:04 PM UTC-4, David wrote:

 Here is the first part of the module I was reffering to:

 import pymssql


 class HR_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement,*args):
 cursor = self.conn.cursor()
 cursor.execute(statement, args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 class Coll_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement, *args):
 cursor = self.conn.cursor()
 cursor.execute(statement,args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 def get_GetEmployeeID(SamAccountName):

 conn = Coll_DB()
 rows = conn.Execute(SQL Removed)
 if len(rows)  0:
 return(rows[0]['collid'])
 conn.DestroyConnection()




 Again this works just fine calling it outside of web2py.

 if I run it from the interpreter on the server I am getting the 
 correct id number. Even using the shell in web2py and issuing the same 
 commands I am getting nothing. I feel like I am missing something simple



-- 
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] How to insert data using .csv or .xml file

2015-08-06 Thread Sai Harsh Tondomker
I have did same thing which you have shown me in video it show the error
message
unable to parse csv file
UNIQUE constraint failed: Questions.quesno

What I need to do for these.
Please help me to solve the problem.
Waiting for your response.

On Tue, Aug 4, 2015 at 9:31 AM, Sai Harsh Tondomker saiharsh@iiits.in
wrote:

 Thanks a lot man that video is very helpful.
 Could you do last favor, I want to add more question types for now it's
 only multiple options.
 Could you say how can I ass true or false type ? Like if answer is true or
 false display true/ false type else multiple answer type question.

 On Mon, Aug 3, 2015 at 11:39 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you must deletenotnull=True,unique=True.

 2015-08-03 10:32 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 How it will store the data. We need to give pattern to csv file right.
 Please could you give one csv file for my data base

 On Mon, Aug 3, 2015 at 12:16 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you can also import csv file with code. but i have not try it.


 2015-08-03 8:55 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 No need to write code to store in db.

 On Mon, Aug 3, 2015 at 11:07 AM, Selman Kocael selciu...@gmail.com
 wrote:

 simple way:

 in http://127.0.0.1:8000/[your-app-name]/appadmin/select/db?query=db.
 Questions.id%3E0 page:
 browse your csv file and click import csv button.


 if an error displayed, you must edit yoru csv file.

 2015-08-03 8:28 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in
 :

 Here is my db.py
 db.define_table(Questions,
   Field('quesno','integer',notnull=True,unique=True),
   Field('question', 'text'),
   Field('qupload','upload',label='Upload Image'),
   Field('optionA', 'string'),
   Field('optionB', 'string'),
   Field('optionC', 'string'),
   Field('optionD', 'string'),
   Field('True1', 'string'),
   Field('False0', 'string'),
   Field('answer', 'string'),
   )

 Were and how to right the code to store data from .csv or .xml in
 data base I am struggling for it please help me to solve 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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 

Re: [web2py] How to insert data using .csv or .xml file

2015-08-06 Thread Selman Kocael
1. delete notnull=True,unique=True in models.
2. in shell write: db.Questions.drop() and enter.
3. import csv file.

2015-08-06 16:21 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 I have did same thing which you have shown me in video it show the error
 message
 unable to parse csv file
 UNIQUE constraint failed: Questions.quesno

 What I need to do for these.
 Please help me to solve the problem.
 Waiting for your response.

 On Tue, Aug 4, 2015 at 9:31 AM, Sai Harsh Tondomker saiharsh@iiits.in
  wrote:

 Thanks a lot man that video is very helpful.
 Could you do last favor, I want to add more question types for now it's
 only multiple options.
 Could you say how can I ass true or false type ? Like if answer is true
 or false display true/ false type else multiple answer type question.

 On Mon, Aug 3, 2015 at 11:39 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you must deletenotnull=True,unique=True.

 2015-08-03 10:32 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 How it will store the data. We need to give pattern to csv file right.
 Please could you give one csv file for my data base

 On Mon, Aug 3, 2015 at 12:16 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you can also import csv file with code. but i have not try it.


 2015-08-03 8:55 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 No need to write code to store in db.

 On Mon, Aug 3, 2015 at 11:07 AM, Selman Kocael selciu...@gmail.com
 wrote:

 simple way:

 in http://127.0.0.1:8000/[your-app-name]/appadmin/select/db?query=db
 .Questions.id%3E0 page:
 browse your csv file and click import csv button.


 if an error displayed, you must edit yoru csv file.

 2015-08-03 8:28 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in
 :

 Here is my db.py
 db.define_table(Questions,
   Field('quesno','integer',notnull=True,unique=True),
   Field('question', 'text'),
   Field('qupload','upload',label='Upload Image'),
   Field('optionA', 'string'),
   Field('optionB', 'string'),
   Field('optionC', 'string'),
   Field('optionD', 'string'),
   Field('True1', 'string'),
   Field('False0', 'string'),
   Field('answer', 'string'),
   )

 Were and how to right the code to store data from .csv or .xml in
 data base I am struggling for it please help me to solve 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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet 

[web2py] Update session expiration after login

2015-08-06 Thread Eric
Hi,

How can I change the session expiration length after someone has loggedin? 
I've found the setting auth.settings.expiration, but that only works when I 
place it in the db.py (or somewhere before I call the (bare)login 
function). Trouble is that I only know the rights of the user after login, 
so I can only update the session length after login. The reason why I want 
to change it session length? Users with specific rights that are coming 
from a 'safe' (IP) location are allowed to have longer session length than 
the 'unsafe' user.

The only way that I've found to get this task done is by manipulating 
the expiration the session_data blob / pickle right after the user was 
loggedin... This works, but seems to me that it's not very Web2Py like ;)

Is there another way to change it? Or is this the right (or best) way to do 
it?

Thanks for the reaction!

-- 
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] How to insert data using .csv or .xml file

2015-08-06 Thread Selman Kocael
no.

i don't know its reason, if you edit a table (ie. to delete a validator),
it doesn't edit table in sqlite. you must delete the table for one time.

2015-08-06 16:49 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 It's working do I need to do every time db.Questions.drop() in shell
 

 On Thu, Aug 6, 2015 at 7:16 PM, Selman Kocael selciu...@gmail.com wrote:

 1. delete notnull=True,unique=True in models.
 2. in shell write: db.Questions.drop() and enter.
 3. import csv file.

 2015-08-06 16:21 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 I have did same thing which you have shown me in video it show the error
 message
 unable to parse csv file
 UNIQUE constraint failed: Questions.quesno

 What I need to do for these.
 Please help me to solve the problem.
 Waiting for your response.

 On Tue, Aug 4, 2015 at 9:31 AM, Sai Harsh Tondomker 
 saiharsh@iiits.in wrote:

 Thanks a lot man that video is very helpful.
 Could you do last favor, I want to add more question types for now it's
 only multiple options.
 Could you say how can I ass true or false type ? Like if answer is true
 or false display true/ false type else multiple answer type question.

 On Mon, Aug 3, 2015 at 11:39 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you must deletenotnull=True,unique=True.

 2015-08-03 10:32 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in
 :

 How it will store the data. We need to give pattern to csv file right.
 Please could you give one csv file for my data base

 On Mon, Aug 3, 2015 at 12:16 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you can also import csv file with code. but i have not try it.


 2015-08-03 8:55 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in
 :

 No need to write code to store in db.

 On Mon, Aug 3, 2015 at 11:07 AM, Selman Kocael selciu...@gmail.com
  wrote:

 simple way:

 in
 http://127.0.0.1:8000/[your-app-name]/appadmin/select/db?query=db.
 Questions.id%3E0 page:
 browse your csv file and click import csv button.


 if an error displayed, you must edit yoru csv file.

 2015-08-03 8:28 GMT+03:00 Sai Harsh Tondomker 
 saiharsh@iiits.in:

 Here is my db.py
 db.define_table(Questions,
   Field('quesno','integer',notnull=True,unique=True),
   Field('question', 'text'),
   Field('qupload','upload',label='Upload Image'),
   Field('optionA', 'string'),
   Field('optionB', 'string'),
   Field('optionC', 'string'),
   Field('optionD', 'string'),
   Field('True1', 'string'),
   Field('False0', 'string'),
   Field('answer', 'string'),
   )

 Were and how to right the code to store data from .csv or .xml in
 data base I am struggling for it please help me to solve 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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/d/optout.


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

[web2py] Error while importing from .csv file

2015-08-06 Thread Sai Harsh Tondomker
My db.py is 

db.define_table(Questions,
  Field('quesno','integer',notnull=True,unique=True),
  Field('question', 'text'),
  Field('qupload','upload',label='Upload Image'),
  Field('optionA', 'string',label='optionA'),
  Field('optionB', 'string',label='optionB'),
  Field('optionC', 'string',label='optionC'),
  Field('optionD', 'string',label='optionD'),
  Field('answer', 'string'),
  )

And error after uploading file is
unable to parse csv file 
UNIQUE constraint failed: Questions.quesno

What I need to do for these.
Please help me to solve the problem.
Waiting for your response.

-- 
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] How to insert data using .csv or .xml file

2015-08-06 Thread Sai Harsh Tondomker
It's working do I need to do every time db.Questions.drop() in shell


On Thu, Aug 6, 2015 at 7:16 PM, Selman Kocael selciu...@gmail.com wrote:

 1. delete notnull=True,unique=True in models.
 2. in shell write: db.Questions.drop() and enter.
 3. import csv file.

 2015-08-06 16:21 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 I have did same thing which you have shown me in video it show the error
 message
 unable to parse csv file
 UNIQUE constraint failed: Questions.quesno

 What I need to do for these.
 Please help me to solve the problem.
 Waiting for your response.

 On Tue, Aug 4, 2015 at 9:31 AM, Sai Harsh Tondomker 
 saiharsh@iiits.in wrote:

 Thanks a lot man that video is very helpful.
 Could you do last favor, I want to add more question types for now it's
 only multiple options.
 Could you say how can I ass true or false type ? Like if answer is true
 or false display true/ false type else multiple answer type question.

 On Mon, Aug 3, 2015 at 11:39 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you must deletenotnull=True,unique=True.

 2015-08-03 10:32 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in:

 How it will store the data. We need to give pattern to csv file right.
 Please could you give one csv file for my data base

 On Mon, Aug 3, 2015 at 12:16 PM, Selman Kocael selciu...@gmail.com
 wrote:

 you can also import csv file with code. but i have not try it.


 2015-08-03 8:55 GMT+03:00 Sai Harsh Tondomker saiharsh@iiits.in
 :

 No need to write code to store in db.

 On Mon, Aug 3, 2015 at 11:07 AM, Selman Kocael selciu...@gmail.com
 wrote:

 simple way:

 in
 http://127.0.0.1:8000/[your-app-name]/appadmin/select/db?query=db.
 Questions.id%3E0 page:
 browse your csv file and click import csv button.


 if an error displayed, you must edit yoru csv file.

 2015-08-03 8:28 GMT+03:00 Sai Harsh Tondomker 
 saiharsh@iiits.in:

 Here is my db.py
 db.define_table(Questions,
   Field('quesno','integer',notnull=True,unique=True),
   Field('question', 'text'),
   Field('qupload','upload',label='Upload Image'),
   Field('optionA', 'string'),
   Field('optionB', 'string'),
   Field('optionC', 'string'),
   Field('optionD', 'string'),
   Field('True1', 'string'),
   Field('False0', 'string'),
   Field('answer', 'string'),
   )

 Were and how to right the code to store data from .csv or .xml in
 data base I am struggling for it please help me to solve 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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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.




 --
 Selman Kocael
 İsabet Yayınları

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in
 the Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/d38qTLOsOnE/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/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 

OT pulling request on github (was Re: [web2py] Re: postgresql json getitem function implementation)

2015-08-06 Thread Manuele
Hi!
It seams my pull request did not pass one check...
https://codecov.io/github/web2py/pydal/commit/009bf14b12079738b81a7a9bd8f970792c4fad09

but I don't understand what's the meaning of this... how can I better 
adjust my code in order to pass the check?

Thanks a lot

Manuele

Il giorno giovedì 6 agosto 2015 10:37:45 UTC+2, Manuele ha scritto:

 Il 06/08/15 08:11, Massimo Di Pierro ha scritto: 
  Let's bring this up on web2py developers. I will support it. Can you 
  submit a patch to pydal? 
 Hi Massimo! 
 Thanks for your replay... I'm glad to contribute... Here you can find my 
 pull request in order it can be properly discussed 

 https://github.com/web2py/pydal/pull/264 

 I've modified a little bit the code from the previous patch in order to 
 support getting values from nested object with the same function. 

 Anyway it woul be usefull to know how to patch DAL object in a single 
 application... any suggestion about it? 

 Best regards 

 Manuele 


-- 
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 set (increase) Content-Length parameter for application Response

2015-08-06 Thread Alehandro Ramoz Rodrigez
I have application with two pages: both linked to own shared folder on my 
hard disk:
Controllers:
def first_page():
return dict(files=Expose('/home/user/Desktop/Binary_to_send'))
def second_page():
return dict(files=Expose('/home/user/Desktop/Configuration_to_send'))
Views:
{{=files}}
When I send POST request to remote server it try to use  
*http://localhost:8000/myApp/default/first_page* to download binary file
and then * http://localhost:8000/myApp/default/second_page* to download 
config file, but it get only 1 byte of data from first downloaded file and 
3 bytes from second...
How should I edit Controller to be able to response with full range of data?
 

-- 
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: Modifying web2py JS files -- best practices?

2015-08-06 Thread Massimo Di Pierro
Why do you need to change web2py.js? I have nothing against. I just would 
like to understand if there is something we can do to make it more general.

On Thursday, 6 August 2015 00:41:12 UTC-5, Joe Barnhart wrote:

 It seems more and more clear I'm going to be making changes to the 
 included web2py.js file.  I'm worried about keeping current when new 
 versions of web2py come out if I've mucked a lot with this javascript file.

 So what does everyone else do?  How do we customize the platform and still 
 keep current with its evolution?  Is there an accepted best practice in 
 this area?

 -- Joe



-- 
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 set Content-type:application/json for all subpages

2015-08-06 Thread Alehandro Ramoz Rodrigez
No, they haven't extensions, but they contain data in json format

-- 
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: When will we have a proper forum ?

2015-08-06 Thread Iuri Guilherme dos Santos Martins
The only proper way to use googlegroups with e-mail is to check the webmail
of gmail.

Because of the top posting and the just reply with all the old junk
behaviour, googlegroups via e-mail is rendered useless (in the sense that
it is too bloated to be worth the effort) to use with anything but a gmail
account.

-- 
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: postgresql json getitem function implementation

2015-08-06 Thread Manuele Pesenti
Il 06/08/15 08:11, Massimo Di Pierro ha scritto:
 Let's bring this up on web2py developers. I will support it. Can you
 submit a patch to pydal?
Hi Massimo!
Thanks for your replay... I'm glad to contribute... Here you can find my
pull request in order it can be properly discussed

https://github.com/web2py/pydal/pull/264

I've modified a little bit the code from the previous patch in order to
support getting values from nested object with the same function.

first problem:
It seams my pull request did not pass one check...
https://codecov.io/github/web2py/pydal/commit/009bf14b12079738b81a7a9bd8f970792c4fad09
I don't understand what does it mean... can somebody help me to better
adjust my code in order to pass the check?

second problem:
as @Niphold suggested me it would be necessary some test... can somebody
point me to some test example of similar mehods?

Thanks a lot

Manuele



 On Wednesday, 5 August 2015 17:15:54 UTC-5, Manuele wrote:

 Hi!
 I have a table with a json field and I woul like to perform
 something like:

 db(db.mytable.id
 
 http://db.mytable.id0).select(db.mytable.myjsonfield.getitem('myfield').with_alias(myfield))


 the only way I thought is the patch in attachment that works just
 fine
 but I don't like to use a patched version of the framework.
 Is these a way to monkeypath the two classes PostgreSQLAdapter and
 Expression (I guess before the db definition) in my application?

 On the other hand... do you think it could be a usefull
 implementation
 for web2py itself?

 Thanks a lot

 Manuele

 -- 
 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
 mailto: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] How to set Content-type:application/json for all subpages

2015-08-06 Thread Alehandro Ramoz Rodrigez
I have a page *http://localhost:8000/myApp/files* that can contain links to 
attached files so if to press on link or to request 
*http://localhost:8000/myApp/files/file_1, 
*
*http://localhost:8000/myApp/files/file_2*... file content will be 
displayed. 
Code for 'files' page Controller is:
def files():
response.headers['Content-Type'] = 'application/json'
return dict(files=Expose('.../Desktop/Files'))
If to send get request to page files then in respond I will get 
*Content-type: 
application/json*, but if to call 'files/file_1', then I will get  
*Content-type*:* text/plain* which is not what I need.
I want to know how to set response.headers not for main page 'files' but 
for all possible subpages (for files, that can be attached/placed in shared 
folder)?
Can someone help me with this issue? Thank you in advance.

P.S. File names and so names of subpages can be various, so I can not 
create separate page for each file...

 

-- 
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: Update session expiration after login

2015-08-06 Thread Anthony
Login details are stored in session.auth, including the expiration in 
session.auth.expiration. So, you could do something like:

def after_login(form):
if 'special_group' in auth.user_groups.values():
session.auth.expiration = 60 * 60 * 24

auth.settings.login_onaccept.append(after_login)

Anthony

On Thursday, August 6, 2015 at 10:04:49 AM UTC-4, Eric wrote:

 Hi,

 How can I change the session expiration length after someone has loggedin? 
 I've found the setting auth.settings.expiration, but that only works when I 
 place it in the db.py (or somewhere before I call the (bare)login 
 function). Trouble is that I only know the rights of the user after login, 
 so I can only update the session length after login. The reason why I want 
 to change it session length? Users with specific rights that are coming 
 from a 'safe' (IP) location are allowed to have longer session length than 
 the 'unsafe' user.

 The only way that I've found to get this task done is by manipulating 
 the expiration the session_data blob / pickle right after the user was 
 loggedin... This works, but seems to me that it's not very Web2Py like ;)

 Is there another way to change it? Or is this the right (or best) way to 
 do it?

 Thanks for the reaction!



-- 
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 set Content-type:application/json for all subpages

2015-08-06 Thread Anthony
Expose sets the content-type based on the file extension and defaults to 
text/plain if there is no extension. Do your filenames have extensions?

On Thursday, August 6, 2015 at 10:49:37 AM UTC-4, Alehandro Ramoz Rodrigez 
wrote:

 I have a page *http://localhost:8000/myApp/files 
 http://localhost:8000/myApp/files* that can contain links to attached 
 files so if to press on link or to request 
 *http://localhost:8000/myApp/files/file_1 
 http://localhost:8000/myApp/files/file_1, *
 *http://localhost:8000/myApp/files/file_2 
 http://localhost:8000/myApp/files/file_2*... file content will be 
 displayed. 
 Code for 'files' page Controller is:
 def files():
 response.headers['Content-Type'] = 'application/json'
 return dict(files=Expose('.../Desktop/Files'))
 If to send get request to page files then in respond I will get 
 *Content-type: 
 application/json*, but if to call 'files/file_1', then I will get  
 *Content-type*:* text/plain* which is not what I need.
 I want to know how to set response.headers not for main page 'files' but 
 for all possible subpages (for files, that can be attached/placed in shared 
 folder)?
 Can someone help me with this issue? Thank you in advance.

 P.S. File names and so names of subpages can be various, so I can not 
 create separate page for each file...

  


-- 
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: The mobile device error

2015-08-06 Thread forumweb2py


Am Mittwoch, 5. August 2015 01:51:06 UTC+2 schrieb forum...@gmail.com:

 he Group,

 i creat different Projectts with we2py. But last time i see, that all 
 Project works fine only with DesktopPc.If i call the project from 
 a mobile device a get an error:
 exceptions.IndexError list index out of range

 I understand, that web2py will render the Project if a mobile device
 is dedected. Therefore i use the plugin Jqmoble but i can not
 solv the problem. 


OK, thats the ticketFile. Maybe its better to use a MobileIndex.html ? 
Hm... 

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


Error-File.c0dbdb4-5bdb-4d91-a081-e7817058816a
Description: Binary data


[web2py] Custom e-mail verification page that's not the default, from mobile mail app.

2015-08-06 Thread Jon M.
Hi All! :D

I thought the way done was fine, and it might be, because I could send a 
slightly different verification link to the user registered. If you're 
checking the e-mail in web browser, PC or Mobile, but in the browser, the 
link will do it's job and present a custom web page telling that the 
registratin is succesful.

But, if you're checking it at an application, such as GMail as it comes in 
Android handheld devices, you certainly can tap the link and have access to 
the browser... The issue is, that the page stablished that works with 
browser verification, is not showing if verifying it having access to the 
link from the mail app. It does indeed register the user, accept the hash, 
and stuff, but the web page is the login screen... And I don't want that 
web page showing up at the verification in the mail account at the Mail 
Application. Matters of UX, the registration is done via Android and HTTP 
request. We implement e-mail verification, and want to display a custom 
view web page that tells the user the succesfull transaction.

Thanks a lot!!! Buena vibra!

Yours, sincerely Jon M.

-- 
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: postgresql json getitem function implementation

2015-08-06 Thread Manuele Pesenti
Il 06/08/15 08:11, Massimo Di Pierro ha scritto:
 Let's bring this up on web2py developers. I will support it. Can you
 submit a patch to pydal?
Hi Massimo!
Thanks for your replay... I'm glad to contribute... Here you can find my
pull request in order it can be properly discussed

https://github.com/web2py/pydal/pull/264

I've modified a little bit the code from the previous patch in order to
support getting values from nested object with the same function.

Anyway it woul be usefull to know how to patch DAL object in a single
application... any suggestion about it?

Best regards

Manuele

-- 
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: Module is behaving different in web2py

2015-08-06 Thread David

I went and double checked on a local install of web2py and I am getting the 
same result. I also logged into the web server and ran a python script to 
test as the web server user and I do get the expected results from the 
database.

I am still confused at what could be causing this. 



On Wednesday, August 5, 2015 at 9:36:11 PM UTC-4, David wrote:

 Running it from the web2py shell by importing the pymssql is returning no 
 results. I am not getting an error I just get: 

 In [10] : rows = cursor.execute(SELECT * FROM PERSON WHERE 
 PERSON.LAST_NAME = 'Palmer')

 In [11] : print len(rows)
 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/contrib/shell.py, line 234, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
 TypeError: object of type 'NoneType' has no len()


 As I continued to dig into it I have noticed that when pymssql is being 
 called from web2py nothing is hitting the freetds log. However executing 
 from the shell does. 




 On Wednesday, August 5, 2015 at 5:12:19 PM UTC-4, Anthony wrote:

 Can you go into a web2py shell and do some basic things, like import 
 pymssql, establish a connection, and issue a basic SQL command?

 Also, shouldn't you close the connection (i.e., call DestroyConnection) 
 *before* returning from the function?

 Anthony

 On Wednesday, August 5, 2015 at 4:55:14 PM UTC-4, David wrote:


 I like that idea about the __init__ function and will implement that 
 Thanks!!!

 I don't get any errors. I am just getting None returned in both the 
 controller and shell even when hard codeing a SamAccountName that works 
 within the Python shell. 
  

 On Wednesday, August 5, 2015 at 4:48:03 PM UTC-4, Anthony wrote:

 How are you using this in web2py (i.e., where/how does 
 get_GetEmployeeID get called)? Do you get any errors? When you run the 
 web2py shell, how are you starting it, and are you using the same Python 
 interpreter as when you use the basic Python shell?

 Also, is the only difference between your two classes the hard-coded 
 database connection string? If so, why not using a single class and just 
 make the connection string an argument of the __init__ function?

 Anthony

 On Wednesday, August 5, 2015 at 4:17:04 PM UTC-4, David wrote:

 Here is the first part of the module I was reffering to:

 import pymssql


 class HR_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement,*args):
 cursor = self.conn.cursor()
 cursor.execute(statement, args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 class Coll_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement, *args):
 cursor = self.conn.cursor()
 cursor.execute(statement,args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 def get_GetEmployeeID(SamAccountName):

 conn = Coll_DB()
 rows = conn.Execute(SQL Removed)
 if len(rows)  0:
 return(rows[0]['collid'])
 conn.DestroyConnection()




 Again this works just fine calling it outside of web2py.

 if I run it from the interpreter on the server I am getting the 
 correct id number. Even using the shell in web2py and issuing the same 
 commands I am getting nothing. I feel like I am missing something simple



-- 
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 set Content-type:application/json for all subpages

2015-08-06 Thread Anthony
Maybe try this:

def files():
response.headers['Content-Type'] = 'application/json'
try:
files = Expose('.../Desktop/Files')
except HTTP as http_response:
if http_response.status == 200:
http_response.headers['Content-Type'] = 'application/json'
raise http_response
return dict(files=files)

Anthony

On Thursday, August 6, 2015 at 11:14:41 AM UTC-4, Alehandro Ramoz Rodrigez 
wrote:

 No, they haven't extensions, but they contain data in json format
 Is there any way do change defaults settings?


-- 
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: Module is behaving different in web2py

2015-08-06 Thread Anthony
I'm not sure either. Maybe someone with pymssql experience can help.

On Thursday, August 6, 2015 at 11:27:51 AM UTC-4, David wrote:


 I went and double checked on a local install of web2py and I am getting 
 the same result. I also logged into the web server and ran a python script 
 to test as the web server user and I do get the expected results from the 
 database.

 I am still confused at what could be causing this. 



 On Wednesday, August 5, 2015 at 9:36:11 PM UTC-4, David wrote:

 Running it from the web2py shell by importing the pymssql is returning no 
 results. I am not getting an error I just get: 

 In [10] : rows = cursor.execute(SELECT * FROM PERSON WHERE 
 PERSON.LAST_NAME = 'Palmer')

 In [11] : print len(rows)
 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/contrib/shell.py, line 234, in run
 exec compiled in statement_module.__dict__
   File string, line 1, in module
 TypeError: object of type 'NoneType' has no len()


 As I continued to dig into it I have noticed that when pymssql is being 
 called from web2py nothing is hitting the freetds log. However executing 
 from the shell does. 




 On Wednesday, August 5, 2015 at 5:12:19 PM UTC-4, Anthony wrote:

 Can you go into a web2py shell and do some basic things, like import 
 pymssql, establish a connection, and issue a basic SQL command?

 Also, shouldn't you close the connection (i.e., call DestroyConnection) 
 *before* returning from the function?

 Anthony

 On Wednesday, August 5, 2015 at 4:55:14 PM UTC-4, David wrote:


 I like that idea about the __init__ function and will implement that 
 Thanks!!!

 I don't get any errors. I am just getting None returned in both the 
 controller and shell even when hard codeing a SamAccountName that works 
 within the Python shell. 
  

 On Wednesday, August 5, 2015 at 4:48:03 PM UTC-4, Anthony wrote:

 How are you using this in web2py (i.e., where/how does 
 get_GetEmployeeID get called)? Do you get any errors? When you run the 
 web2py shell, how are you starting it, and are you using the same Python 
 interpreter as when you use the basic Python shell?

 Also, is the only difference between your two classes the hard-coded 
 database connection string? If so, why not using a single class and just 
 make the connection string an argument of the __init__ function?

 Anthony

 On Wednesday, August 5, 2015 at 4:17:04 PM UTC-4, David wrote:

 Here is the first part of the module I was reffering to:

 import pymssql


 class HR_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement,*args):
 cursor = self.conn.cursor()
 cursor.execute(statement, args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 class Coll_DB():
 def __init__(self):
 self.conn = pymssql.connect(DB Connection Info Removed)

 def Execute(self, statement, *args):
 cursor = self.conn.cursor()
 cursor.execute(statement,args)
 result = cursor.fetchall()
 cursor.close()
 return result

 def DestroyConnection(self):
 self.conn.close()

 def get_GetEmployeeID(SamAccountName):

 conn = Coll_DB()
 rows = conn.Execute(SQL Removed)
 if len(rows)  0:
 return(rows[0]['collid'])
 conn.DestroyConnection()




 Again this works just fine calling it outside of web2py.

 if I run it from the interpreter on the server I am getting the 
 correct id number. Even using the shell in web2py and issuing the same 
 commands I am getting nothing. I feel like I am missing something simple



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