[web2py] Re: Extra field in SQLFORM can not be processed()

2015-01-30 Thread Anthony
You added a select element with the name "conversation" to a SQLFORM based 
on db.entity. Does db.entity include a field named "conversation"?

On Friday, January 30, 2015 at 9:12:44 AM UTC-5, Richard D wrote:
>
> According the book I have added a field to a SQLFORM using the following 
> code:
>
> form_chg_entity = SQLFORM(db.entity, showid=False, record = 
> session.sif.id, deletable = False, fields= form_fields )
> option_conversations = [OPTION(conv.subject, _value=conv.id) for conv 
> in db((db.conversation.entity==session.sif.id)
>   
>   &(db.conversation.community==session.com.id)
>   
>   ).select()]
> option_conversations.insert(0, OPTION("", _value=0))
> justify_entity = TR(LABEL('Change based on'),
>SELECT(_name='conversation', *option_conversations))
>
> form_chg_entity[0].insert(-1, justify_entity)
>
> However 
>
>  if form_chg_entity.process(formname='change_entity').accepted:
>
>
> Gives an error : 
>  'Table' object has no attribute 
> 'conversation'
> What is going wrong?
>
> Richard D
>

-- 
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: Global name 'crud' is not defined

2015-01-30 Thread Anthony
Answered on Stack Overflow: http://stackoverflow.com/a/28238033/440323

On Friday, January 30, 2015 at 6:23:37 AM UTC-5, Manuel Moscariello wrote:
>
> Hello everybody, 
> this is my first post here, I'm right now in the study phase of web2py, 
> getting pretty enthusiast about it.
> I was following a tutorial I found on a discussion of this group, 
> http://killer-web-development.com .
>
> Now, at a stage I should append to my controllers/default.py:
>
>
> def entry_post():
> """returns a form where the can entry a post"""
> form = crud.create(db.post)
> return dict(form=form)
>
>
> Nothing difficoult or strange, I was still feeling confortable.
> But when I then go to mysite/myapp/default/entry_post I get a ticket with 
> a NameError:
>
>  global name 'crud' is not defined
>
>
> I read the web2py book and crud.create(db.table) should be an accepted 
> method, so why is this error raising?
>
> Thanks you for your help, hope I am not asking a silly question but 
> neither google or a research on your group helped me.
>

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


[web2py] Re: Run web2py in public IP without explicit IP address - linux

2015-01-30 Thread Massimo Di Pierro
This should not be the case. 

http://stackoverflow.com/questions/20778771/what-is-the-difference-between-0-0-0-0-127-0-0-1-and-localhost

On Friday, 30 January 2015 16:30:26 UTC-6, Aydin S wrote:
>
> Thanks for the reply. 0.0.0.0 makes the server run in 127.0.0.1 which is 
> local and does not give me access to the website from other computer.
>
>
> sexta-feira, 30 de Janeiro de 2015 às 10:46:05 UTC-5, Niphlod escreveu:
>>
>> why don't you just use 0.0.0.0 ?
>>
>> On Friday, January 30, 2015 at 2:43:02 PM UTC+1, Aydin S wrote:
>>>
>>> Hi, i tried to run web2py from public IP in linux like this: web2py -i 
>>> hostname -a pass
>>> It did not work. I realized it was due to using hostname; it works fine 
>>> when doing web2py -i 192.168.0.0(for example) -a pass
>>>
>>> Is there any way to not enter the IP address every time? I know web2py 
>>> itself reads the public IP,is there anyway to use it in the command 
>>> options? Can this be done at all or needs source code modification? 
>>>
>>

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


[web2py] Re: web2py 2.9.12 is OUT

2015-01-30 Thread Massimo Di Pierro
Yes. The new dal broke the automatic update process. Sorry.

What do do:
1) remove the file dal.py
2) download web2py from the web site (the zip one) and unzip it over the 
existing web2py. Overwrite any file that you may have. This will restore 
the new gluon/dal/*.py files.

An upgrade to 2.9.13 (not out yet) that skips 2.9.12 will fix the problem.


On Friday, 30 January 2015 10:12:02 UTC-6, Cynthia Butler wrote:
>
> Here's how the update worked for me:
>
>- I was on version 2.9.11 (ubuntu 14.04, nginx, uwsgi, mongodb)
>- I used the "update" button on the admin panel.
>- It updated most of the files, then stopped with a message that there 
>was no DAL folder with an __init__ file.
>- So I created them in the gluon folder (empty __init__ file)
>- I clicked on the "update" button again.
>- This time it stopped with a message that there was no dal (lower 
>case) folder with an __init__ file.
>- So I created them also in the gluon folder (empty __init__ file).
>- I clicked on the "update" button again. No more messages, everything 
>works fine!
>- I installed the new "welcome.w2p" app using admin panel and looked 
>at db.py to see if it accessed the "dal" differently -- no the same for 
>mongodb.
>
> Questions:
>
>1. There is nothing in my new DAL folder except the blank init file. 
>Can I delete them? (Maybe I made a mistake about the message being in 
> upper 
>case?)
>2. Should I delete the old dal.py file in the gluon folder or is my 
>custom app using it? 
>
> Thanks for everyone's good 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/d/optout.


[web2py] Re: Extra field in SQLFORM can not be processed()

2015-01-30 Thread Massimo Di Pierro
I think somewhere you your code you redefined db to be a table.

On Friday, 30 January 2015 08:12:44 UTC-6, Richard D wrote:
>
> According the book I have added a field to a SQLFORM using the following 
> code:
>
> form_chg_entity = SQLFORM(db.entity, showid=False, record = 
> session.sif.id, deletable = False, fields= form_fields )
> option_conversations = [OPTION(conv.subject, _value=conv.id) for conv 
> in db((db.conversation.entity==session.sif.id)
>   
>   &(db.conversation.community==session.com.id)
>   
>   ).select()]
> option_conversations.insert(0, OPTION("", _value=0))
> justify_entity = TR(LABEL('Change based on'),
>SELECT(_name='conversation', *option_conversations))
>
> form_chg_entity[0].insert(-1, justify_entity)
>
> However 
>
>  if form_chg_entity.process(formname='change_entity').accepted:
>
>
> Gives an error : 
>  'Table' object has no attribute 
> 'conversation'
> What is going wrong?
>
> Richard D
>

-- 
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: 2.9.12 app deploy in GAE error

2015-01-30 Thread Massimo Di Pierro
Yes this is a bug. It will be fixed in the next version. 

On Friday, 30 January 2015 07:39:50 UTC-6, Jacinto Parga wrote:
>
> Hello,
>
> I deploy an applicaction in GAE with 2.9.11 succesfully but If I try to 
> deploy it with 2.9.12 I get the following ticket:
>
> 2015-01-30 14:31:41.094
>
>  Unable to store in FILE: 
> /base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py
>
> Traceback (most recent call last):
>   File 
> "/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/restricted.py",
>  line 224, in restricted
> exec ccode in environment
>   File 
> "/base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py",
>  line 19, in 
> session.connect(request, response, db=db)
>   File 
> "/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/globals.py",
>  line 904, in connect
> session_data = pickle.loads(row.session_data)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
> line 1382, in loads
> return Unpickler(file).load()
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
> line 858, in load
> dispatch[key](self)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
> line 1090, in load_global
> klass = self.find_class(module, name)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
> line 1126, in find_class
> klass = getattr(mod, name)
> AttributeError: 'module' object has no attribute 'Row'
>
>
> I have copied the gaehandler.py to main folder in 2.9.12. If I deploy it 
> again with 2.9.11 it works fine
>
> any help?
>
>
>

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


[web2py] Re: Global name 'crud' is not defined

2015-01-30 Thread Massimo Di Pierro
We are trying to deprecate crud therefore if you want to use you must 
define it:

from gluon.tools import Crud; crud = Crud(db);

Anyway, your code would be better written as:

form = SQLFORM(db.post).process()
return dict(form=form)


On Friday, 30 January 2015 05:23:37 UTC-6, Manuel Moscariello wrote:
>
> Hello everybody, 
> this is my first post here, I'm right now in the study phase of web2py, 
> getting pretty enthusiast about it.
> I was following a tutorial I found on a discussion of this group, 
> http://killer-web-development.com .
>
> Now, at a stage I should append to my controllers/default.py:
>
>
> def entry_post():
> """returns a form where the can entry a post"""
> form = crud.create(db.post)
> return dict(form=form)
>
>
> Nothing difficoult or strange, I was still feeling confortable.
> But when I then go to mysite/myapp/default/entry_post I get a ticket with 
> a NameError:
>
>  global name 'crud' is not defined
>
>
> I read the web2py book and crud.create(db.table) should be an accepted 
> method, so why is this error raising?
>
> Thanks you for your help, hope I am not asking a silly question but 
> neither google or a research on your group helped me.
>

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


[web2py] Re: web2py with bootstrap-slider && bootstrap-typeahead

2015-01-30 Thread Massimo Di Pierro
Niphlod. Calm down. Everything is going to be fine. ;-)

In fact, I almost did not know JS when I started web2py and avoided it as 
the plague. Today I like it a log.

Back to the original question. Assuming we are diagnosing the problem 
correctly (and Niphlod in my experience is 100% right) there are three 
solutions:

1)

$(document).ready(function() {... do something after the page loads 
...});

2) (new shorthand notation for the above):

$(function() {... do something after the page loads ...});

3)

simply import your JS file after the rest of pages, after . This is 
a common practice and if you look into layout.html we often import js code 
after  so it executed after everything else loads.

Anyway. The diagnose may still be wrong. Use the Chrome JS console and see 
if you get any error there.

Massimo

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


[web2py] Re: Run web2py in public IP without explicit IP address - linux

2015-01-30 Thread Aydin S
Thanks for the reply. 0.0.0.0 makes the server run in 127.0.0.1 which is 
local and does not give me access to the website from other computer.


sexta-feira, 30 de Janeiro de 2015 às 10:46:05 UTC-5, Niphlod escreveu:
>
> why don't you just use 0.0.0.0 ?
>
> On Friday, January 30, 2015 at 2:43:02 PM UTC+1, Aydin S wrote:
>>
>> Hi, i tried to run web2py from public IP in linux like this: web2py -i 
>> hostname -a pass
>> It did not work. I realized it was due to using hostname; it works fine 
>> when doing web2py -i 192.168.0.0(for example) -a pass
>>
>> Is there any way to not enter the IP address every time? I know web2py 
>> itself reads the public IP,is there anyway to use it in the command 
>> options? Can this be done at all or needs source code modification? 
>>
>

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


[web2py] Re: Question about web2py roadmap.

2015-01-30 Thread Leonel Câmara
I strongly agree with Massimo on this. By making administrative tasks 
easier you take that burden out of many developers. Not every developer is 
part of a big team that has one guy just to take care of administrative 
stuff. This is very true in the startup market where I think web2py has an 
advantage.   
  
There's also another point, if you make web2py easier to admin it will be 
easier for different hosting platforms to support it, this can take even 
more admin tasks out of the developers hands (like pythonanywhere already 
does).  
  
There's no conflict between the two, you can work on features for both the 
developers and the administrators, and specially the poor dudes having to 
wear both hats. In the end it's always good for the developers.

-- 
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: Groupby year on date field

2015-01-30 Thread Niphlod



are you sure that the issue is not fetching but rather visualizing the 
results you already fetched ???

-- 
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: Groupby year on date field

2015-01-30 Thread Niphlod
it works perfectly fine!

On Friday, January 30, 2015 at 5:10:46 AM UTC+1, Moiz Nagpurwala wrote:
>
> Thanks Niphlod for the replies.
>
> The code you provided does not seem to work for me.
>
> I tried the attached app on my local machine with SQLITE as well as MySQL 
> on PythonAnywhere  
> hosting.
> Both tests yielded blank results.
>
> Please find the app with test data in Attachment.
>
> Thanks.
>

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


[web2py] Re: How can I change a form so that the Enter key is disabled for "Submit"

2015-01-30 Thread Niphlod
there are a lot if you want to do down that path.

http://stackoverflow.com/questions/895171/prevent-users-from-submitting-form-by-hitting-enter

IMHO disabling enter is not a solution (I'm a keyboard guy and I love to 
send forms with enter): at the very minimum you should do a proper 
validation (server-side with web2py is easy). The most "elegant" way is to 
disable the submit button via javascript until all required fields are 
filled. 

-- 
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: Submit current form prior to logout?

2015-01-30 Thread Niphlod
the gist of it should be something like

$(function() {
$('a#thelogoutbutton').on('click', function(e) {
e.preventDefault();
if (code_to_submit_the_form() == 'everythingwentwell') {
window.href = this.href;
} else {
managefailure();
//optionally window.href = this.href
} 
})
})

as a general rule, it's not a "polite thing" to do to block on something if 
the user presses "i want to go out of here", so be sure to do it as switfly 
as possible (i.e. don't require a strict check on code_to_submit_the_form() 
and make it happen in under a half second).

-- 
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: SQLFORM hanging on insert

2015-01-30 Thread Ian W. Scott
Thanks, Michelle, for spelling out what Niphlod meant about the shell. 
Ignore the db.commit() in the controller code. That was something I threw 
in briefly to see what would happen. I forgot to remove it.

When I do db.commit() from the interactive prompt it doesn't hang or stall. 

I'm using postgresql for my db. 

I'd be tempted to say that it seems like the db connection isn't being 
closed after the insert. But my database-fu is very weak, so that may be a 
red herring. It's just so strange that the execution stops where it does: 
between the end of Table.insert and returning control to SQLFORM.accepts.

So I'm still scratching my head here.

On Friday, January 30, 2015 at 1:21:53 PM UTC-5, Michele Comitini wrote:
>
> Why do you commit?  not needed and even dangerous in that position.
> What db are you using?
> Do as niphlod suggests:
>
> python web2py.py -M -S 
>
>
>
> At the prompt issue:
>
> [1] db.commit()
>
>
> does it stall?
>
>
>
> Il giorno venerdì 30 gennaio 2015 18:10:23 UTC+1, Ian W. Scott ha scritto:
>>
>> If it helps at all, here's the controller function that creates and 
>> processes the form:
>>  
>>if form.process(formname=formname).accepted:
>> db.commit() ### DON'T DO IT!
>>  
>>
>>
>>
>>
>>
>> On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>>>
>>> what about if you start a shell and issue the insert statement with a 
>>> db.commit() ? does it hang also there ?
>>>
>>> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:

 Oh, and I'm running version 2.9.11-stable.

 On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>
> I have a create form (SQLFORM) that works (a new record is actually 
> created) but immediately after inserting the new record the web2py 
> process 
> hangs. The form remains greyed out and no other functions will work 
> (e.g., 
> can't refresh the page or navigate away). But there's no error raised. 
> Can 
> anyone help me figure out what is causing the hang?
>
> I've pinpointed the point where the hang occurs: the call to 
> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
> current stable version). What's strange is that the Table.insert method 
> does finish without any errors. But when it returns to SQLFORM.accepts 
> the 
> execution hangs. A print statement immediately following the call to 
> Table.insert is not executed.
>
> If it helps to know, I'm using postgresql running on apache.
>
> Here is an example of the data being sent by SQLFORM.accepts to 
> Table.insert:
>
> {'hints': [],
>  'instructions': [13L, 14L],
>  'lemmas': [],
>  'locations': [11L],
>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>  'npcs': [32L],
>  'outcome1': '1.0',
>  'outcome2': '',
>  'outcome3': '',
>  'prompt': 'Repetition can serve to emphasize certain words in the 
> sentence, especially when the repeated words are close together. Which 
> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd 
> \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd 
> \xcf\x84\xce\xbf 
> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>  'prompt_audio': 1,
>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
> \xe1\xbc\xa0\xce\xbd)?$',
>  'response2': '',
>  'response3': '',
>  'status': 1,
>  'step_options': [],
>  'tags': [202L],
>  'tags_ahead': [],
>  'tags_secondary': [],
>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>  'widget_image': 9,
>  'widget_type': 1}
>
>  Again, the db record is actually created. The operation just stops 
> any further execution.
>


-- 
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 can I change a form so that the Enter key is disabled for "Submit"

2015-01-30 Thread Tom Stratton
I'm finding that a lot of users are hitting Enter instead of Tab and I'm 
getting half-filled-in forms. I'd like to set the button to NOT default but 
not sure where to go about making that change.

Anyone have a solution?

Thanks

Tom

-- 
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: Submit current form prior to logout?

2015-01-30 Thread lillian

Thanks for the reply.

Let's assume that the action is in fact a click on the "logout" button/menu 
item (I've looked into the onbeforeunload event already, ugh.); I'm not 
quite sure how to intercept the action.  Do I need to add a handler to the 
menu item, have it call form.submit(), do the right things in my controller 
and then finally call logout by hand?  Or is there a "better" way to do it?

lillian


On Thursday, January 29, 2015 at 12:39:57 PM UTC-8, Niphlod wrote:
>
> if the "log out" is an event, like a click on the "logout" button, you can 
> intercept it, issue a submit with javascript and then actually logout the 
> user... if you're good with javascript-fu, the user won't notice it. 
> If instead the "log out" is the user closing the window, YMMV. You can 
> hook up to the "beforeonload" event, but it's quite nasty because:
> - you'd have to work your way through other stuff (the event is raised 
> also on form submits, user clicking on a link that leads to another page, 
> etc)
> - a big alarm gets raised (you surely noticed some of them on the 
> internet, like "the page is asking: are you sure you want to leave this 
> page?")
>
>

-- 
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] Global name 'crud' is not defined

2015-01-30 Thread Manuel Moscariello
Hello everybody, 
this is my first post here, I'm right now in the study phase of web2py, 
getting pretty enthusiast about it.
I was following a tutorial I found on a discussion of this group, 
http://killer-web-development.com .

Now, at a stage I should append to my controllers/default.py:


def entry_post():
"""returns a form where the can entry a post"""
form = crud.create(db.post)
return dict(form=form)


Nothing difficoult or strange, I was still feeling confortable.
But when I then go to mysite/myapp/default/entry_post I get a ticket with a 
NameError:

 global name 'crud' is not defined


I read the web2py book and crud.create(db.table) should be an accepted 
method, so why is this error raising?

Thanks you for your help, hope I am not asking a silly question but neither 
google or a research on your group helped me.

-- 
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: SQLFORM hanging on insert

2015-01-30 Thread Michele Comitini
Why do you commit?  not needed and even dangerous in that position.
What db are you using?
Do as niphlod suggests:

python web2py.py -M -S 



At the prompt issue:

[1] db.commit()


does it stall?



Il giorno venerdì 30 gennaio 2015 18:10:23 UTC+1, Ian W. Scott ha scritto:
>
> If it helps at all, here's the controller function that creates and 
> processes the form:
>  
>if form.process(formname=formname).accepted:
> db.commit() ### DON'T DO IT!
>  
>
>
>
>
>
> On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>>
>> what about if you start a shell and issue the insert statement with a 
>> db.commit() ? does it hang also there ?
>>
>> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>>
>>> Oh, and I'm running version 2.9.11-stable.
>>>
>>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:

 I have a create form (SQLFORM) that works (a new record is actually 
 created) but immediately after inserting the new record the web2py process 
 hangs. The form remains greyed out and no other functions will work (e.g., 
 can't refresh the page or navigate away). But there's no error raised. Can 
 anyone help me figure out what is causing the hang?

 I've pinpointed the point where the hang occurs: the call to 
 gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
 current stable version). What's strange is that the Table.insert method 
 does finish without any errors. But when it returns to SQLFORM.accepts the 
 execution hangs. A print statement immediately following the call to 
 Table.insert is not executed.

 If it helps to know, I'm using postgresql running on apache.

 Here is an example of the data being sent by SQLFORM.accepts to 
 Table.insert:

 {'hints': [],
  'instructions': [13L, 14L],
  'lemmas': [],
  'locations': [11L],
  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
  'npcs': [32L],
  'outcome1': '1.0',
  'outcome2': '',
  'outcome3': '',
  'prompt': 'Repetition can serve to emphasize certain words in the 
 sentence, especially when the repeated words are close together. Which 
 words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
 \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
 \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd 
 \xcf\x84\xce\xbf 
 \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
 \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
  'prompt_audio': 1,
  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
 \xe1\xbc\xa0\xce\xbd)?$',
  'response2': '',
  'response3': '',
  'status': 1,
  'step_options': [],
  'tags': [202L],
  'tags_ahead': [],
  'tags_secondary': [],
  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
  'widget_image': 9,
  'widget_type': 1}

  Again, the db record is actually created. The operation just stops any 
 further execution.

>>>

-- 
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] Dal tip . table to store upload from more than one table ?

2015-01-30 Thread Michele Comitini
There are many ways to do this and your way is not wrong in my POV.  You
could have used table inheritance see:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Table-inheritance

If you want for some reason to have all uploaded files references in one
table you can do ONE table like C or D that you call "C" and create two
tables A_files and B_files that just map records of "C" into A and into B
respectively.  So you will have 5 tables in total...

Else you want to keep the number of tables to 3 you can add a field to
table C that contains also the tablename of the record is referring too,
this could be as fast as the above if using indexes, but you cannot define
a specific reference field to table A (or B) as you do currently.

Else you can create table C with two columns one referring to A and the
other referring to B... this is going too look ugly if you have many
tables to refer too...





2015-01-30 16:15 GMT+01:00 António Ramos :

> Hello
> i have an app with table A and B
>
> Each record in A and B can have many upload files so i created table C and
> D respectively just to collect upload files from A and B
>
> This is my table C and D (they are equal)
>
> db.define_table('C_files',
> Field('f_emp_ref', db.A, notnull=True, writable=False,
> readable=False),
> Field('f_titulo', type='string', label=T('Categoria'),
> notnull=False),
> Field('f_doc', type='upload', autodelete=True,notnull=False,
> label=T('Documentos'),
> represent=lambda x, row:x and
> A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
>
> _href=URL('default','viewer.html',args=x),
> _target="_blank",
> _title=T("open file"),
> _class='file-reference')
> or ''),
> )
>
> db.define_table('D_files',
> Field('f_emp_ref', db.B, notnull=True, writable=False,
> readable=False),
> Field('f_titulo', type='string', label=T('Categoria'),
> notnull=False),
> Field('f_doc', type='upload', autodelete=True,notnull=False,
> label=T('Documentos'),
> represent=lambda x, row:x and
> A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),
>
> _href=URL('default','viewer.html',args=x),
> _target="_blank",
> _title=T("open file"),
> _class='file-reference')
> or ''),
> )
>
> After that i realized that this looks stupid and i would like to short it
> as possible.
>
>
> How can i have just table C to collect upload files from table A and B ?
>
> Thank you
> António
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: web2py 2.9.12 is OUT

2015-01-30 Thread Antonio Salazar
I managed to find the cause of the bug.

The editor fails if web2py's path has non-standard characters.
- Works correctly if installed on *c:\banana\web2py*
- Editor save hangs on syntax errors if installed on *c:\plátano\web2py*

I'll create the github ticket as soon as possible.

El jueves, 29 de enero de 2015, 17:57:43 (UTC-6), Antonio Salazar escribió:
>
> I tried to replicate the bug report on a clean install, but it didn't 
> happen. I think I'll stick with manual updates for now.
>
> El jueves, 29 de enero de 2015, 8:40:59 (UTC-6), Massimo Di Pierro 
> escribió:
>>
>> please open github ticket about this.
>>
>> On Tuesday, 27 January 2015 12:34:06 UTC-6, Antonio Salazar wrote:
>>>
>>> Since the upgrade, I'm getting this annoyance in the web editor.
>>>
>>> When I save a controller with a syntax error, the operation stalls at 
>>> "saving now...".
>>> If I retry the save, I get the warning "file changed on disk" and have 
>>> to merge it, losing the state of the editor.
>>>
>>> Is this a known bug?
>>>
>>> I'm using Windows 7 with the built-in web server, it was an automatic 
>>> upgrade.
>>>
>>

-- 
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: SQLFORM hanging on insert

2015-01-30 Thread Ian W. Scott
If it helps at all, here's the controller function that creates and 
processes the form:

def dupAndEdit():
"""Create and process a form to insert a new record, pre-populated
with field values copied from an existing record."""
tablename = request.args[0]
rowid = request.args[1]
orderby = request.vars['orderby'] or 'id'
restrictor = request.vars['restrictor'] or None
formname = '%s/%s/dup' % (tablename, rowid)


src = db(db[tablename].id == rowid).select().first()
form = SQLFORM(db[tablename], separator='', showid=True, formstyle='ul')


for v in db[tablename].fields:
# on opening populate duplicate values
form.vars[v] = src[v] if v != 'id' and v in src else None
# FIXME: ajaxselect field values have to be added manually
if db[tablename].fields[1] in request.vars.keys():  # on submit add 
ajaxselect values
extras = [f for f in db[tablename].fields
  if f not in form.vars.keys()]
for e in extras:
form.vars[e] = request.vars[e] if e in request.vars.keys() \
else ''
del form.vars['id']
print 'form vars ='
pprint(form.vars)


if form.process(formname=formname).accepted:
db.commit()
print 'accepted form ='
the_url = makeurl(tablename, orderby, restrictor)
response.js = "web2py_component('%s', " \
  "'listpane');" % the_url
response.flash = 'New record successfully created.'
elif form.errors:
print 'listandedit form errors:', [e for e in form.errors]
print 'listandedit form vars:', form.vars
response.flash = 'Sorry, there was an error processing '\
 'the form. The new record has not been created.'
else:
pass


return dict(form=form)




On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>
> what about if you start a shell and issue the insert statement with a 
> db.commit() ? does it hang also there ?
>
> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>
>> Oh, and I'm running version 2.9.11-stable.
>>
>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I have a create form (SQLFORM) that works (a new record is actually 
>>> created) but immediately after inserting the new record the web2py process 
>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>> anyone help me figure out what is causing the hang?
>>>
>>> I've pinpointed the point where the hang occurs: the call to 
>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>> current stable version). What's strange is that the Table.insert method 
>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>> execution hangs. A print statement immediately following the call to 
>>> Table.insert is not executed.
>>>
>>> If it helps to know, I'm using postgresql running on apache.
>>>
>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>> Table.insert:
>>>
>>> {'hints': [],
>>>  'instructions': [13L, 14L],
>>>  'lemmas': [],
>>>  'locations': [11L],
>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>  'npcs': [32L],
>>>  'outcome1': '1.0',
>>>  'outcome2': '',
>>>  'outcome3': '',
>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>> sentence, especially when the repeated words are close together. Which 
>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>  'prompt_audio': 1,
>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>  'response2': '',
>>>  'response3': '',
>>>  'status': 1,
>>>  'step_options': [],
>>>  'tags': [202L],
>>>  'tags_ahead': [],
>>>  'tags_secondary': [],
>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>  'widget_image': 9,
>>>  'widget_type': 1}
>>>
>>>  Again, the db record is actually created. The operation just stops any 
>>> further execution.
>>>
>>

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

[web2py] Re: SQLFORM hanging on insert

2015-01-30 Thread Ian W. Scott
Thanks for the suggestion Niphlod. I'm just not sure what you mean by 
"start a shell". Can you explain?

Ian

On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>
> what about if you start a shell and issue the insert statement with a 
> db.commit() ? does it hang also there ?
>
> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>
>> Oh, and I'm running version 2.9.11-stable.
>>
>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I have a create form (SQLFORM) that works (a new record is actually 
>>> created) but immediately after inserting the new record the web2py process 
>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>> anyone help me figure out what is causing the hang?
>>>
>>> I've pinpointed the point where the hang occurs: the call to 
>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>> current stable version). What's strange is that the Table.insert method 
>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>> execution hangs. A print statement immediately following the call to 
>>> Table.insert is not executed.
>>>
>>> If it helps to know, I'm using postgresql running on apache.
>>>
>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>> Table.insert:
>>>
>>> {'hints': [],
>>>  'instructions': [13L, 14L],
>>>  'lemmas': [],
>>>  'locations': [11L],
>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>  'npcs': [32L],
>>>  'outcome1': '1.0',
>>>  'outcome2': '',
>>>  'outcome3': '',
>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>> sentence, especially when the repeated words are close together. Which 
>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>  'prompt_audio': 1,
>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>  'response2': '',
>>>  'response3': '',
>>>  'status': 1,
>>>  'step_options': [],
>>>  'tags': [202L],
>>>  'tags_ahead': [],
>>>  'tags_secondary': [],
>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>  'widget_image': 9,
>>>  'widget_type': 1}
>>>
>>>  Again, the db record is actually created. The operation just stops any 
>>> further execution.
>>>
>>

-- 
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] Why does redirect() always append '#'?

2015-01-30 Thread Richard Vézina
Bad idea, it trunk the redirect completly :D

Richard

On Fri, Jan 30, 2015 at 11:36 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I should had try... :(
>
> I thought about it...
>
> what you think about the back shalsh?
>
> Richard
>
> On Thu, Jan 29, 2015 at 4:57 PM, Anthony  wrote:
>
>> SQLFORM(..., _action='')
>>
>> SQLFORM.factory(..., _action='')
>>
>> The above are both just HTML helpers, so you can add any attribute as
>> usual (i.e., by preceding the attribute name with an underscore).
>>
>> Anthony
>>
>>
>> On Thursday, January 29, 2015 at 4:25:42 PM UTC-5, Richard wrote:
>>>
>>> Getting the same issue...
>>>
>>> Could your suggestion of emtpy action in this case be improve with "/"
>>> action which will be parsed out by url processing?
>>>
>>> Also, how do we suppose to manage form action with SQLFORM and
>>> .factory... I try add action='', also to form.process(action='', ...),
>>> nothing works
>>>
>>> Should I manipulate the DOM?
>>>
>>> Richard
>>>
>>> On Mon, Feb 3, 2014 at 12:16 PM, Anthony  wrote:
>>>
 No, redirect() does not append a "#". Rather, it simply returns a 303
 response to the browser along with whatever URL you provide.

 I assume what is happening is that you are submitting a form from the
 browser. By default, the action attribute in a web2py form is "#", which
 sends the request to the current URL but with a "#" appended (note, the "#"
 doesn't get sent to the server, so the server doesn't know about it). Your
 form processing action probably redirects to another URL. When the browser
 processes that redirect, it will retain the "#" on the redirect URL.

 If you want to remove the "#", set your form action to "" (technically
 incorrect, but should work -- web2py used to do that but changed to "#"
 because an empty action is technically invalid).

 Anthony


 On Monday, February 3, 2014 10:25:55 AM UTC-5, horridohobbyist wrote:
>
> Sorry, you are incorrect. redirect() always appends '#'. There's
> nothing I'm doing on the client side that would account for this. Here are
> all the redirect() calls in my code, and they all append the fragment
> identifier:
>
> redirect(URL('add_to_cart')
>
> redirect(URL('show_reviews')
>
> redirect(URL('index')
>
> redirect(session.back_to_view)
>
> This last one is obtained from:
>
> session.back_to_view = request.env.http_referer
>
>
> On Monday, 3 February 2014 10:03:35 UTC-5, Marin Pranjić wrote:
>>
>> We can only guess without seeing the code.
>>
>> My guess is:
>>
>> 1. redirect doesn't append #, something else does it client side
>> 2. # doesn't break script execution, something else does (probably
>> same issue that appends #)
>>
>> Can you check your console for javascript error logs?
>>
>> Marin
>>
>>
>> On Mon, Feb 3, 2014 at 3:59 PM, horridohobbyist > > wrote:
>>
>>> I have the following added to the end of a view:
>>>
>>> 
>>> $(function(){
>>> $("#includedContent").load("/MyApp/static/desc/P"+id+"_desc.
>>> html");
>>> });
>>> 
>>> 
>>>
>>> This works fine. However, if this page is arrived from a redirect(),
>>> the URL has a fragment identifier '#' appended. For some reason, this
>>> causes the script *not* to execute and so I don't get the included
>>> content.
>>>
>>> Two questions:
>>>
>>>1. Why is the fragment identifier blocking the script?
>>>2. Why is it necessary for redirect() to always append a
>>>fragment identifier? If the fragment identifier is sometimes needed, 
>>> why
>>>can't it be optional?
>>>
>>>
>>> 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+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:
>> - h

Re: [web2py] Why does redirect() always append '#'?

2015-01-30 Thread Richard Vézina
I should had try... :(

I thought about it...

what you think about the back shalsh?

Richard

On Thu, Jan 29, 2015 at 4:57 PM, Anthony  wrote:

> SQLFORM(..., _action='')
>
> SQLFORM.factory(..., _action='')
>
> The above are both just HTML helpers, so you can add any attribute as
> usual (i.e., by preceding the attribute name with an underscore).
>
> Anthony
>
>
> On Thursday, January 29, 2015 at 4:25:42 PM UTC-5, Richard wrote:
>>
>> Getting the same issue...
>>
>> Could your suggestion of emtpy action in this case be improve with "/"
>> action which will be parsed out by url processing?
>>
>> Also, how do we suppose to manage form action with SQLFORM and
>> .factory... I try add action='', also to form.process(action='', ...),
>> nothing works
>>
>> Should I manipulate the DOM?
>>
>> Richard
>>
>> On Mon, Feb 3, 2014 at 12:16 PM, Anthony  wrote:
>>
>>> No, redirect() does not append a "#". Rather, it simply returns a 303
>>> response to the browser along with whatever URL you provide.
>>>
>>> I assume what is happening is that you are submitting a form from the
>>> browser. By default, the action attribute in a web2py form is "#", which
>>> sends the request to the current URL but with a "#" appended (note, the "#"
>>> doesn't get sent to the server, so the server doesn't know about it). Your
>>> form processing action probably redirects to another URL. When the browser
>>> processes that redirect, it will retain the "#" on the redirect URL.
>>>
>>> If you want to remove the "#", set your form action to "" (technically
>>> incorrect, but should work -- web2py used to do that but changed to "#"
>>> because an empty action is technically invalid).
>>>
>>> Anthony
>>>
>>>
>>> On Monday, February 3, 2014 10:25:55 AM UTC-5, horridohobbyist wrote:

 Sorry, you are incorrect. redirect() always appends '#'. There's
 nothing I'm doing on the client side that would account for this. Here are
 all the redirect() calls in my code, and they all append the fragment
 identifier:

 redirect(URL('add_to_cart')

 redirect(URL('show_reviews')

 redirect(URL('index')

 redirect(session.back_to_view)

 This last one is obtained from:

 session.back_to_view = request.env.http_referer


 On Monday, 3 February 2014 10:03:35 UTC-5, Marin Pranjić wrote:
>
> We can only guess without seeing the code.
>
> My guess is:
>
> 1. redirect doesn't append #, something else does it client side
> 2. # doesn't break script execution, something else does (probably
> same issue that appends #)
>
> Can you check your console for javascript error logs?
>
> Marin
>
>
> On Mon, Feb 3, 2014 at 3:59 PM, horridohobbyist 
> wrote:
>
>> I have the following added to the end of a view:
>>
>> 
>> $(function(){
>> $("#includedContent").load("/MyApp/static/desc/P"+id+"_desc.
>> html");
>> });
>> 
>> 
>>
>> This works fine. However, if this page is arrived from a redirect(),
>> the URL has a fragment identifier '#' appended. For some reason, this
>> causes the script *not* to execute and so I don't get the included
>> content.
>>
>> Two questions:
>>
>>1. Why is the fragment identifier blocking the script?
>>2. Why is it necessary for redirect() to always append a fragment
>>identifier? If the fragment identifier is sometimes needed, why can't 
>> it be
>>optional?
>>
>>
>> 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+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

[web2py] Re: web2py 2.9.12 is OUT

2015-01-30 Thread Cynthia Butler
Here's how the update worked for me:

   - I was on version 2.9.11 (ubuntu 14.04, nginx, uwsgi, mongodb)
   - I used the "update" button on the admin panel.
   - It updated most of the files, then stopped with a message that there 
   was no DAL folder with an __init__ file.
   - So I created them in the gluon folder (empty __init__ file)
   - I clicked on the "update" button again.
   - This time it stopped with a message that there was no dal (lower case) 
   folder with an __init__ file.
   - So I created them also in the gluon folder (empty __init__ file).
   - I clicked on the "update" button again. No more messages, everything 
   works fine!
   - I installed the new "welcome.w2p" app using admin panel and looked at 
   db.py to see if it accessed the "dal" differently -- no the same for 
   mongodb.

Questions:

   1. There is nothing in my new DAL folder except the blank init file. Can 
   I delete them? (Maybe I made a mistake about the message being in upper 
   case?)
   2. Should I delete the old dal.py file in the gluon folder or is my 
   custom app using it? 

Thanks for everyone's good 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/d/optout.


[web2py] Re: Run web2py in public IP without explicit IP address - linux

2015-01-30 Thread Niphlod
why don't you just use 0.0.0.0 ?

On Friday, January 30, 2015 at 2:43:02 PM UTC+1, Aydin S wrote:
>
> Hi, i tried to run web2py from public IP in linux like this: web2py -i 
> hostname -a pass
> It did not work. I realized it was due to using hostname; it works fine 
> when doing web2py -i 192.168.0.0(for example) -a pass
>
> Is there any way to not enter the IP address every time? I know web2py 
> itself reads the public IP,is there anyway to use it in the command 
> options? Can this be done at all or needs source code modification? 
>

-- 
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: TR and CAT

2015-01-30 Thread Leonel Câmara
Humm CAT is specifically an exception to this, here's the code:

if isinstance(c, (allowed_parents,CAT)):
pass

In the case of TR allowed_parents is (TD, TH) but CAT is always exempt no 
matter what tag is doing the wrapping. I'm guessing the reason is that you 
can't know if the CAT will return a list of allowed parents.

-- 
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] Dal tip . table to store upload from more than one table ?

2015-01-30 Thread António Ramos
Hello
i have an app with table A and B

Each record in A and B can have many upload files so i created table C and
D respectively just to collect upload files from A and B

This is my table C and D (they are equal)

db.define_table('C_files',
Field('f_emp_ref', db.A, notnull=True, writable=False,
readable=False),
Field('f_titulo', type='string', label=T('Categoria'),
notnull=False),
Field('f_doc', type='upload', autodelete=True,notnull=False,
label=T('Documentos'),
represent=lambda x, row:x and
A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),

_href=URL('default','viewer.html',args=x),
_target="_blank",
_title=T("open file"),
_class='file-reference')
or ''),
)

db.define_table('D_files',
Field('f_emp_ref', db.B, notnull=True, writable=False,
readable=False),
Field('f_titulo', type='string', label=T('Categoria'),
notnull=False),
Field('f_doc', type='upload', autodelete=True,notnull=False,
label=T('Documentos'),
represent=lambda x, row:x and
A('%s'%(db.e_docs.f_doc.retrieve(x)[0]),

_href=URL('default','viewer.html',args=x),
_target="_blank",
_title=T("open file"),
_class='file-reference')
or ''),
)

After that i realized that this looks stupid and i would like to short it
as possible.


How can i have just table C to collect upload files from table A and B ?

Thank you
António

-- 
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] vars=dict(_next= ...) and settings.cas_domains = None

2015-01-30 Thread Anthony
You cannot set auth.settings.cas_domains to None. Instead, you can set it 
to an empty list:

auth.settings.cas_domains = []

Anthony

On Friday, January 30, 2015 at 2:16:16 AM UTC-5, Annet wrote:
>
> Thank you both for your replies.
>
> Thanks for your reply.
>
> I am not using CAS, there's this setting in db.py
>
> ## to prevent the auth_cas table from being created
> auth.settings.cas_domains = None
>
> that causes vars=dict(_next=...) to break in my application.
> This worked in previous versions of web2py, however, it no
> longer does.
>
> Best,
>
> Annet
>

-- 
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] Trying to run web2py from linux, all ports fail

2015-01-30 Thread Michele Comitini
One trick that could somewhat accelerate the release of a port not properly
closed by a server is trying to connect to it.
for instance:

nc 127.0.0.1 8000

and then CTRL-C

the trick awakes the network layer that gives a "Connection Refused" and
from then on the port is free 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/d/optout.


[web2py] Extra field in SQLFORM can not be processed()

2015-01-30 Thread Richard D
According the book I have added a field to a SQLFORM using the following 
code:

form_chg_entity = SQLFORM(db.entity, showid=False, record = 
session.sif.id, deletable = False, fields= form_fields )
option_conversations = [OPTION(conv.subject, _value=conv.id) for conv 
in db((db.conversation.entity==session.sif.id)

&(db.conversation.community==session.com.id)

).select()]
option_conversations.insert(0, OPTION("", _value=0))
justify_entity = TR(LABEL('Change based on'),
   SELECT(_name='conversation', *option_conversations))

form_chg_entity[0].insert(-1, justify_entity)

However 

 if form_chg_entity.process(formname='change_entity').accepted:
   

Gives an error : 
 'Table' object has no attribute 
'conversation'
What is going wrong?

Richard D

-- 
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] Run web2py in public IP without explicit IP address - linux

2015-01-30 Thread Aydin S
Hi, i tried to run web2py from public IP in linux like this: web2py -i 
hostname -a pass
It did not work. I realized it was due to using hostname; it works fine 
when doing web2py -i 192.168.0.0(for example) -a pass

Is there any way to not enter the IP address every time? I know web2py 
itself reads the public IP,is there anyway to use it in the command 
options? Can this be done at all or needs source code modification? 

-- 
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] 2.9.12 app deploy in GAE error

2015-01-30 Thread Jacinto Parga
Hello,

I deploy an applicaction in GAE with 2.9.11 succesfully but If I try to 
deploy it with 2.9.12 I get the following ticket:

2015-01-30 14:31:41.094

 Unable to store in FILE: 
/base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py

Traceback (most recent call last):
  File 
"/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/restricted.py",
 line 224, in restricted
exec ccode in environment
  File 
"/base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py",
 line 19, in 
session.connect(request, response, db=db)
  File 
"/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/globals.py",
 line 904, in connect
session_data = pickle.loads(row.session_data)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 
1382, in loads
return Unpickler(file).load()
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 
858, in load
dispatch[key](self)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 
1090, in load_global
klass = self.find_class(module, name)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", line 
1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Row'


I have copied the gaehandler.py to main folder in 2.9.12. If I deploy it 
again with 2.9.11 it works fine

any help?


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


Re: [web2py] Trying to run web2py from linux, all ports fail

2015-01-30 Thread Aydin S
I did a test, Mirko is right, in linux if web2py is not shut down right it 
cannot run on any port other than what it initially run with. 

Other thing was my own error, for public IP I was using "-i hostname" this 
did not work. When I put exact IP address number 192.168.0.0 it works. 

Now the question is, my IP is dynamic, is there any way to run web2py from 
public IP always without the need to enter the IP address? Web2py it self 
gets the IP address, is there anyway to use that? 



sexta-feira, 30 de Janeiro de 2015 às 08:14:48 UTC-5, Aydin S escreveu:
>
> I found out what makes the root cause and any suggestion to resolve this 
> is very appreciated:
>
> If I run the web2py by local IP, it has no problem with any port. But, if 
> I run the web2py from public IP of machine (192.168.0.0 for example) it 
> gives the error above. 
> And this is limited to linux, in windows it works fine with the public IP. 
>
> Any idea what's going on?
>
>
> sexta-feira, 30 de Janeiro de 2015 às 08:06:26 UTC-5, Aydin S escreveu:
>>
>> Thanks for the replies. 
>>
>> Mirko, do you mean I should wait for couple of minutes and run web2py and 
>> it will work? 
>>
>> Michele, here is the results of the netstat -tanp
>>
>>
>> PID/Program name
>> tcp0  0 0.0.0.0:22  0.0.0.0:*   
>> LISTEN  832/sshd
>> tcp0  0 127.0.0.1:3950  0.0.0.0:*   
>> LISTEN  819/xrdp-sesman
>> tcp0  0 0.0.0.0:38890.0.0.0:*   
>> LISTEN  803/xrdp
>> tcp0  0 192.168..0.0:20  192.168.0.0:   
>> ESTABLISHED 1144/0
>> tcp6   0  0 :::8080 :::*   
>>  LISTEN  851/apache2
>> tcp6   0  0 :::80   :::*   
>>  LISTEN  1/systemd
>> tcp6   0  0 :::22   :::*   
>>  LISTEN  832/sshd
>> tcp6   0  0 :::3000 :::*   
>>  LISTEN  1/systemd
>>
>>
>> sexta-feira, 30 de Janeiro de 2015 às 03:15:55 UTC-5, Michele Comitini 
>> escreveu:
>>>
>>> as root do:
>>> # netstat -tanp
>>>
>>> and see what you get
>>>
>>>
>>>
>>> 2015-01-30 5:28 GMT+01:00 Mirko Scavazzin :
>>>
 *TIME_WAIT** is the state that typically ties up the port for several 
 minutes after the process has completed.*The length of the associated 
 timeout varies on different operating systems, and may be dynamic on some 
 operating systems, however typical values are in the range of one to four 
 minutes.
 HTH
 Le 30 janv. 2015 05:16, "Aydin S"  a écrit :

 Hi, I'm trying to run web2py from linux. However, it fails with this 
> error:
>
> ERROR:Rocket.Errors.Port8000:Socket hostname:8000 in use by other 
> process and it won't share.
> WARNING:Rocket.Errors.Port8000:Listener started when not ready.
>
> I have tried various ports like 8001, and it fails still. There is no 
> other process using these ports. By the way, this does not happen in 
> windows. I searched in the group for this problem and saw some posts but 
> no 
> help from those. 
> Any help or advice is appreciated. 
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>

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


Re: [web2py] Trying to run web2py from linux, all ports fail

2015-01-30 Thread Aydin S
I found out what makes the root cause and any suggestion to resolve this is 
very appreciated:

If I run the web2py by local IP, it has no problem with any port. But, if I 
run the web2py from public IP of machine (192.168.0.0 for example) it gives 
the error above. 
And this is limited to linux, in windows it works fine with the public IP. 

Any idea what's going on?


sexta-feira, 30 de Janeiro de 2015 às 08:06:26 UTC-5, Aydin S escreveu:
>
> Thanks for the replies. 
>
> Mirko, do you mean I should wait for couple of minutes and run web2py and 
> it will work? 
>
> Michele, here is the results of the netstat -tanp
>
>
> PID/Program name
> tcp0  0 0.0.0.0:22  0.0.0.0:*   
> LISTEN  832/sshd
> tcp0  0 127.0.0.1:3950  0.0.0.0:*   
> LISTEN  819/xrdp-sesman
> tcp0  0 0.0.0.0:38890.0.0.0:*   
> LISTEN  803/xrdp
> tcp0  0 192.168..0.0:20  192.168.0.0:   
> ESTABLISHED 1144/0
> tcp6   0  0 :::8080 :::*LISTEN 
>  851/apache2
> tcp6   0  0 :::80   :::*LISTEN 
>  1/systemd
> tcp6   0  0 :::22   :::*LISTEN 
>  832/sshd
> tcp6   0  0 :::3000 :::*LISTEN 
>  1/systemd
>
>
> sexta-feira, 30 de Janeiro de 2015 às 03:15:55 UTC-5, Michele Comitini 
> escreveu:
>>
>> as root do:
>> # netstat -tanp
>>
>> and see what you get
>>
>>
>>
>> 2015-01-30 5:28 GMT+01:00 Mirko Scavazzin :
>>
>>> *TIME_WAIT** is the state that typically ties up the port for several 
>>> minutes after the process has completed.*The length of the associated 
>>> timeout varies on different operating systems, and may be dynamic on some 
>>> operating systems, however typical values are in the range of one to four 
>>> minutes.
>>> HTH
>>> Le 30 janv. 2015 05:16, "Aydin S"  a écrit :
>>>
>>> Hi, I'm trying to run web2py from linux. However, it fails with this 
 error:

 ERROR:Rocket.Errors.Port8000:Socket hostname:8000 in use by other 
 process and it won't share.
 WARNING:Rocket.Errors.Port8000:Listener started when not ready.

 I have tried various ports like 8001, and it fails still. There is no 
 other process using these ports. By the way, this does not happen in 
 windows. I searched in the group for this problem and saw some posts but 
 no 
 help from those. 
 Any help or advice is appreciated. 

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

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

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


Re: [web2py] Trying to run web2py from linux, all ports fail

2015-01-30 Thread Aydin S
Thanks for the replies. 

Mirko, do you mean I should wait for couple of minutes and run web2py and 
it will work? 

Michele, here is the results of the netstat -tanp


PID/Program name
tcp0  0 0.0.0.0:22  0.0.0.0:*   LISTEN 
 832/sshd
tcp0  0 127.0.0.1:3950  0.0.0.0:*   LISTEN 
 819/xrdp-sesman
tcp0  0 0.0.0.0:38890.0.0.0:*   LISTEN 
 803/xrdp
tcp0  0 192.168..0.0:20  192.168.0.0:   
ESTABLISHED 1144/0
tcp6   0  0 :::8080 :::*LISTEN 
 851/apache2
tcp6   0  0 :::80   :::*LISTEN 
 1/systemd
tcp6   0  0 :::22   :::*LISTEN 
 832/sshd
tcp6   0  0 :::3000 :::*LISTEN 
 1/systemd


sexta-feira, 30 de Janeiro de 2015 às 03:15:55 UTC-5, Michele Comitini 
escreveu:
>
> as root do:
> # netstat -tanp
>
> and see what you get
>
>
>
> 2015-01-30 5:28 GMT+01:00 Mirko Scavazzin  >:
>
>> *TIME_WAIT** is the state that typically ties up the port for several 
>> minutes after the process has completed.*The length of the associated 
>> timeout varies on different operating systems, and may be dynamic on some 
>> operating systems, however typical values are in the range of one to four 
>> minutes.
>> HTH
>> Le 30 janv. 2015 05:16, "Aydin S" > a 
>> écrit :
>>
>> Hi, I'm trying to run web2py from linux. However, it fails with this 
>>> error:
>>>
>>> ERROR:Rocket.Errors.Port8000:Socket hostname:8000 in use by other 
>>> process and it won't share.
>>> WARNING:Rocket.Errors.Port8000:Listener started when not ready.
>>>
>>> I have tried various ports like 8001, and it fails still. There is no 
>>> other process using these ports. By the way, this does not happen in 
>>> windows. I searched in the group for this problem and saw some posts but no 
>>> help from those. 
>>> Any help or advice is appreciated. 
>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] Re: serving a zip file

2015-01-30 Thread Yebach
Using parts of your code I have a problem with zip file. It appends text to 
new file in my zip
So first worker has in his ics file his data but second one has his and 
from previous

This is my code
 cal = Calendar()
import zipfile, cStringIO
exported_chunks_zip = cStringIO.StringIO()
zipf = zipfile.ZipFile(exported_chunks_zip, "w", 
compression=zipfile.ZIP_DEFLATED )

for i, rec in enumerate(grouped):
worker =  rec['rw_worker_nick'].encode('cp1250')
for rr in rec["allData"]:
startDate = rr['rw_date']
startTime = rr['rw_time_start']
endTime = rr['rw_time_end']
evtstart = datetime.datetime.combine(startDate,startTime)
evtend = datetime.datetime.combine(startDate,endTime)
event = Event()

event.add('summary', rec['rw_worker_nick'])
event.add('dtstart', evtstart)
event.add('dtend', evtend)
cal.add_component(event)
text = cal.to_ical()
zipf.writestr(worker +'.ics', text)
text = ''

On Sunday, October 16, 2011 at 12:45:25 PM UTC+2, peter wrote:
>
> I have now tried the downloady example remotely, on a linux server 
> with niginx and uswgi. This streams the zip file correctly with both 
> chrome and IE8. 
>
> So the problem is there only when I use the rocket server on windows. 
>
> I just tried the rocket server remotely, and streaming is correct. 
>
> So I only get the problem with the rocket server on windows and 
> streaming on windows using IE8. 
>
> I hope that this helps. As I only need it to work remotely on my linux 
> server I am not left with a problem, but it does appear there is a 
> minor bug there. 
>
> Peter 
>
>
>
> On Oct 15, 4:34 pm, peter  wrote: 
> > This is the code I used, as above 
> > def downloady(): 
> > 
> > import os 
> > import contenttype as c 
> > path="somepath/album.zip" 
> > response.headers['Content-Type'] = c.contenttype(path) 
> > response.headers['Content-Disposition'] = 'attachment; 
> > filename=album.zip'# to force download as attachment 
> > 
> > return response.stream(open(path,'rb'),chunk_size=4096) 
> > 
> > Peter 
> > 
> > On Oct 15, 3:53 pm, Massimo Di Pierro  
> > wrote: 
> > 
> > 
> > 
> > > Why 
> > > response.headers['Content-Type'] = "application/octet-stream" 
> > > shouldn't it be 
> > > response.headers['Content-Type'] = "application/zip" 
> > 
> > > I am not sure this causes the problem but it may be, if IE thinks the 
> > > data is ascii and not binary. 
> > 
> > > On Oct 15, 4:46 am, peter  wrote: 
> > 
> > > > Yes, the downloaded file is corrupted with IE8 but not with chrome. 
> > > > When I compare the files with a hex editor, they both begin and end 
> > > > the same, however, the last byte of the original file is at 6EA11, 
> > > > whereas the last byte of the downloaded file is at 6D7311. 
> > 
> > > > So it appears that it is losing a few bytes but not at either end. 
> > 
> > > > Windows reports the size of the two files as 6.91MB on server and 
> > > > 6.83MB after downloading 
> > 
> > > > Peter 
> > 
> > > > On Oct 14, 11:40 pm, Massimo Di Pierro  
> > > > wrote: 
> > 
> > > > > You mean the downloaded file is corrupted? Can you check the size? 
> > 
> > > > > On Oct 14, 5:33 pm, peter  wrote: 
> > 
> > > > > > Okay this is where I am now. 
> > 
> > > > > > My example 'downloady' above works correctly in chrome but 
> incorrectly 
> > > > > > in IE8. In IE8, the file appears to download correctly but will 
> not 
> > > > > > unzip. 
> > 
> > > > > > Peter 
> > 
> > > > > > On Oct 14, 7:13 pm, Matt Broadstone  wrote: 
> > 
> > > > > > > On Fri, Oct 14, 2011 at 12:48 PM, Massimo Di Pierro<
> massimo.dipie...@gmail.com> wrote: 
> > > > > > > > What browser? 
> > 
> > > > > > > That was chrome. The previously fix suggested by Brian works 
> for me (thanks!). 
> > 
> > > > > > > Matt 
> > 
> > > > > > > > On Oct 14, 10:30 am, Matt Broadstone  
> wrote: 
> > > > > > > >> On Fri, Oct 14, 2011 at 9:35 AM, peter <
> peterchutchin...@gmail.com> wrote: 
> > > > > > > >> > If I now do exactly what I did one month ago, there is 
> now no error 
> > > > > > > >> > with zip streaming. So maybe you have changed things in 
> > > > > > > >> > response.stream since then. 
> > 
> > > > > > > >> > Peter 
> > 
> > > > > > > >> > On Oct 14, 1:24 pm, peter  
> wrote: 
> > > > > > > >> >> I sent from my wifes emailhttp://
> groups.google.com/group/web2py/browse_thread/thread/fe85dca9e4... 
> > 
> > > > > > > >> >> However with hindsight I think I did not give sufficient 
> information 
> > > > > > > >> >> in my forum entry. I guess I was seeing if other people 
> had had 
> > > > > > > >> >> problems with downloading zip files. 
> > 
> > > > > > > >> >> Today, I just tried the following 
> > 
> > > > > > > >> >> def downloady(): 
> > 
> > > > > > > >> >> import os 
> > > > > > > >> >> import contenttype as c 
> > > > > > > >> >> path="some

[web2py] Re: Not a question, book suggestion

2015-01-30 Thread Tim Richardson


On Thursday, January 22, 2015 at 8:38:58 AM UTC+11, Otto Domínguez wrote:
>
> I read about lazy_tables = True in the book. I used it at once. Then I 
> read about smartgrid. I used it at once. But things did not work well with 
> reference tables. Looking in this group, I became aware that lazy_tables = 
> True impact negatively smartgrid's behavior with reference tables. A note 
> in the book part about lazy_tables concerning smartgrid would be a welcome 
> addition.
>

Hi Otto, do you have a reference to a post or thread on this topic?
 

-- 
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] Trying to run web2py from linux, all ports fail

2015-01-30 Thread Michele Comitini
as root do:
# netstat -tanp

and see what you get



2015-01-30 5:28 GMT+01:00 Mirko Scavazzin :

> *TIME_WAIT** is the state that typically ties up the port for several
> minutes after the process has completed.*The length of the associated
> timeout varies on different operating systems, and may be dynamic on some
> operating systems, however typical values are in the range of one to four
> minutes.
> HTH
> Le 30 janv. 2015 05:16, "Aydin S"  a écrit :
>
> Hi, I'm trying to run web2py from linux. However, it fails with this error:
>>
>> ERROR:Rocket.Errors.Port8000:Socket hostname:8000 in use by other process
>> and it won't share.
>> WARNING:Rocket.Errors.Port8000:Listener started when not ready.
>>
>> I have tried various ports like 8001, and it fails still. There is no
>> other process using these ports. By the way, this does not happen in
>> windows. I searched in the group for this problem and saw some posts but no
>> help from those.
>> Any help or advice is appreciated.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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