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

2014-01-05 Thread Akash Agrawall
Sorry for late reply man. I checked the same no luck in that... !! 
:(
my present code 
from gluon.tools import Mail
mail = Mail()
#mail = auth.settings.mailer
mail.settings.server =  'localhost'
mail.settings.sender = 'fakeid425s...@gmail.com'
mail.settings.tls = None
mail.settings.login = None

same flash message in there. 

On Saturday, January 4, 2014 5:57:37 PM UTC+5:30, Alan Etkin wrote:
>
> Hie folks.. I know this question is already been asked but I didn't get 
>> any help from those answers. please hava look at this 
>> I am unable to send email in server(to be specific webfaction.com) ...
>> but it's running fine on local host
>>
>
> Have you checked this thread?
>
> https://groups.google.com/d/msg/web2py/riP3IpRWYMA/rWFQnO7-9pgJ
>
> Here is how you configure the mail object (web2py book):
>
> http://www.web2py.com/books/default/chapter/29/08/emails-and-sms#Setting-up-email
>
>

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


[web2py] Re: How to declare a pre-defined sqlite database

2014-01-05 Thread Niphlod
"legacy" db are the ones that were not created in web2py applications. 
The concept behind is that you can still query whatever database you want 
just using db.define_table(.., migrate=False).
That being said, without an auto-incrementing column or a PK you'd loose 
quite a bit of DAL features/shortcuts. It's hard to tell if you're going to 
face those limitations without knowing what you want to do with those 
databases.

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Hi, 

I'm still searching, and I found in the web2py book something like this in 
widget section:

The "options" widget is used when a field's requires is IS_IN_SET or 
IS_IN_DB with multiple=False (default behavior).


I assumed, that if I change the 'requires' of field (after 
SQLFORM.dictform, see bellow), than the widget will change automatically, 
but it seems not working that way. What I should also change to get select 
in view (now it is still [probably default] input  field) ?


W dniu sobota, 4 stycznia 2014 18:26:10 UTC+1 użytkownik brushek napisał:
>
> Hello :)
>
> I have following code in controller:
>
> session.config = dict(NAME = 'a')
> form = SQLFORM.dictform(session.config)
> form.custom.widget.NAME ['requires'] 
> =IS_IN_SET
> (('a','b','c','d','e'), error_message="Choose between a and e")
>
>
>  if form.process().accepted: 
> session.config.update(form.vars)
>
>
>
> validator is working OK, but I would like to change the type of NAME field 
> in form to select dropdown, instead simple input. How to do this ? How to 
> change the type of field after it is created by any SQLFORM(.*)  ?
>
> Regards
> brushek
>

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


Re: [web2py] Re: converted url %3F and %3D

2014-01-05 Thread Kevin Bethke
well I want to make a redirekt and parse the url. thats the plan. So my
idea was to get every 404 error if there is %3F inside the requested url it
will redirekt you to the url where it is replaced by a ? the same thing for
the = Sign in all other cases it shows you the 404 page.
would that be possible?


On Sun, Jan 5, 2014 at 1:05 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> The function you seek for is urllib.unquote but without a concrete example
> of how the wrong link is generated I am not sure about how to apply that
> function.
>
>
> On Saturday, 4 January 2014 10:35:14 UTC-6, BlueShadow wrote:
>
>> External links to my side from a diffrent website i got no control over.
>> Thats the problem
>> Am 04.01.2014 13:21 schrieb "Massimo Di Pierro" :
>>
>>> How are you generating those links? Can you show the code?
>>>
>>> On Saturday, 4 January 2014 05:57:10 UTC-6, BlueShadow wrote:

 Hi,
 for some reason some external links converted the ?id=10 in one of my
 urls to %3Fid%3D10 my question is how can I convert that request back to
 the existing url. Preferably for all sites if it should happen again.
 Do I have to do some nginx magic to do that or can it be done within
 web2py?
 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/web2py/dqxeN7fQS-Y/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/dqxeN7fQS-Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


[web2py] Re: How to declare a pre-defined sqlite database

2014-01-05 Thread pythonic . jonathan
Thanks. That allows me to narrow it down to two questions:

1) I'm just going to want to use various select queries against 
views/tables (including joins) in the "legacy" database, nothing else. This 
database will never need to be altered by web2py. Will I be able to do that?

2) If I want to do want to write anything, I guess web2py will let me have 
a separate native database which I can use for that. You can have multiple 
databases right? A mix for native and legacy? Neither will need to interact 
directly with the other and the logical separation would be well suited to 
this application.

Cheers.

On Sunday, January 5, 2014 9:44:30 AM UTC, Niphlod wrote:
>
> "legacy" db are the ones that were not created in web2py applications. 
> The concept behind is that you can still query whatever database you want 
> just using db.define_table(.., migrate=False).
> That being said, without an auto-incrementing column or a PK you'd loose 
> quite a bit of DAL features/shortcuts. It's hard to tell if you're going to 
> face those limitations without knowing what you want to do with those 
> databases.
>
>

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


[web2py] convert dict to gluon.dal.Row

2014-01-05 Thread lucas
hey everyone,

what is the best way to convert a dict with appropriate key names to a row 
of a table?

thanx in advance, lucas

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


[web2py] Re: How to declare a pre-defined sqlite database

2014-01-05 Thread Niphlod


On Sunday, January 5, 2014 1:57:24 PM UTC+1, pythonic...@gmail.com wrote:
>
> Thanks. That allows me to narrow it down to two questions:
>
> 1) I'm just going to want to use various select queries against 
> views/tables (including joins) in the "legacy" database, nothing else. This 
> database will never need to be altered by web2py. Will I be able to do that?
>

sure, but don't expect being able to use something like db.table(5) as a 
shortcut 'cause the missing PK. selecting with the "usual" 
db(db.table.field == 'something').select() will work out of the box, unless 
your fields have some really strange names, but those can be circumvented.
 

>
> 2) If I want to do want to write anything, I guess web2py will let me have 
> a separate native database which I can use for that. You can have multiple 
> databases right? A mix for native and legacy? Neither will need to interact 
> directly with the other and the logical separation would be well suited to 
> this application.
>
>
yep, you can have as much dbs as you like.

db0 = DAL()
db1 = DAL()
db2 = DAL()

etc etc etc

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


Re: [web2py] Re: Where should I put my application logic code?

2014-01-05 Thread Alex
I've quite a lot model files (~40), so far the performance is still very 
good. Since it is not very optimal and also not good in the long run I'm 
now thinking of rewriting the code into modules.

I'm struggling a little bit to rewrite the functions. E.g. consider 
following function in a model:
@cache('room.count', 3600, cache.ram)
def getRoomCount():
  return db(db.room.id > 0).count()


how do I write this in a module so I can access cache?

thanks,
Alex

Am Mittwoch, 1. Januar 2014 03:01:18 UTC+1 schrieb Wei Li:
>
> Thank you all for the replies! 
>
>
> On Tue, Dec 31, 2013 at 1:10 PM, Phil Hughes 
> > wrote:
>
>> Add an argument to the function: foo(bar):  Only functions with no 
>> arguments can be called from the outside world.
>>
>>
>> On Tuesday, December 31, 2013 3:57:56 AM UTC-6, Wei Li wrote:
>>>
>>> Hi,
>>>
>>> This could be a silly question:) . I am going to build up some 
>>> application logic. So I will create a few class and functions. Looks like 
>>> it's not very good to put these code under controllers. Although from the 
>>> manual, it says controller folder is for application logic and workflow. 
>>> See if I have a function
>>>
>>> def foo():
>>>  return 
>>>
>>>
>>> I don't want to put this function in controllers/default.py because 
>>> people can see the return value of foo() through 
>>> http://myapp/default/foo which is not expected. I just want foo() to be 
>>> a normal function instead of a controller function.
>>>
>>> So my question is where is the best place to put my own application 
>>> logical codes indeed? There are three places that I can put python codes 
>>> into:
>>>
>>>
>>>- *models* describe a representation of the data as database tables 
>>>and relations between tables.
>>>- *controllers* describe the application logic and workflow.
>>>- *modules *are other optional Python modules.
>>>
>>>
>>> Looks like to me *modules *is the best place. But the new problem is 
>>> the global objects and classes are not visible to files in modules unlike 
>>> files in models/controllers. I am not sure which packages need to be 
>>> imported. It will be convenient if *modules *folder can be treated same 
>>> as models/controllers?
>>>
>>> Any suggestion is appreciated.
>>>
>>> Thanks,
>>> Wei
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.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/EqplHGT6SHI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

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


[web2py] Re: sessions and logout

2014-01-05 Thread Wonton
Thank you very much! Everything is clear to me now.

On Saturday, January 4, 2014 7:48:34 PM UTC+1, Anthony wrote:
>
> - A session file is created associated to a user each time that user logs 
>> in. Is this ok?
>>
>
> Yes, it is OK.
>  
>
>> - My users make a login through auth.login_bare(user, password), does 
>> this create a session file then?
>>
>
> Yes.
>  
>
>> - What should be the code to remove the session file of a user when 
>> he/she makes a logout?
>>
>
> The session filename is stored in response.session_filename, so you could 
> do it in an onlogout callback. Perhaps we should make this the default 
> whenever session.renew() is called (which happens by default when someone 
> logs in or out), since the old file gets abandoned at that point. Maybe 
> open an issue on Google Code and refer to this post.
>
> Also, there is a script you can use to periodically clean up the sessions: 
> https://github.com/web2py/web2py/blob/master/scripts/sessions2trash.py
>  
>
>> - I've set my auth.settings.expiration to 9, does this affect to 
>> sessions too? As far as I know it only affects to when an inactive user is 
>> automatically logged out, is this correct?
>>
>
> That won't affect the session. However, if you use the "remember me" 
> option at login, then auth.settings.long_expiration will determine how long 
> the session cookie remains valid (still won't have any effect on 
> keeping/removing the session file itself, though).
>  
>
>> - Testing this I've seen that with no logged users in my server, if I 
>> manually remove the sessions files, some of them are created again!! Why 
>> and how? As I said I have no users logged in the server.
>>
>
> A session file is created whenever a new visitor visits the site and 
> anything is saved to the session (whether or not the user is logged in). 
> Sessions are not used only for logged in users, but can be used for any 
> visitor. If you navigate to a page with a form (e.g., the login or register 
> pages), for example, the session will be used (to store the CSRF token) -- 
> even if you don't actually submit the form.
>
> Anthony
>

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


[web2py] Re: How to declare a pre-defined sqlite database

2014-01-05 Thread pythonic . jonathan
Thanks! I'll give it a go and see what happens. :-)

On Sunday, January 5, 2014 1:02:52 PM UTC, Niphlod wrote:
>
>
>
> On Sunday, January 5, 2014 1:57:24 PM UTC+1, pythonic...@gmail.com wrote:
>>
>> Thanks. That allows me to narrow it down to two questions:
>>
>> 1) I'm just going to want to use various select queries against 
>> views/tables (including joins) in the "legacy" database, nothing else. This 
>> database will never need to be altered by web2py. Will I be able to do that?
>>
>
> sure, but don't expect being able to use something like db.table(5) as a 
> shortcut 'cause the missing PK. selecting with the "usual" 
> db(db.table.field == 'something').select() will work out of the box, unless 
> your fields have some really strange names, but those can be circumvented.
>  
>
>>
>> 2) If I want to do want to write anything, I guess web2py will let me 
>> have a separate native database which I can use for that. You can have 
>> multiple databases right? A mix for native and legacy? Neither will need to 
>> interact directly with the other and the logical separation would be well 
>> suited to this application.
>>
>>
> yep, you can have as much dbs as you like.
>
> db0 = DAL()
> db1 = DAL()
> db2 = DAL()
>
> etc etc etc
>

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


[web2py] Audio Streaming View

2014-01-05 Thread Asher S
Hey all,
Still getting my grounding in web2py but I wanted to create a site that 
streams audio. I found a lovely guide 
by
 Massimo. 
But need help building a view around it. I tried things like 
{{=music.filename}} but no idea how to get that html5 player back.
Thanks!

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


[web2py] Change auth.wiki _create form

2014-01-05 Thread Ezer Silva
I'm trying to change the auth.wiki's _create form to put ckeditor as the 
widget. Is that possible?

Happy new year everybody and good luck to Massimo on the Edison Awards!

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


Re: [web2py] Re: Where should I put my application logic code?

2014-01-05 Thread Anthony
If you want to do it with a decorator, you can use @lazy_cache (see 
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules).
 
Otherwise, you can just use current.cache to store the return value of the 
function.

Anthony

On Sunday, January 5, 2014 8:13:59 AM UTC-5, Alex wrote:
>
> I've quite a lot model files (~40), so far the performance is still very 
> good. Since it is not very optimal and also not good in the long run I'm 
> now thinking of rewriting the code into modules.
>
> I'm struggling a little bit to rewrite the functions. E.g. consider 
> following function in a model:
> @cache('room.count', 3600, cache.ram)
> def getRoomCount():
>   return db(db.room.id > 0).count()
>
>
> how do I write this in a module so I can access cache?
>
> thanks,
> Alex
>
> Am Mittwoch, 1. Januar 2014 03:01:18 UTC+1 schrieb Wei Li:
>>
>> Thank you all for the replies! 
>>
>>
>> On Tue, Dec 31, 2013 at 1:10 PM, Phil Hughes  wrote:
>>
>>> Add an argument to the function: foo(bar):  Only functions with no 
>>> arguments can be called from the outside world.
>>>
>>>
>>> On Tuesday, December 31, 2013 3:57:56 AM UTC-6, Wei Li wrote:

 Hi,

 This could be a silly question:) . I am going to build up some 
 application logic. So I will create a few class and functions. Looks like 
 it's not very good to put these code under controllers. Although from the 
 manual, it says controller folder is for application logic and workflow. 
 See if I have a function

 def foo():
  return 


 I don't want to put this function in controllers/default.py because 
 people can see the return value of foo() through 
 http://myapp/default/foo which is not expected. I just want foo() to 
 be a normal function instead of a controller function.

 So my question is where is the best place to put my own application 
 logical codes indeed? There are three places that I can put python codes 
 into:


- *models* describe a representation of the data as database tables 
and relations between tables.
- *controllers* describe the application logic and workflow.
- *modules *are other optional Python modules.


 Looks like to me *modules *is the best place. But the new problem is 
 the global objects and classes are not visible to files in modules unlike 
 files in models/controllers. I am not sure which packages need to be 
 imported. It will be convenient if *modules *folder can be treated 
 same as models/controllers?

 Any suggestion is appreciated.

 Thanks,
 Wei

>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.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/EqplHGT6SHI/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>

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


[web2py] Re: convert dict to gluon.dal.Row

2014-01-05 Thread Anthony
from gluon.dal import Row
myrow = Row(mydict)

Anthony

On Sunday, January 5, 2014 8:00:03 AM UTC-5, lucas wrote:
>
> hey everyone,
>
> what is the best way to convert a dict with appropriate key names to a row 
> of a table?
>
> thanx in advance, lucas
>

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


[web2py] "invalid request" with a simple view

2014-01-05 Thread pythonic . jonathan
I'm starting at the start with trying to understand the structure of web2py 
and how it all fits together (reading books doesn't work for me).

To that end I've created a view, the entire content of which is:

> hello world


This is in a view file called "index.html" - I'm not extending anything, 
that's the entirety of the file. I am requesting it via this URL: 

http://localhost:8000/test/index.html (the project is called "test")
I also tried:
http://localhost:8000/test/default/index.html
But that complains "invalid controller (default/index)" - makes sense, 
there is no controller.

So, two questions come up:

a) What am I doing wrong? This seems like it's a simple as it gets.

b) How do I get web2py to give me useful debugging information that I can 
pursue? If I get "invalid request" every time I make a mistake this is 
going to take forever.

Thanks.

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


[web2py] Re: Change auth.wiki _create form

2014-01-05 Thread Ezer Silva
Actually I could alter web2py's code to allow me to pass an widget to the 
body as an argument, but I don't feel it's the best solution

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


[web2py] Appengine no longer works with

2014-01-05 Thread Pystar
I just upgraded to the latest version of web2py, and discovered that trying 
to use appengine locally and online no longer works and I can not view the 
error tickets spewed. Also, before I did this upgrade, my app worked 
perfectly with google app engine, is there something I need to know about 
this new web2py version? I am confused

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread Massimo Di Pierro
Unfortunately dictform does not support this. You can do:

session.config = dict(NAME = 'a')
form = 
SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'),
 
error_message="Choose between a and e")))
 if form.process().accepted: 
session.config['NAME'] = form.vars['NAME']



On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote:
>
> Hello :)
>
> I have following code in controller:
>
> session.config = dict(NAME = 'a')
> form = SQLFORM.dictform(session.config)
> form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), 
> error_message="Choose between a and e")
>  if form.process().accepted: 
> session.config.update(form.vars)
>
> validator is working OK, but I would like to change the type of NAME field 
> in form to select dropdown, instead simple input. How to do this ? How to 
> change the type of field after it is created by any SQLFORM(.*)  ?
>
> Regards
> brushek
>

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Massimo Di Pierro
The purpose of a view is that or converting the output of a controller 
action (a python function) into HTML.

you can have views/default/index.html containing only "hello world"

but you also need a file controllers/default.py containing "def index(): 
return dict()"


On Sunday, 5 January 2014 09:52:42 UTC-6, pythonic...@gmail.com wrote:
>
> I'm starting at the start with trying to understand the structure of 
> web2py and how it all fits together (reading books doesn't work for me).
>
> To that end I've created a view, the entire content of which is:
>
>> hello world
>
>
> This is in a view file called "index.html" - I'm not extending anything, 
> that's the entirety of the file. I am requesting it via this URL: 
>
> http://localhost:8000/test/index.html (the project is called "test")
> I also tried:
> http://localhost:8000/test/default/index.html
> But that complains "invalid controller (default/index)" - makes sense, 
> there is no controller.
>
> So, two questions come up:
>
> a) What am I doing wrong? This seems like it's a simple as it gets.
>
> b) How do I get web2py to give me useful debugging information that I can 
> pursue? If I get "invalid request" every time I make a mistake this is 
> going to take forever.
>
> Thanks.
>

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


[web2py] Re: Appengine no longer works with

2014-01-05 Thread Massimo Di Pierro
Can you please tell us how you upgraded and aht you mean by no-longer works?

The changes are mostly motivated by the fact that GAE changed (no more 
support for python 2.5, etc.)

Massimo

On Sunday, 5 January 2014 09:58:09 UTC-6, Pystar wrote:
>
> I just upgraded to the latest version of web2py, and discovered that 
> trying to use appengine locally and online no longer works and I can not 
> view the error tickets spewed. Also, before I did this upgrade, my app 
> worked perfectly with google app engine, is there something I need to know 
> about this new web2py version? I am confused
>

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


Re: [web2py] Re: Where should I put my application logic code?

2014-01-05 Thread Alex
thanks Anthony!

it's working with lazy_cache decorator. I guess the @ is missing in the 
documentation example:
lazy_cache('key', time_expire=60, cache_model='ram')
def f(a,b,c,): 

Alex

Am Sonntag, 5. Januar 2014 16:20:37 UTC+1 schrieb Anthony:
>
> If you want to do it with a decorator, you can use @lazy_cache (see 
> http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules).
>  
> Otherwise, you can just use current.cache to store the return value of the 
> function.
>
> Anthony
>
> On Sunday, January 5, 2014 8:13:59 AM UTC-5, Alex wrote:
>>
>> I've quite a lot model files (~40), so far the performance is still very 
>> good. Since it is not very optimal and also not good in the long run I'm 
>> now thinking of rewriting the code into modules.
>>
>> I'm struggling a little bit to rewrite the functions. E.g. consider 
>> following function in a model:
>> @cache('room.count', 3600, cache.ram)
>> def getRoomCount():
>>   return db(db.room.id > 0).count()
>>
>>
>> how do I write this in a module so I can access cache?
>>
>> thanks,
>> Alex
>>
>> Am Mittwoch, 1. Januar 2014 03:01:18 UTC+1 schrieb Wei Li:
>>>
>>> Thank you all for the replies! 
>>>
>>>
>>> On Tue, Dec 31, 2013 at 1:10 PM, Phil Hughes  wrote:
>>>
 Add an argument to the function: foo(bar):  Only functions with no 
 arguments can be called from the outside world.


 On Tuesday, December 31, 2013 3:57:56 AM UTC-6, Wei Li wrote:
>
> Hi,
>
> This could be a silly question:) . I am going to build up some 
> application logic. So I will create a few class and functions. Looks like 
> it's not very good to put these code under controllers. Although from the 
> manual, it says controller folder is for application logic and workflow. 
> See if I have a function
>
> def foo():
>  return 
>
>
> I don't want to put this function in controllers/default.py because 
> people can see the return value of foo() through 
> http://myapp/default/foo which is not expected. I just want foo() to 
> be a normal function instead of a controller function.
>
> So my question is where is the best place to put my own application 
> logical codes indeed? There are three places that I can put python codes 
> into:
>
>
>- *models* describe a representation of the data as database 
>tables and relations between tables.
>- *controllers* describe the application logic and workflow.
>- *modules *are other optional Python modules.
>
>
> Looks like to me *modules *is the best place. But the new problem is 
> the global objects and classes are not visible to files in modules unlike 
> files in models/controllers. I am not sure which packages need to be 
> imported. It will be convenient if *modules *folder can be treated 
> same as models/controllers?
>
> Any suggestion is appreciated.
>
> Thanks,
> Wei
>
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.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/EqplHGT6SHI/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>

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


[web2py] routes.py Problem

2014-01-05 Thread Rockiger
Hello together,

I have a problem with routes.py. My goal is it to have a English and a 
German (de) version of my site:

I have the following code in there:

routers = dict(
# base router
BASE = dict(
default_application = 'rockiger',
),
rockiger = dict(
default_language = 'de',
languages = ['en', 'de'],
map_static = True,
),
)

According to the web2py cookbook there should be  now a request.lang 
variable, but I can't it. Has anybody a idea what the problem could be?

Best,

Marco

-- 
*Rockiger UG (haftungsbeschränkt)*
Marco-Alexander Laspe | Geschäftsführer
Neugasse 3 | 65183 Wiesbaden
Tel: +49 611 9713 9716 | ma...@rockiger.com
---
Registergericht: Amtsgericht Wiesbaden
Registernummer: HRB 25489
---
Jetzt zu haben: Rockiger ThinkPad - Freie Rechner
http://rockiger.com/de/domainfactory/

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


[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Thank You Masimo for answer,

Hm... so this is huge problem for me, because I have in dict many other 
options (I showed only one field to show the problem). Is there any easy 
way to append or insert Field (with corect select option generated in the 
view) to the form created by SQLFORM.dictform ? Or, to change the 
SQLFORM.dictform to SQLFORM.factory, but factory need to take dict with 
(many) fields ? I was very happy to see dictform - it perfectly fit into 
the config setter/updater for me, last thing I needed is to make select for 
some of the fields :(. 

Regards
brushek




W dniu niedziela, 5 stycznia 2014 17:07:09 UTC+1 użytkownik Massimo Di 
Pierro napisał:
>
> Unfortunately dictform does not support this. You can do:
>
> session.config = dict(NAME = 'a')
> form = 
> SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'),
>  
> error_message="Choose between a and e")))
>  if form.process().accepted: 
> session.config['NAME'] = form.vars['NAME']
>
>
>
> On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote:
>>
>> Hello :)
>>
>> I have following code in controller:
>>
>> session.config = dict(NAME = 'a')
>> form = SQLFORM.dictform(session.config)
>> form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), 
>> error_message="Choose between a and e")
>>  if form.process().accepted: 
>> session.config.update(form.vars)
>>
>> validator is working OK, but I would like to change the type of NAME 
>> field in form to select dropdown, instead simple input. How to do this ? 
>> How to change the type of field after it is created by any SQLFORM(.*)  ?
>>
>> Regards
>> brushek
>>
>

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


Re: [web2py] routes.py Problem

2014-01-05 Thread Jonathan Lundell
On 5 Jan 2014, at 8:44 AM, Rockiger  wrote:
> Hello together,
> 
> I have a problem with routes.py. My goal is it to have a English and a German 
> (de) version of my site:
> 
> I have the following code in there:
> 
> routers = dict(
> # base router
> BASE = dict(
> default_application = 'rockiger',
> ),
> rockiger = dict(
> default_language = 'de',
> languages = ['en', 'de'],
> map_static = True,
> ),
> )
> 
> According to the web2py cookbook there should be  now a request.lang 
> variable, but I can't it. Has anybody a idea what the problem could be?
> 

There may be a bug, or there may be a documentation problem.

The example file claims that it's being set in request.language, not 
request.lang, but as I look at it, I don't see where, and there's no unit test 
for it.

Would you please dump your entire request object and see if the language shows 
up anywhere (aside from I guess the original 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/groups/opt_out.


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread pythonic . jonathan
Thanks, I'm on example 3 which is the one this is based on. My issue isn't 
that even something this simple isn't working and I don't know why.

In fact, I've already tried the controller thing (example 3) and got the 
same error (same error). So  I went back to basics and converted to 
"hello world". But that doesn't work either.

So the more complex example is:

My controller is called index.py:

> def index():
> return dict(message=T("Hello World"))


And now I've edited my view to:

> hello world
> {{=message}}


The same url is giving me the same error.

So I'm stuck with my original two questions:

a) What am I doing wrong? This seems like it's a simple as it gets.

b) How do I get web2py to give me useful debugging information that I can 
pursue? If I get "invalid request" every time I make a mistake this is 
going to take forever.


On Sunday, January 5, 2014 4:09:25 PM UTC, Massimo Di Pierro wrote:
>
> The purpose of a view is that or converting the output of a controller 
> action (a python function) into HTML.
>
> you can have views/default/index.html containing only "hello 
> world"
>
> but you also need a file controllers/default.py containing "def index(): 
> return dict()"
>
>
> On Sunday, 5 January 2014 09:52:42 UTC-6, pythonic...@gmail.com wrote:
>>
>> I'm starting at the start with trying to understand the structure of 
>> web2py and how it all fits together (reading books doesn't work for me).
>>
>> To that end I've created a view, the entire content of which is:
>>
>>> hello world
>>
>>
>> This is in a view file called "index.html" - I'm not extending anything, 
>> that's the entirety of the file. I am requesting it via this URL: 
>>
>> http://localhost:8000/test/index.html (the project is called "test")
>> I also tried:
>> http://localhost:8000/test/default/index.html
>> But that complains "invalid controller (default/index)" - makes sense, 
>> there is no controller.
>>
>> So, two questions come up:
>>
>> a) What am I doing wrong? This seems like it's a simple as it gets.
>>
>> b) How do I get web2py to give me useful debugging information that I can 
>> pursue? If I get "invalid request" every time I make a mistake this is 
>> going to take forever.
>>
>> Thanks.
>>
>

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Annet


>
> My controller is called index.py:
>
>> def index():
>> return dict(message=T("Hello World"))
>
>

In that case your url should be http://localhost:8000/test/index/index

 

>
> And now I've edited my view to:
>
>> hello world
>> {{=message}}
>
>
>  
and your view should be in views/index/index.html

in web2py the url has the following pattern 
host:port/application/controller/function


Regards,

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread pythonic . jonathan
Sorry, but that doesn't seem to do it either.

I've tried all of the following.

Error "invalid view (index/index.html)"
http://localhost:8000/test/index/index.html
http://localhost:8000/test/index/index
http://localhost:8000/test/index

And the following all give: "invalid controller (views/index)"
http://localhost:8000/test/views/index/index
http://localhost:8000/test/views/index

So still no progress. More descriptive error messages would be useful. Is 
there no way to enable some during development?

Thanks,
Jonathan

On Sunday, January 5, 2014 6:16:57 PM UTC, Annet wrote:
>
>
>
>> My controller is called index.py:
>>
>>> def index():
>>> return dict(message=T("Hello World"))
>>
>>
>
> In that case your url should be http://localhost:8000/test/index/index
>
>  
>
>>
>> And now I've edited my view to:
>>
>>> hello world
>>> {{=message}}
>>
>>
>>  
> and your view should be in views/index/index.html
>
> in web2py the url has the following pattern 
> host:port/application/controller/function
>
>
> Regards,
>
> 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/groups/opt_out.


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Anthony
On Sunday, January 5, 2014 10:52:42 AM UTC-5, pythonic...@gmail.com wrote:
>
> I'm starting at the start with trying to understand the structure of 
> web2py and how it all fits together (reading books doesn't work for me).
>

I think you should consider going through at least some of the 
documentation, as it will be frustrating for you and for us if you just try 
random things and keep asking questions about what you're doing wrong. The 
Overview chapter is a tutorial -- read the Intro and Overview at least to 
get started. If you want to experiment, it may be easier to start with the 
scaffolding app and modify it rather than starting to create files from 
scratch before you know how anything works.

Anthony

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


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

2014-01-05 Thread Alan Etkin

>
> Sorry for late reply man. I checked the same no luck in that... !! 
> :(
>

Please post the output of mail.result and mail.error after the call to 
.send() 

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Anthony
Not sure how much more descriptive it can be -- in the first case, it is 
saying there is no index/index.html view in the /views folder, and in the 
second, it is saying there is no "views" controller (the request is for 
views/index). To understand how and where to create views and controllers, 
you should peek at the documentation for a few minutes.

Anthony

On Sunday, January 5, 2014 2:06:14 PM UTC-5, pythonic...@gmail.com wrote:
>
> Sorry, but that doesn't seem to do it either.
>
> I've tried all of the following.
>
> Error "invalid view (index/index.html)"
> http://localhost:8000/test/index/index.html
> http://localhost:8000/test/index/index
> http://localhost:8000/test/index
>
> And the following all give: "invalid controller (views/index)"
> http://localhost:8000/test/views/index/index
> http://localhost:8000/test/views/index
>
> So still no progress. More descriptive error messages would be useful. Is 
> there no way to enable some during development?
>
> Thanks,
> Jonathan
>
> On Sunday, January 5, 2014 6:16:57 PM UTC, Annet wrote:
>>
>>
>>
>>> My controller is called index.py:
>>>
 def index():
 return dict(message=T("Hello World"))
>>>
>>>
>>
>> In that case your url should be http://localhost:8000/test/index/index
>>
>>  
>>
>>>
>>> And now I've edited my view to:
>>>
 hello world
 {{=message}}
>>>
>>>
>>>  
>> and your view should be in views/index/index.html
>>
>> in web2py the url has the following pattern 
>> host:port/application/controller/function
>>
>>
>> Regards,
>>
>> 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/groups/opt_out.


Re: [web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Jonathan Lundell
On 5 Jan 2014, at 11:53 AM, Anthony  wrote:
> On Sunday, January 5, 2014 10:52:42 AM UTC-5, pythonic...@gmail.com wrote:
> I'm starting at the start with trying to understand the structure of web2py 
> and how it all fits together (reading books doesn't work for me).
> 
> I think you should consider going through at least some of the documentation, 
> as it will be frustrating for you and for us if you just try random things 
> and keep asking questions about what you're doing wrong. The Overview chapter 
> is a tutorial -- read the Intro and Overview at least to get started. If you 
> want to experiment, it may be easier to start with the scaffolding app and 
> modify it rather than starting to create files from scratch before you know 
> how anything works.
> 

I'd also be inclined to avoid name collisions between controllers and functions 
("index"), at least until you have the basic site working. At the very least, 
those collisions limit the shortening that the parametric router can do, and at 
worst it might be exposing a bug that needs fixing. (If it's a bug, we'd like 
to know, but it's not the place to start.)

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


[web2py] drop question

2014-01-05 Thread Alex Glaros
Tried to drop a table and got an error perhaps due to reference to other 
table but the error message misspelled "Organization" as "Orgnization" but 
I can't find any reference to Orgnization.  Doesn't that mean I had 
"Organization" misspelled somewhere?  If yes, where?


In [2] : db.Party.drop()
Traceback (most recent call last):
  File "/home/mdipierro/make_web2py/web2py/gluon/contrib/shell.py", line 
234, in run
  File "", line 1, in 
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8919, in drop
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1281, in drop
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1916, in 
execute
  File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1910, in 
log_execute
OperationalError: no such table: main.Orgnization

thanks,

Alex Glaros

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


[web2py] cpdb from sqlite to postgresql

2014-01-05 Thread Martin Weissenboeck
I want to change from sqlite to postgresql.

At first I have installed postgresql and prepared everything as described
in the book. Next I have built a sample application
 with a line like

db1 = DAL("postgres://web2py:web2py123@localhost:5432/securedb")

Works fine!

Now I have tried cpdb ( I have broken the lines for better readablity):

root@test:/home/www-data/web2py# python scripts/cpdb.py
-f applications/postgesql_test/databases
-y sqlite://storage.sqlite
-Y postgres://web2py:web2py123@localhost:5432/securedb
-d gluon/
-t False

The result is an error message:

EXCEPTION: could not make a copy of the database
Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "gluon/dal.py", line 7766, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "gluon/dal.py", line 2756, in __init__
if do_connect: self.find_driver(adapter_args,uri)
  File "gluon/dal.py", line 795, in find_driver
raise RuntimeError("no driver available %s" % str(self.drivers))
RuntimeError: no driver available ('psycopg2', 'pg8000')

Next try - a copy from sqlite to sqlite

root@test:/home/www-data/web2py# python scripts/cpdb.py
   -f applications/postgresql_test/databases
   -y sqlite://storage.sqlite
   -Y sqlite://storage2.sqlite
   -F applications/postgresql_test/databases
   -d gluon/ -t False

creating tables...
exporting data...
importing data...
done!

Ok, no problem - cpdb works.
And now the interactive version:

root@test:/home/www-data/web2py# python scripts/cpdb.py
   -f applications/postgresql_test/databases
   -y sqlite://storage.sqlite
   -Y postgres://web2py:web2py123@localhost:5432/securedb
   -d gluon/ -t False -i

>>> t=DAL("postgres://web2yp:web2py123@localhost:5432/securedb",
folder=None)
sorry, can not do that!
Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "gluon/dal.py", line 7766, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "gluon/dal.py", line 2756, in __init__
if do_connect: self.find_driver(adapter_args,uri)
  File "gluon/dal.py", line 795, in find_driver
raise RuntimeError("no driver available %s" % str(self.drivers))
RuntimeError: no driver available ('psycopg2', 'pg8000')


I have tried DAL calls like DAL("postgres:psycopg2:") and
DAL("postgres:pg8000:") - similar results.

Any ideas?
Regards, Martin



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


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

2014-01-05 Thread Michele Comitini
In bocca al lupo!

>From your mountains:
https://it.wikipedia.org/wiki/Canis_lupus_italicus

;-)



2014/1/5 Mirko Scavazzin 

> Way to go !!
> Congrats !
>
>
> 2014/1/5 Cliff Kachinske 
>
>> Best of luck.
>>
>> Hope you (and web2py) bring back an award.
>>
>>
>> On Friday, January 3, 2014 11:08:38 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> Web2py/me have been nominated for the Edison Award. Please wish web2py
>>> (and me) good luck. :-)
>>>
>>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


[web2py] extend the permissions

2014-01-05 Thread www.diazluis.com
Greetings to all and happy 2014!
I'm using oauth facebook.
I can extaer basic user data and contact list.
but now need to extend the permissions to see the list of groups, upload 
pictures, post.

documentation of facebook, how to extend the permit, is not clear to me. in 
the way in which I deploy web2py.

Great maid! aid.

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


Re: [web2py] Important New Year News: PyCon 2014 Tutorial

2014-01-05 Thread Michele Comitini
+1
Good job Clifford!


2014/1/4 Massimo Di Pierro 

> There will be a web2py tutorial at PyCon 2014.
>
> https://us.pycon.org/2014/schedule/presentation/133/
>
> Congratulations to Clifford Williams for proposing the tutorial and
> passing the selection process.
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


[web2py] Why web2py and AnguljarJS?

2014-01-05 Thread Ruud Schroen
I see more and more about using angularjs with web2py.

But why? What would be an example of a benefit from using those two.
Cause when i look at AngularJS, it already looks alot like web2py.

Not saying that it's a bad idea, just wondering ;)

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread pythonic . jonathan

>
>
> I think you should consider going through at least some of the 
> documentation, as it will be frustrating for you and for us if you just try 
> random things and keep asking questions about what you're doing wrong. The 
> Overview chapter is a tutorial -- read the Intro and Overview at least to 
> get started. If you want to experiment, it may be easier to start with the 
> scaffolding app and modify it rather than starting to create files from 
> scratch before you know how anything works.
>
> I've taken a glance at it, but the Overview section alone is ~12,000 words 
- that's a *lot* given it's a technical manual rather than a light bedtime 
read. Instead I'm working through the examples because I learn better that 
way: http://www.web2py.com/examples/default/examples

in the first case, it is saying there is no index/index.html view in the 
> /views folder

I disagree. It's saying "invalid view". That *could* mean that it doesn't 
exist, but from a English-language perspective, it could mean countless 
other things as well including that there's something wrong with it. HTTP 
has header response codes - if it's missing it ideally would return a 404. 
If there's something wrong it should be returning a 500, etc.

To understand how and where to create views and controllers, you should 
> peek at the documentation for a few minutes.

I have and I believe I understand how to. The reason I tried * /views/index*is 
because that's what Annet said (or how I read her post anyway).


==

So, I've now started again. Process:
1) "New Simple Application" - Name - "Test2"
2)  "Manage"  -> Edit
3) Create a controller called *controller.py*. Using the editor I put this 
in it (from example 3):
def hello3():
return dict(message=T("Hello World"))
4) Create a view called *view.html*, put this in it:
hello world
{{=message}}
5) Go to this URL:
http://localhost:8000/test2/controller/hello3

And it works.

Except it also includes all the other gumpf from the default example - why?

In my previous examples I'd deleted all the extra files. I've now done that 
again (absolutely everything deleted except those files. Now I'm back to 
the error:

invalid view (controller/hello3.html)

So why can't I delete stuff? And/or what is it using the layout stuff when 
it's not specified?

I thought deleting everything was OK based on a post I read by Massimo here 
somewhere.

Thanks.
 

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


[web2py] How to structure json from database query

2014-01-05 Thread pix
Hello, I would like to use a web2py json service but I am not sure how to 
create the database query to do what I want to output the correct json.

This is what I have atm:

@service.json
def places():
project_info = db(db.project_info.id > 
0).select(orderby=~db.project_info.id) 
project_updates = db(db.project_updates.project == 
db.project_info.id).select(db.project_updates.ALL, 
orderby=~db.project_updates.id, limitby=(0, 3))   
humans = db(db.human_resources.project_id == 
db.project_info.id).select(db.human_resources.ALL, 
orderby=db.human_resources.full_name) 
return project_info, project_updates, humans

I would like to have project_updates and humans as sub queries of 
project_info so they can intertwine with the outputted json. 

Here is the structure of those tables and how I am calling the data using 
Javascript any advice is greatly appreciated:

*cheers

 DATABASE STRUCTURE ###

db.define_table('project_info',
Field('userinfo', db.auth_user, default=auth.user_id, writable=False, 
readable=False),
Field('project_title', requires=IS_NOT_EMPTY(), notnull=True),
Field('twitter', db.twitter, requires=IS_IN_DB(db, 
db.twitter,'%(screen_name)s')),
Field('country', requires=IS_NOT_EMPTY(), notnull=True),
Field('province', label='Province/State', requires=IS_NOT_EMPTY(), 
notnull=True),
Field('city', label='City', requires=IS_NOT_EMPTY(), notnull=True),
Field('address', label='Address', requires=IS_NOT_EMPTY(), 
notnull=True),
Field('latitude', requires=IS_NOT_EMPTY(), notnull=True),
Field('longitude', requires=IS_NOT_EMPTY(), notnull=True),
Field('general_info', 'text'),
Field('created_on', 'datetime', default=request.now, writable=False, 
readable=False))

db.define_table('project_updates',
Field('userinfo', db.auth_user, default=auth.user_id, writable=False, 
readable=False),
Field('project', db.project_info, requires=IS_IN_DB(db, 
db.project_info,'%(id)s'),
  comment='Choose your Project'), 
Field('title'),
Field('update_info', 'text'),
Field('created_on', 'datetime', default=request.now, writable=False, 
readable=False))

db.define_table('human_resources',
Field('userinfo', db.auth_user, default=auth.user_id, writable=False, 
readable=False),
Field('project_id', db.project_info, requires=IS_IN_DB(db, 
db.project_info,'%(id)s'),
  comment='Choose Project to associate user to'),
Field('full_name'),
Field('image','upload', label='Avatar', autodelete=True, 
requires=IS_EMPTY_OR([IS_IMAGE(extensions=('png', 'gif', 'jpg', 'jpeg')), 
RESIZE(600, 600)])),
Field('image_thumb', 'upload', compute=lambda r: THUMB(r['image'])),
Field('contact_phone'),
Field('contact_cell'),
Field('contact_email'),
Field('contact_mail_address'),
Field('position'),
Field('info', 'text'),
Field('created_on', 'datetime', default=request.now, writable=False, 
readable=False))


### Javascript #
$.getJSON("{{=URL(r=request, f='call', args=['json','places'])}}", 
function(places) {
  $(places).each(function(i, v) {
  var place = this;
  var marker = new google.maps.Marker({
position: new google.maps.LatLng(place[i].latitude, 
place[i].longitude),
map:  map,
title:place[i].project_title,
 });
  
  google.maps.event.addListener(marker, 'click', function() {
  var hidingMarker = currentPlace;
  var slideIn = function(marker) {
  
  $('.headerTabOne').text(place[i].project_title);
  $('.paraTabOne').text(place[i].general_info);
  
  $('.headerTabTwo').text(place[i][v].title);
  $('.paraTabTwo').text(place[i][v].update_info);
  $('.date_info').text(place[i][v].created_on);
  
  //$('.avatar').prepend("");
  $('.infoTabThree').text(place[i][v].info);
  $('.paraTabThree').text(place[i][v].full_name);
 

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


[web2py] OFF TOPIC - deployd

2014-01-05 Thread António Ramos
I like it

http://www.deployd.com/

I can imagine DAL as an equivalent and having a DAL.js to be used in the
client to connect to the DAL server using websockets.

worth a try looking.


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


Re: [web2py] Re: Where should I put my application logic code?

2014-01-05 Thread Alex
It's working fine locally but when I try to run it on the server (compiled 
application) I get the following error:

ImportError: No module named myapp.modules.room

any idea what I could be missing?
on the server the module .py files are under myapp/modules 

Alex

Am Sonntag, 5. Januar 2014 17:25:14 UTC+1 schrieb Alex:
>
> thanks Anthony!
>
> it's working with lazy_cache decorator. I guess the @ is missing in the 
> documentation example:
> lazy_cache('key', time_expire=60, cache_model='ram')
> def f(a,b,c,): 
>
> Alex
>
> Am Sonntag, 5. Januar 2014 16:20:37 UTC+1 schrieb Anthony:
>>
>> If you want to do it with a decorator, you can use @lazy_cache (see 
>> http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules).
>>  
>> Otherwise, you can just use current.cache to store the return value of the 
>> function.
>>
>> Anthony
>>
>> On Sunday, January 5, 2014 8:13:59 AM UTC-5, Alex wrote:
>>>
>>> I've quite a lot model files (~40), so far the performance is still very 
>>> good. Since it is not very optimal and also not good in the long run I'm 
>>> now thinking of rewriting the code into modules.
>>>
>>> I'm struggling a little bit to rewrite the functions. E.g. consider 
>>> following function in a model:
>>> @cache('room.count', 3600, cache.ram)
>>> def getRoomCount():
>>>   return db(db.room.id > 0).count()
>>>
>>>
>>> how do I write this in a module so I can access cache?
>>>
>>> thanks,
>>> Alex
>>>
>>> Am Mittwoch, 1. Januar 2014 03:01:18 UTC+1 schrieb Wei Li:

 Thank you all for the replies! 


 On Tue, Dec 31, 2013 at 1:10 PM, Phil Hughes  wrote:

> Add an argument to the function: foo(bar):  Only functions with no 
> arguments can be called from the outside world.
>
>
> On Tuesday, December 31, 2013 3:57:56 AM UTC-6, Wei Li wrote:
>>
>> Hi,
>>
>> This could be a silly question:) . I am going to build up some 
>> application logic. So I will create a few class and functions. Looks 
>> like 
>> it's not very good to put these code under controllers. Although from 
>> the 
>> manual, it says controller folder is for application logic and workflow. 
>> See if I have a function
>>
>> def foo():
>>  return 
>>
>>
>> I don't want to put this function in controllers/default.py because 
>> people can see the return value of foo() through 
>> http://myapp/default/foo which is not expected. I just want foo() to 
>> be a normal function instead of a controller function.
>>
>> So my question is where is the best place to put my own application 
>> logical codes indeed? There are three places that I can put python codes 
>> into:
>>
>>
>>- *models* describe a representation of the data as database 
>>tables and relations between tables.
>>- *controllers* describe the application logic and workflow.
>>- *modules *are other optional Python modules.
>>
>>
>> Looks like to me *modules *is the best place. But the new problem is 
>> the global objects and classes are not visible to files in modules 
>> unlike 
>> files in models/controllers. I am not sure which packages need to be 
>> imported. It will be convenient if *modules *folder can be treated 
>> same as models/controllers?
>>
>> Any suggestion is appreciated.
>>
>> Thanks,
>> Wei
>>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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/EqplHGT6SHI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



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


Re: [web2py] Re: Where should I put my application logic code?

2014-01-05 Thread 黄祥
i think it related with module name, try to change your module file name 
into unique name. i usually use the app name with the controller file name. 
e.g.
modules/myapp_mycontroller.py
of course you can use whatever module file name as you want, but please 
make it unique.

best regards,
stifan

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


[web2py] Re: How to structure json from database query

2014-01-05 Thread 黄祥
web2py have the table field type 'json', had you already try that?

ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation

best regards,
stifan

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


Re: [web2py] Why web2py and AnguljarJS?

2014-01-05 Thread António Ramos
I´m using angular recently and for UI Experience its something out of this
world. Well, almost ...  :)

With angular its very easy to recalc every dom element without goind to the
server and refresh the page.
Without angular you have to code a lot more with plain javascript or using
ajax to tell the server to do the dirty work.

I prefer the angular way.






2014/1/5 Ruud Schroen 

> I see more and more about using angularjs with web2py.
>
> But why? What would be an example of a benefit from using those two.
> Cause when i look at AngularJS, it already looks alot like web2py.
>
> Not saying that it's a bad idea, just wondering ;)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


[web2py] Re: "invalid request" with a simple view

2014-01-05 Thread Anthony

>
> I've taken a glance at it, but the Overview section alone is ~12,000 words 
> - that's a *lot* given it's a technical manual rather than a light bedtime 
> read. Instead I'm working through the examples because I learn better that 
> way: http://www.web2py.com/examples/default/examples
>

You don't have to read it all, but go through the beginning. This 
sectionshould
 help. Also have a look at 
http://web2py.com/books/default/chapter/29/04/the-core#Workflow and 
http://web2py.com/books/default/chapter/29/04/the-core#Dispatching. 
 

> in the first case, it is saying there is no index/index.html view in the 
>> /views folder
>
> I disagree. It's saying "invalid view". That *could* mean that it doesn't 
> exist, but from a English-language perspective, it could mean countless 
> other things as well including that there's something wrong with it. HTTP 
> has header response codes - if it's missing it ideally would return a 404. 
> If there's something wrong it should be returning a 500, etc.
>

It is in fact returning a 404.

To understand how and where to create views and controllers, you should 
>> peek at the documentation for a few minutes.
>
> I have and I believe I understand how to.
>

Not yet. Read through the above links.
 

> The reason I tried * /views/index* is because that's what Annet said (or 
> how I read her post anyway).
>

No, she said your view should be in /views/index/index.html -- that's a 
file path, not a URL.
 

> So, I've now started again. Process:
> 1) "New Simple Application" - Name - "Test2"
> 2)  "Manage"  -> Edit
> 3) Create a controller called *controller.py*. Using the editor I put 
> this in it (from example 3):
> def hello3():
> return dict(message=T("Hello World"))
> 4) Create a view called *view.html*, put this in it:
>

No, the view must have the following file path /views/[name of the 
controller]/[name of the function].extension. It's in the documentation. 
You can use an alternative name and location, but then you have to tell 
web2py by specifying response.view.
 

> hello world
> {{=message}}
> 5) Go to this URL:
> http://localhost:8000/test2/controller/hello3
>
> And it works.
>

Not quite. It is ignoring your view. In case the view isn't found, if you 
are using the scaffolding app and on localhost, it will fall back to the 
/views/generic.html view. 

I thought deleting everything was OK based on a post I read by Massimo here 
> somewhere.
>

Yes, you can delete everything and start from scratch, but you need files 
named and located according to the proper conventions.

Again, if you just want to play around, start with the scaffolding app and 
make some tweaks or follow through the examples in the Overview chapter. If 
you want to delete everything and start from scratch, you'll have to 
understand better how things work, and that's simply going to require doing 
some reading.

Anthony

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


Re: [web2py] drop question

2014-01-05 Thread Marco Mansilla
El Sun, 5 Jan 2014 12:22:00 -0800 (PST)
Alex Glaros  escribió:

> Tried to drop a table and got an error perhaps due to reference to
> other table but the error message misspelled "Organization" as
> "Orgnization" but I can't find any reference to Orgnization.  Doesn't
> that mean I had "Organization" misspelled somewhere?  If yes, where?
> 
> 
> In [2] : db.Party.drop()
> Traceback (most recent call last):
>   File "/home/mdipierro/make_web2py/web2py/gluon/contrib/shell.py",
> line 234, in run
>   File "", line 1, in 
>   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8919,
> in drop File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line
> 1281, in drop File "/home/mdipierro/make_web2py/web2py/gluon/dal.py",
> line 1916, in execute
>   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1910,
> in log_execute
> OperationalError: no such table: main.Orgnization
> 
> thanks,
> 
> Alex Glaros
> 

Have you declared your tables in regular model files in /models or in
modules?, would you share the table declaration code?.

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


Re: [web2py] drop question

2014-01-05 Thread Alex Glaros
Thanks Marco,

I have too many sqlLite constraint violations.  I'm just going to delete 
all tables and add them one at at time.  That should do it.

Alex Glaros



On Sunday, January 5, 2014 6:13:16 PM UTC-8, marco mansilla wrote:
>
> El Sun, 5 Jan 2014 12:22:00 -0800 (PST) 
> Alex Glaros > escribió: 
>
> > Tried to drop a table and got an error perhaps due to reference to 
> > other table but the error message misspelled "Organization" as 
> > "Orgnization" but I can't find any reference to Orgnization.  Doesn't 
> > that mean I had "Organization" misspelled somewhere?  If yes, where? 
> > 
> > 
> > In [2] : db.Party.drop() 
> > Traceback (most recent call last): 
> >   File "/home/mdipierro/make_web2py/web2py/gluon/contrib/shell.py", 
> > line 234, in run 
> >   File "", line 1, in  
> >   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 8919, 
> > in drop File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 
> > 1281, in drop File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", 
> > line 1916, in execute 
> >   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1910, 
> > in log_execute 
> > OperationalError: no such table: main.Orgnization 
> > 
> > thanks, 
> > 
> > Alex Glaros 
> > 
>
> Have you declared your tables in regular model files in /models or in 
> modules?, would you share the table declaration code?. 
>

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


[web2py] Re: Getting a 'list' object has no attribute 'xml' error when exporting smartgrid data in HTML format.

2014-01-05 Thread Rahul
To be more specific, this ticket is raised if you have applied a filter to 
your grid and then you try to export in HTML format. Any one encountered 
the same ?

Rahul

On Tuesday, December 31, 2013 4:12:22 PM UTC+5:30, Rahul wrote:
>
> Hi All,
>   I am getting below exception under web2py 2.8.2 when I am exporting 
> the smartgrid in HTML format (SmartGrid attribute used csv=True) . 
>
> *Steps*:  Try to export a table (smartGrid) data in csv format, it works 
> fine, later try to export it in HTML and it shows below ticket. 
>
>
> *Browser*: Chrome, Win7
>  'list' object has no attribute 'xml'
> Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 
> 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
>
> Traceback (most recent call last):
>   File "D:\Web2py\web2py\gluon\restricted.py", line 217, in restricted
> exec ccode in environment
>   File "D:/Web2py/web2py/applications/BBOnline/controllers/default.py" 
> , line 7994, in 
> 
>   File "D:\Web2py\web2py\gluon\globals.py", line 372, in 
> self._caller = lambda f: f()
>   File "D:/Web2py/web2py/applications/BBOnline/controllers/default.py" 
> , line 1517, in 
> ticket_list
> details=False)
>   File "D:\Web2py\web2py\gluon\sqlhtml.py", line 2194, in grid
> raise HTTP(200, oExp.export(), **response.headers)
>   File "D:\Web2py\web2py\gluon\sqlhtml.py", line 3201, in export
> return '\n\n content="text/html; charset=UTF-8" />\n\n\n%s\n\n' 
> % (self.rows.xml() or '')
> AttributeError: 'list' object has no attribute 'xml'
>
>
> Please suggest
>
> Rahul
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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.