[web2py] Re: appliance typo

2010-03-30 Thread hamdy.a.farag
On Mar 30, 1:41 am, Richard  wrote:
> would be good not to have a catch all except too, which can mask other
> errors.

or catch them but in the same time log them via a logging system

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Cache - how to prevent session object to be cached?

2010-03-30 Thread David Zejda
I tried to move the part which asks session for the ctime value into a
model:

def sestime():
return session.ctime

In controller there is:

class Blah:
def sessiontime(self):
return sestime()

def cache_test():
import time
session.ctime = time.ctime()
def blah():
return Blah()
b = cache.ram('blah',blah,30)
return dict(cached=b.sessiontime(), current=session.ctime)

And still the same, the cached and current differ. The old session is
wired into the cache somehow, hmmm..

The examples are silly, of course, just to show the problem. I wish to
use the cache to store complex objects, constructed on results of
multiple queries. The objects have various methods operating on their
properties in context of session. Once I cache the objects (to avoid
tons of queries), my program breaks :(

David

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] DAL Oracle Query problems

2010-03-30 Thread Jason Lotz
I'm sorry if I am repeating an existing discussion. I searched and
found similar issues but nothing that helped.

I am trying to query an oracle db.

raw sql:
SELECT fld1, fld2 FROM tbl1 WHERE fld1 < 20;

I can successfully run the query in SQLPlus and using cx_Oracle
directly in web2py.

> import cx_Oracle
> orcl = cx_Oracle.connect('user/passw...@tns')
> curs = orcl.cursor()
> curs.execute(sql)
> print curs.fetchall()

When I try to run the query with DAL I get an KeyError:

> db=('DAL://user/p...@tns')
> print db(db.tbl1.fld1<20).select(fld1,fld2)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\web2py\gluon\sql.py", line 1295, in __getattr__
 return dict.__getitem(self,key)
KeyError: 'tbl1'

Probably a really silly question but do I need to db.define_table for
an existing table? Is the table name case sensitive?


Jay

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: HTML tags in string

2010-03-30 Thread abiggs
I've made some progress by using replace to replace "<" with "<"
etc which then works in XML().

However the same approach doesn't work with "the UK's second" for
some reason.

Any ideas?

Cheers

On Mar 27, 11:06 am, abiggs  wrote:
> Thanks, thats great.
>
> I've tried that and it has done something.  Now the string appears as
> "including your" in the page but is still "including
> your" in the source and so it still appears and doesn't break the > line. > > Any other ideas or am I doing it wrong? > > Code from html page:   {{=XML(session.sab)}} > Code from controller: session.sab=XML(catone.getResults() > [1].getSnippet()) > > Cheers > > On Mar 26, 1:24 pm, mdipierro wrote: > > > > > {{=XML(s)}}} and s will not be escaped. > > > On Mar 26, 7:44 am, abiggs wrote: > > > > Hi > > > > I'm currently writing a program that processes search results.  As > > > such, some of the strings which I am dynamically including in the page > > > include HTML tags.  Because they are included in {{}} in the page, > > > these tags appear in text eg. "network
of Subject".  Is > > > there any way that I can make these appear as HTML tags in the source > > > of the page rather than as text.  So the example above would be > > > "network of Subject" in the source and would appear over two > > > lines with no tag visible. > > > > Hope that makes sense (its a bit of a strange one to try and explain) > > > and someone out there can point me in the right direction. > > > > Thanks in advance!! -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

[web2py] Re: Help with a query

2010-03-30 Thread Jose


On 30 mar, 04:17, weheh  wrote:
> You need a left outer join. Here are a couple of examples that I think
> should work (caveat: I didn't test them):
...
> #way2
> qry1=(db.t1.f12==10)
> leftjoin=db.t2.on(db.t2.f22==db.t1.id)
> rows=db(qry1).select(db.t2.ALL,left=leftjoin)

Yes, that's what I did, I used left join. This is what we would use
them if the query would have made with pure sql.

Knowing that I can do the following:

row = db.t2[n]
print row.f22.f11
print row.f22.f12

DAL thought would solve the query in the same way.

Thank you.

Jose

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: webserver slow, misreported

2010-03-30 Thread Timothy Farrell
I don't think upgrading will help much since Cherrypy was also slow.  
However, doing so would help cover all your bases.


If you want to use the http log from Rocket you can do this.  I'm 
assuming you invoke web2py.py from a bash script or just run it 
manually.  Paste the following code into the top of web2py.py


import  logging
import  logging.handlers
log  =  logging.getLogger('Rocket.Requests')
log.setLevel(logging.INFO)
log.addHandler(logging.handlers.FileHandler('rocket.log')

I, like Yarko, do think this has more to do with something else.  At one 
point web2py had a profiler built-in.  That could be a good tool for 
finding slow spots.


-tim

On 3/29/2010 7:59 PM, Michael Toomim wrote:

Yes, this is on linux!  Do you recommend upgrading and trying again?

mturk doesn't affect anything, I am just serving webpages that appear
in iframes on the mturk website.  From our perspective, I'm serving
webpages.

Do you have a method of logging how much time it takes to serve a page
with rocket?  Something that I can use instead of httpserver.log?  It
seems important for me to measure real-world performance, which ab
does not do.

My server has 768MB ram, and the only thing it does is run this web2py
server.  I assumed ram was not full, but did not check.  I will check
next time.

On Mar 29, 12:10 pm, Timothy Farrell  wrote:
   




--
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: DAL Oracle Query problems

2010-03-30 Thread DenesL


On Mar 30, 4:09 am, Jason Lotz  wrote:
> I'm sorry if I am repeating an existing discussion. I searched and
> found similar issues but nothing that helped.
>
> I am trying to query an oracle db.
>
> raw sql:
> SELECT fld1, fld2 FROM tbl1 WHERE fld1 < 20;
>
> I can successfully run the query in SQLPlus and using cx_Oracle
> directly in web2py.
>
> > import cx_Oracle
> > orcl = cx_Oracle.connect('user/passw...@tns')
> > curs = orcl.cursor()
> > curs.execute(sql)
> > print curs.fetchall()
>
> When I try to run the query with DAL I get an KeyError:
>
> > db=('DAL://user/p...@tns')
> > print db(db.tbl1.fld1<20).select(fld1,fld2)
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\web2py\gluon\sql.py", line 1295, in __getattr__
>      return dict.__getitem(self,key)
> KeyError: 'tbl1'
>
> Probably a really silly question but do I need to db.define_table for
> an existing table? Is the table name case sensitive?

Yes, you have to define_table before web2py can use it.
When accessing an existing table, i.e., a table not created by web2py
in the current application, always set migrate=False.
I don't know if table names are case sensitive in Oracle.

Denes

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: wiki features/bugs

2010-03-30 Thread mdipierro
You should create a page in the book and I will link it.

On Mar 29, 11:45 pm, Richard  wrote:
> I would like to add a list of web2py hosting providers that people can
> contribute to. Wiki doesn't seem ready (see above) - any other
> options?
>
> Richard
>
> On Mar 25, 11:54 am, Richard  wrote:
>
> > I tried using the wiki and have some feedback:
>
> > How do I create a new page? The front page suggests going to "Pages
> > section and clicking on the create new page link", but this link does
> > not exist.
>
> > How do I edit a page? When I try editing I get "The page isn't
> > redirecting properly".
>
> > By default accounts do not have edit/create privileges. I guess this
> > would reduce abuse but it will also reduce input by genuine users.
> > Could this be reconsidered?
> > Also what is the current process for requesting edit/create
> > privileges? This is not covered on the front page.
>
> > If I go to a page that does not exist 
> > (eghttp://wiki.web2py.com/page_that_does_not_exist)
> > I get a redirect error. Would it be possible to redirect to a create
> > new page form with this name, Wikipedia style?
>
> > The "forgot password" feature lets me reset the password of any email
> > address. Could an email instead be sent with a link to reset the
> > password?
> > Also the reminder was classified as spam by gmail. Perhaps including
> > their profile name in the email would minimize this.
>
> > Page links text are showed as "How_to_Geolocate" - could these
> > underscores be changed to spaces? ("How to Geolocate")

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: JqGrid Plugin

2010-03-30 Thread mdipierro
For strings

import cgi
cgi.escape(string)

On Mar 30, 1:40 am, parroit  wrote:
> Interesting, thank you. I will add autoencode parameters to
> the grid construnctor.
>
> I saw that setting the parameter to true will enable the encoding
> for all columns of the grid. Maybe, if we want to have some column
> with html data,
> it's better to encode the data in w2p?
> Massimo, you know an easy way to do so?
>
> Andrea
>
> On 28 Mar, 16:57, "ont.rif"  wrote:
>
> > :-)  same bug as 
> > forhttp://groups.google.ru/group/web2py/browse_thread/thread/96877110aa8...
> > I have found intresting feature 
> > forJqGrid3.5.2http://blogs.teamb.com/craigstuntz/2010/02/08/38548/
> > May be it is useful to add this option to this plugin ?
>
> > On 28 ÜÐà, 21:35, mdipierro  wrote:
>
> > > :-)
>
> > > On Mar 28, 4:04 am, parroit  wrote:
>
> > > > Thank you. Yes, I can merge with it.
> > > > I look at the existingjqgridplugin files.
> > > > I'll add the search feature and the parameters
> > > > for columns width, names etc...
>
> > > > I'll add a post here when I'll done with the work.
>
> > > > Bye
>
> > > > Andrea
>
> > > > On 28 Mar, 03:18, mdipierro  wrote:
>
> > > > > I looked at it and you did excellent work.
>
> > > > > I have one issue and one proposal.
>
> > > > > The issue is that plugin_editable_jqgrid.py exposes classes and
> > > > > methods that do not start with plugin_editable_jqgrid and that is a
> > > > > problem because can potentially conflict with other plugins.
>
> > > > > The proposal is that we merge it with the existingjqgridplugin.
>
> > > > > Can you take a first crack at merging them?
> > > > > I will be happy to do any required cleanup work and post it.
>
> > > > > Massimo
>
> > > > > On 27 Mar, 19:38, mdipierro  wrote:
>
> > > > > > I will look at it asap. Thank you!
>
> > > > > > Massimo
>
> > > > > > On 27 Mar, 11:51, parroit  wrote:
>
> > > > > > > Hi. I've developed a plugin to useJqGridwith inline editing and 
> > > > > > > json
> > > > > > > updates.
> > > > > > > I've published some help at this page:http://app.ebansoftware.net,
> > > > > > > but I think it be more useful
> > > > > > > to publish it also onhttp://www.web2py.com/plugins. What is the
> > > > > > > correct procedure
> > > > > > > to publish the plugin on that site?
>
> > > > > > > Thanks
>
> > > > > > > Andrea

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: HTML tags in string

2010-03-30 Thread mdipierro
You cannot have both

Code from controller: session.sab=XML(catone.getResults()
[1].getSnippet())
Code from html page:   {{=session.sab}}

OR

Code from controller: session.sab=catone.getResults()[1].getSnippet()
Code from html page:   {{=XML(session.sab)}}

On Mar 27, 5:06 am, abiggs  wrote:
> Thanks, thats great.
>
> I've tried that and it has done something.  Now the string appears as
> "including your" in the page but is still "including
> your" in the source and so it still appears and doesn't break the > line. > > Any other ideas or am I doing it wrong? > > Code from html page:   {{=XML(session.sab)}} > Code from controller: session.sab=XML(catone.getResults() > [1].getSnippet()) > > Cheers > > On Mar 26, 1:24 pm, mdipierro wrote: > > > {{=XML(s)}}} and s will not be escaped. > > > On Mar 26, 7:44 am, abiggs wrote: > > > > Hi > > > > I'm currently writing a program that processes search results.  As > > > such, some of the strings which I am dynamically including in the page > > > include HTML tags.  Because they are included in {{}} in the page, > > > these tags appear in text eg. "network
of Subject".  Is > > > there any way that I can make these appear as HTML tags in the source > > > of the page rather than as text.  So the example above would be > > > "network of Subject" in the source and would appear over two > > > lines with no tag visible. > > > > Hope that makes sense (its a bit of a strange one to try and explain) > > > and someone out there can point me in the right direction. > > > > Thanks in advance!! -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

[web2py] Generic Template in AJAX response

2010-03-30 Thread Skiros
Hello!

I have a strange error when loading dynamic content with AJAX. When
the controller receives a parameter in the URL and made a call with
AJAX the result is formatted with generic template. As example can
prove the correct behavior (without parameter):

http://web2py.com/examples/simple_examples/ajaxwiki/

and the problem (with parameter):

http://web2py.com/examples/simple_examples/ajaxwiki/55

Some idea?
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: how to troubleshoot admin errors?

2010-03-30 Thread ciastek
Yarko, thanks for detailed description, but it's not a problem.

If there were no parameters_xxx.py file, I could not log in admin
interface. The problem is, that I can log in, but admin is unable to
create new application.

At the end of setup-web2py-ubuntu.sh file we can find:
cd /home/www-data/web2py
sudo -u www-data python -c "from gluon.main import save_password;
save_password(raw_input('admin passw
ord: '),443)"
This line asks for password and writes it in parameters_443.py file.

Running ./web2py creates: deposit/, site-package/, parameters_8000.py
and welcome.w2p
(BTW: As you can see default port is 8000)

Looks like as long as you don't run ./web2py, admin can't find
welcome.w2p to scaffold.

On Mar 29, 5:27 pm, Yarko Tymciurak 
wrote:
> On Mar 29, 9:27 am, ciastek  wrote:
>
> > I've had the same problem ("unable to create application") on Ubuntu
> > JeOS 8.04.3 configured as shown athttp://vimeo.com/10377947[
> > web2py production deployment on vps.net (VIDEO) by mdipierro].
> > Ubuntu fully upgraded, web2py installed using setup-web2py-ubuntu.sh
> > script.
> > Running web2py from console once, resolved the problem.
>
> Just to be sure there is not mystery / this is clear:
>
> When you start web2py from the console with no arguments, you are
> asked to config various things (port, admin password);
> You can also do this from the command line (in which case, no config-
> gui comes up prior to starting the built-in server).
>
> When you run from other than the built-in server, there is no setup:
> the port and admin password must exist _somewhere_!
>
> The way you create this information is to run from the console "once"
> - because what this does is create a file:
> parameters_{port_number}.py, which is then used at startup.
>
> So (for example):
>
>     $ python web2py.py -a 'hello'
>
> will create  parameters_80.py   (the default port is 80).
>
> You can edit, or copy this file - if you want to use the same
> password, but on port 432, just copy this file (for example) to:
> parameters_432.py
>
> In any case, the parameters file is used to supply "command-line"
> parameters when not running from the command line.
>
> Hope this takes the mystery out of it.
>
> Regards,
> Yarko
>
> > IMHO the source of problem is absence of web2py/deposit and web2py/
> > site-packages directories.
> > mdipierro - web2py rox! :)
> > -- ciastek
>
> > On Mar 22, 4:01 am, KMax  wrote:
>
> > > Hello
> > >   My web2py instalation (1.73 and newer) was affected by the same
> > > issue.
> > >   Running on debian by wsgi apache2. Installed by unzipping
> > > web2py_src.zip in to fresh folder and coping parameters_443.py.
> > >   Creation of newapplicationgive an error flash 
> > > "unabletocreateapplication."
>
> > >   Workaround was found accidently.
> > >   Starting web2py.by at console ( typing pass and quit ) solve issue
> > > at apache.
>
> > > Thank you.
> > > On 3 ÍÁÒ, 00:13, snfctech  wrote:
>
> > > > Fedora10 web2py1.76.1 apache2/mod_wsgi
>
> > > > I thought all errors generated tickets? šWhen I try tocreatean app
> > > > via the admin over HTTPS on a LAN all I get is an error flash "unable
> > > > tocreateapplication." šIt's not an apache permission issue because
> > > > it does the same thing if all my files and dirs have 777 permissions.
> > > > I don't get any apache errors in the error log and the only funny
> > > > thing I get in the access log is a 303 code from the POST request to
> > > > admin/default/site. šSomething must not be working out with
> > > > gluon.admin.app_create.
>
> > > > How should I troubleshoot this type of error, or does anybody have an
> > > > idea what's going on?
>
> > > > I'm going to start dissecting the app_create function - but my python
> > > > skills are still pretty weak and I was hoping there would just be a
> > > > good error log somewhere...
>
> > > > Thanks in advance for any tips.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] file upload / download

2010-03-30 Thread topher.baron
Hi all,

I have XML being generated on the client side using javascript - more
specifically its SVG XML, but it doesn't really matter.

I would like the user of the web application to be able to click an
'export' button and receive a download dialog for the XML created on
the client side.

At the moment I make an ajax call that sends the xml to the server,
saves it in a file.  After this is done a window.open java script call
is made to retrieve the file from the server where Firefox renders the
SVG XML rather than gives me a download dialogue.  I've read I can
change the content disposition header on the server to force a
download, but thought I ask someone here if there's a better way.  Any
suggestions ?

Chris Baron

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Generic Template in AJAX response

2010-03-30 Thread mdipierro
Yes the problem is that the callback URL in the example is not written
by the book. You will find that this:
  http://web2py.com/examples/simple_examples/ajaxwiki
works fine but this
  http://web2py.com/examples/simple_examples/ajaxwiki/
does not.

Because the example contains (for short)

  _onclick="ajax('ajaxwiki_onclick',['text'],'html')"

but should contain

  _onclick="ajax('%s',['text'],'html')" %
URL(r=request,f='ajaxwiki_onclick')


On Mar 30, 9:07 am, Skiros  wrote:
> Hello!
>
> I have a strange error when loading dynamic content with AJAX. When
> the controller receives a parameter in the URL and made a call with
> AJAX the result is formatted with generic template. As example can
> prove the correct behavior (without parameter):
>
> http://web2py.com/examples/simple_examples/ajaxwiki/
>
> and the problem (with parameter):
>
> http://web2py.com/examples/simple_examples/ajaxwiki/55
>
> Some idea?
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: how to troubleshoot admin errors?

2010-03-30 Thread mdipierro
web2py.w2p is built when you first install web2py or when you upgrade.
This is trigggered by the presence of an empty file called NEWINSTALL,
If this file is present welcome.w2p is created and then file is
deleted.

On Mar 30, 9:46 am, ciastek  wrote:
> Yarko, thanks for detailed description, but it's not a problem.
>
> If there were no parameters_xxx.py file, I could not log in admin
> interface. The problem is, that I can log in, but admin is unable to
> create new application.
>
> At the end of setup-web2py-ubuntu.sh file we can find:
>     cd /home/www-data/web2py
>     sudo -u www-data python -c "from gluon.main import save_password;
> save_password(raw_input('admin passw
> ord: '),443)"
> This line asks for password and writes it in parameters_443.py file.
>
> Running ./web2py creates: deposit/, site-package/, parameters_8000.py
> and welcome.w2p
> (BTW: As you can see default port is 8000)
>
> Looks like as long as you don't run ./web2py, admin can't find
> welcome.w2p to scaffold.
>
> On Mar 29, 5:27 pm, Yarko Tymciurak 
> wrote:
>
> > On Mar 29, 9:27 am, ciastek  wrote:
>
> > > I've had the same problem ("unable to create application") on Ubuntu
> > > JeOS 8.04.3 configured as shown athttp://vimeo.com/10377947[
> > > web2py production deployment on vps.net (VIDEO) by mdipierro].
> > > Ubuntu fully upgraded, web2py installed using setup-web2py-ubuntu.sh
> > > script.
> > > Running web2py from console once, resolved the problem.
>
> > Just to be sure there is not mystery / this is clear:
>
> > When you start web2py from the console with no arguments, you are
> > asked to config various things (port, admin password);
> > You can also do this from the command line (in which case, no config-
> > gui comes up prior to starting the built-in server).
>
> > When you run from other than the built-in server, there is no setup:
> > the port and admin password must exist _somewhere_!
>
> > The way you create this information is to run from the console "once"
> > - because what this does is create a file:
> > parameters_{port_number}.py, which is then used at startup.
>
> > So (for example):
>
> >     $ python web2py.py -a 'hello'
>
> > will create  parameters_80.py   (the default port is 80).
>
> > You can edit, or copy this file - if you want to use the same
> > password, but on port 432, just copy this file (for example) to:
> > parameters_432.py
>
> > In any case, the parameters file is used to supply "command-line"
> > parameters when not running from the command line.
>
> > Hope this takes the mystery out of it.
>
> > Regards,
> > Yarko
>
> > > IMHO the source of problem is absence of web2py/deposit and web2py/
> > > site-packages directories.
> > > mdipierro - web2py rox! :)
> > > -- ciastek
>
> > > On Mar 22, 4:01 am, KMax  wrote:
>
> > > > Hello
> > > >   My web2py instalation (1.73 and newer) was affected by the same
> > > > issue.
> > > >   Running on debian by wsgi apache2. Installed by unzipping
> > > > web2py_src.zip in to fresh folder and coping parameters_443.py.
> > > >   Creation of newapplicationgive an error flash 
> > > > "unabletocreateapplication."
>
> > > >   Workaround was found accidently.
> > > >   Starting web2py.by at console ( typing pass and quit ) solve issue
> > > > at apache.
>
> > > > Thank you.
> > > > On 3 ÍÁÒ, 00:13, snfctech  wrote:
>
> > > > > Fedora10 web2py1.76.1 apache2/mod_wsgi
>
> > > > > I thought all errors generated tickets? šWhen I try tocreatean app
> > > > > via the admin over HTTPS on a LAN all I get is an error flash "unable
> > > > > tocreateapplication." šIt's not an apache permission issue because
> > > > > it does the same thing if all my files and dirs have 777 permissions.
> > > > > I don't get any apache errors in the error log and the only funny
> > > > > thing I get in the access log is a 303 code from the POST request to
> > > > > admin/default/site. šSomething must not be working out with
> > > > > gluon.admin.app_create.
>
> > > > > How should I troubleshoot this type of error, or does anybody have an
> > > > > idea what's going on?
>
> > > > > I'm going to start dissecting the app_create function - but my python
> > > > > skills are still pretty weak and I was hoping there would just be a
> > > > > good error log somewhere...
>
> > > > > Thanks in advance for any tips.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: file upload / download

2010-03-30 Thread topher.baron
Hi again,

I've solved my problem.  I took a look at the appadmin file download
example to find a solution.  Thanks rubber duck!

On Mar 30, 10:01 am, "topher.baron"  wrote:
> Hi all,
>
> I have XML being generated on the client side using javascript - more
> specifically its SVG XML, but it doesn't really matter.
>
> I would like the user of the web application to be able to click an
> 'export' button and receive a download dialog for the XML created on
> the client side.
>
> At the moment I make an ajax call that sends the xml to the server,
> saves it in a file.  After this is done a window.open java script call
> is made to retrieve the file from the server where Firefox renders the
> SVG XML rather than gives me a download dialogue.  I've read I can
> change the content disposition header on the server to force a
> download, but thought I ask someone here if there's a better way.  Any
> suggestions ?
>
> Chris Baron

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Generic Template in AJAX response

2010-03-30 Thread Skiros
Thanks !!! that is the solution...
Congratulations by the work done with web2py! it is a great piece of
work! Greetings from Argentina!

On 30 mar, 12:36, mdipierro  wrote:
> Yes the problem is that the callback URL in the example is not written
> by the book. You will find that this:
>  http://web2py.com/examples/simple_examples/ajaxwiki
> works fine but this
>  http://web2py.com/examples/simple_examples/ajaxwiki/
> does not.
>
> Because the example contains (for short)
>
>   _onclick="ajax('ajaxwiki_onclick',['text'],'html')"
>
> but should contain
>
>   _onclick="ajax('%s',['text'],'html')" %
> URL(r=request,f='ajaxwiki_onclick')
>
> On Mar 30, 9:07 am, Skiros  wrote:
>
> > Hello!
>
> > I have a strange error when loading dynamic content with AJAX. When
> > the controller receives a parameter in the URL and made a call with
> > AJAX the result is formatted with generic template. As example can
> > prove the correct behavior (without parameter):
>
> >http://web2py.com/examples/simple_examples/ajaxwiki/
>
> > and the problem (with parameter):
>
> >http://web2py.com/examples/simple_examples/ajaxwiki/55
>
> > Some idea?
> > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Survey: Functionality of the Drop Boxes widget

2010-03-30 Thread Thadeus Burgess
Here are the results from two sources, A) The survey, and B) Listing
of community members speaking for one or the other.

A) Survey - 12 Responses ( No way to determine if anybody spammed responses )

There are no significant differences in usage scales, the hypothesis
is that it only matters for the kind of form, so 50% of the time
they are changing it one way or the other.

Preferences are split 50/50 for zero=None and zero="".

https://spreadsheets.google.com/ccc?key=0AstNNXQhkjU-dE9jS1VHSWdyd08xX2x6NU0yaEs1cnc&hl=en

B) Community Members

I have attached a OpenOffice document containing two columns. The
first column is of community members
speaking for zero=None as the default, along with the date and time.
This does not include any of my posts, though
I am a strong advocate of zero=None. The second column is of community
members arguing for zero="".

This is the general synopsis.

For Zero=""

Having zero=None represents a usability issue, assume the average user
is lazy(stupid) and provide a default
that does not validate, this is to keep them from accidentally
submitting a valid option they did not want.

For Zero=None

Change back to zero=None so old apps act the same, or they want it to
display without the blank option.
The blank option gives values that does not validate. It makes logical
sense to only have values
in the dropdown that validate. zero is an EXTRA feature and should be
turned on EXPLICITLY when needed
instead of turned OFF when not needed.

-Thadeus





On Thu, Mar 25, 2010 at 1:03 AM, mdipierro  wrote:
> Hi Thadeus.
>
> You have two objections. One is procedural and one is more
> substantial.
>
> Procedurally, I can add any feature I consider appropriate. It has
> happened before. It will happen again. In practice, it is my interest
> to keep users happy and in particular other contributors, so if I feel
> something is contentious, I do ask for people opinion. It have done so
> and I will continue to do so. And if I do not ask, you can bring it
> up. And you did well to bring this up.
>
> Now to the substantial objection. The change in question was made
> because I thought it was a good one (and I still think so), because it
> did not break backward compatibility (no application broke, it just
> caused more error messages when users failed to select a value in
> dropbox).
>
> Moreover at the time I did not think it was not going to be so
> contentious. I am not yet even sure it is contentious now, that is
> what you have to prove with the poll.
>
> Changing it back is more problematic because it will cause users to
> accidentally submit forms with default options chosen by the browser
> instead of chosen by the programmer or the user (if no default=... is
> set, the browser will automatically select the first item in the
> options). In my view that is bad software design so it shoud stay as
> it is.
>
> There a number resources on the web that give practial
> recommendations. For example http://www.cs.tut.fi/~jkorpela/forms/choices.html
> says "For a normal 1-of-many selection (apart from the two preceding
> cases), use either a SELECT element  or a set of radio buttons. In
> both cases, make sure a well-defined default is initially selected".
> zero='' provides that option for create forms.
>
> Nevertheless, I do accept the possibility that I am wrong. I have been
> wrong before. Yet you have to prove to me that I am wrong. I
> understand your case and that is not sufficient. I need to know that a
> good majority of the people think that this should be reverted.
>
> For me, backward compatibility means that we do not introduce changes
> that break web2py APIs as documented in published book. For example I
> have said over and over that the new DAL may break SQLCustomType
> because will hopefully provide a better mechanism.
>
> So let me add something new to the discussion:
>
> You mentioned difficulty in changing back the behavior of your apps.
> Here is a simple solution for that. In your db.py, before you use
> IS_IN_DB:
>
> IS_IN_DB2 = IS_IN_DB
> def IS_IN_DB(*a,**b):
>     b['zero']=None
>     return IS_IN_DB2(*a,**b)
>
> (and same for IS_IN_SET). With this piece of code your apps will
> behave as if this change was never introduced and you will not need to
> edit it.
> People who like a message can do:
>
> IS_IN_DB2 = IS_IN_DB
> def IS_IN_DB(*a,**b):
>     b['zero']=T('please choose one')
>     return IS_IN_DB2(*a,**b)
>
> Anyway. I really think the poll should have a deadline. How many votes
> do you have so far? When are you planning to close it?
>
> Massimo
>
> On Mar 24, 10:21 pm, Thadeus Burgess  wrote:
>> I am not sure of the exact time frame that this was introduced
>> (zero='', breaking backwards-compatibility) by it was only a matter of
>> a couple of months ago, not a year. The exact date was "2010-01-03" of
>> this change, 
>> athttp://bazaar.launchpad.net/~mdipierro/web2py/devel/revision/1497
>>
>> Should I point out that
>>
>> A) This was at a time when most who

[web2py] Inserting into multiple related tables.

2010-03-30 Thread compassiontara
Perhaps I'm missing the obvious, but I can't figure out how to make
this work:

db.define_table('users',
Field('phone','string',unique=True),
Field('safe','boolean',default=False),
Field('allow_le','boolean',default=False),
Field('safe_time','datetime'),
Field('finished','boolean'),
Field('finished_time','datetime'),
Field('start_time','datetime'),
)
db.define_table('contacts',
Field('user',db.users),
Field('phone','string'),
Field('user_recording','string'),
Field('called','boolean',default=False),
)

db.users.insert(phone='17125551212',safe_time=datetime.datetime.now()
+3600)
db.contacts.insert(user=user_id,user_recording='/var/sounds/
blah.wav',phone='1551212')

where the db.contacts insert needs the .id from the db.users.insert.
I want both to be within a transaction, but because web2py does
transactions and commits automatically at end, how would I make this
happen?

I understand I could do something insane like commit(), do a query to
get the new ID record, and then do the insert for contacts, and then
if that fails, go delete the record from users, but I'm hoping that
there is a more humane way of doing this?

With Love,
Tara

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Inserting into multiple related tables.

2010-03-30 Thread Thadeus Burgess
user_id = db.users.insert(.)
contact = db.contacts.insert(user = user_id, user_recording='/hi/')

So insert returns the id of the newly inserted record..

If you want the actual object of what you just inserted you need

user = db.user[db.users.insert(...)]

Now you can perform, user.update/user.update_record() etc etc.

-Thadeus





On Tue, Mar 30, 2010 at 12:09 PM, compassiontara  wrote:
> Perhaps I'm missing the obvious, but I can't figure out how to make
> this work:
>
> db.define_table('users',
>        Field('phone','string',unique=True),
>        Field('safe','boolean',default=False),
>        Field('allow_le','boolean',default=False),
>        Field('safe_time','datetime'),
>        Field('finished','boolean'),
>        Field('finished_time','datetime'),
>        Field('start_time','datetime'),
> )
> db.define_table('contacts',
>        Field('user',db.users),
>        Field('phone','string'),
>        Field('user_recording','string'),
>        Field('called','boolean',default=False),
> )
>
> db.users.insert(phone='17125551212',safe_time=datetime.datetime.now()
> +3600)
> db.contacts.insert(user=user_id,user_recording='/var/sounds/
> blah.wav',phone='1551212')
>
> where the db.contacts insert needs the .id from the db.users.insert.
> I want both to be within a transaction, but because web2py does
> transactions and commits automatically at end, how would I make this
> happen?
>
> I understand I could do something insane like commit(), do a query to
> get the new ID record, and then do the insert for contacts, and then
> if that fails, go delete the record from users, but I'm hoping that
> there is a more humane way of doing this?
>
> With Love,
> Tara
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Models in YAML

2010-03-30 Thread blackthorne
Do you consider interesting to be able to define web2py models in YAML
that shall be translated to DAL Python code and then SQL according to
your DBMS ?

thank you,
Best Regards

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Feature request: xlstoweb2py [was: Where do you use web2py?]

2010-03-30 Thread Thadeus Burgess
Any status on xls2web2py?

-Thadeus





On Wed, Mar 17, 2010 at 9:38 AM, mdipierro  wrote:
> The problem with appadmin is that it is designed for the administrator
> and has security issues. A user can execute any python code he/she
> wants in the query string. This is a feature because its use is
> supposed to be restricted to the administrator. Users have to be
> trusted to expose appadmin to them. It would be better to use
> something ike the jqGrid plugin.
>
> On Mar 17, 3:24 am, Thadeus Burgess  wrote:
>> I had actually used appadmin in production for a particular database
>> for several months. The users were the same as you are describing
>> (end-user, used to excel).
>>
>> Now that it is time to give them the real app (as appadmin was just a
>> quick get us up and running)... they are actually sad to see us stop
>> using appadmin, they like it!
>>
>> I think you might be surprised at how easy appadmin is to grasp for
>> those who deal with spreadsheets all day.
>>
>> -Thadeus
>>
>> On Wed, Mar 17, 2010 at 1:27 AM, Vincent Borghi
>>
>>  wrote:
>> > On Tue, Mar 16, 2010 at 4:11 PM, mdipierro  wrote:
>> >> I think what Vincent is asking is not so much importing capability but
>> >> an interface that can read an excel file (or a csv file) asks you the
>> >> names (guessing from the header) and types (guessing from data) of
>> >> columns and then writes the model for you.
>>
>> > yes Massimo
>>
>> >> Perhaps something that can
>> >> deal with the case when the table is the result of a join. Then
>> >> importing is a trivial step. We have that already
>>
>> > In addition to data importation and code generation for the model,
>> > a key feature is to generate a user interface to the data.
>>
>> > The default appadmin.py is OK for an administrator, but
>> > not so OK for an end-user who just wants to manage and share
>> > some data.
>> > Such end-users are most data owners than "administartors".
>>
>> > Ideally, the utility I am looking for will generate a nice user
>> > (viewers and data owners)
>> > interface, that the administrator (who is supposed to know python and
>> > more or less SQL)
>> > can customize/enhance.
>>
>> > The end-users/data owners are not knowlegeable in SQL (they are
>> > used to excel tables, after all).
>> > Moreover they expect to have simple functionality
>> > to do base CRUD operations : Create, Read (browse, filter, sort, dump as 
>> > csv,
>> > paged or full datalist view in sortable table with choosable columns, 
>> > possibly
>> > customizing who has which acces rights, so on...), Update and Delete.
>>
>> > Regards
>>
>> >> On Mar 16, 9:27 am, Dragonfyre13  wrote:
>> >>> Well, my suggestion would be forget the XLS format for the first
>> >>> iteration. Use CSV. If you're not concerned with formulas, that's the
>> >>> cleanest route, and included in the default python install. (csv
>> >>> module). I use it all the time for my load test frameworks I build.
>>
>> >>> It's not only very easy to use, but since it's VERY easy to export
>> >>> from excel, it shouldn't be much of a burden on the users. In a second
>> >>> iteration, if the license matches, you could do an import from xls
>> >>> format.
>>
>> >>> On Mar 16, 8:03 am, mdipierro  wrote:
>>
>> >>> > This can be done. I need to check the licence of the xls readers.
>>
>> >>> > On Mar 16, 3:45 am, Vincent Borghi  wrote:
>>
>> >>> > > Hello
>>
>> >>> > > I have used web2py to (quickly) implement a simple phone directory of
>> >>> > > customer contacts,
>> >>> > > for a small phone call center.
>> >>> > > Before that, people tried to maintain their contact information in an
>> >>> > > Excel spreadsheet
>> >>> > > that was exchanged thru mail and/or a windows sharedc folder...
>>
>> >>> > > ( Also note that I deal with two zope/plone sites, but I cannot 
>> >>> > > (/don't want) to
>> >>> > > fully understand all the stuff that has been added/changed with the
>> >>> > > Plone 3 release
>> >>> > > and soon the Plone 4 one -- too complicated for me.
>> >>> > > However, as a CMS, Plone has advantages, and afaik there is nothing 
>> >>> > > really
>> >>> > > production-ready in the web2py world )
>>
>> >>> > > By the way:
>> >>> > > Feature request: xlstoweb2py
>> >>> > > ===
>> >>> > > For me, web2py could be the killer framework everywhere there are
>> >>> > > simple xls Excel files
>> >>> > > circulating among people who try to share and maintain information as
>> >>> > > they can (and
>> >>> > > they are numerous in many companies...).
>>
>> >>> > > In fact, in many cases, Excel sheets made by people involve no 
>> >>> > > formula, but are
>> >>> > > just tables of static data. To deal with this frequent use case, I am
>> >>> > > looking for an
>> >>> > > "xlstoweb2py" utility that would take an xls file as input, and would
>> >>> > > automatically
>> >>> > > convert the data to an sqlite database, would build a base web2py 
>> >>> > > application
>> >>> > > implementing CRUD features and perhaps 

Re: [web2py] Re: Does fake_migrate work?

2010-03-30 Thread Thadeus Burgess
Where would be the most appropriate places to place this explanation?

-Thadeus





On Fri, Feb 26, 2010 at 5:09 PM, villas  wrote:
> @Thadeus,  Thanks for such a comprehensive and helpful answer.
>
> I did get fake_migrate to work eventually,  I had been blocking it
> with another problem in my code.  That aside, part of my confusion was
> that the latter two combinations you mention do the same. I suppose
> one simply has to remember that fake_migrate is given precedence when
> True.
>
> Much appreciated!  D
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Stored Procedures DAL

2010-03-30 Thread Thadeus Burgess
Is it possible?

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Here's a theory question

2010-03-30 Thread Thadeus Burgess
How do you MVC a javascript client application?

So I have web2py acting as the server, and I write a Javascript GUI (based
off extjs or similar library).

So of course this goes in the View files... The interesting question is that
these client side js have their own MCV on top of that (models are your
JSONRPC, controllers to format data/communicate with server, and then view
code to generate/populate the html).

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: [web2py:38402] Re: SQLFORM without tables

2010-03-30 Thread Thadeus Burgess
Of course, the decoupling would require an entire re-write of how
validation/forms/filters are written...

See you explain this system that each part relies on another part
working a certain way... when I analyze this through my
programming filter to solve this problem this is what I see...

A class for filtering (parsing html values into python values)
A class for validation (validating already parsed data), this could be
used anywhere within web2py, even import_from_csv_file!
A class for data structure (just the data of a form, like a rows
object, and the types of data)
A class for representation (this will take a data structure, and parse
it into a representable format... like a form, or a table)

Each of these classes could use the others, but they don't rely on the
others you could use the filtering without validating the data...
or create a form that can validate, but doesn't represent itself.

-Thadeus





On Tue, Jan 5, 2010 at 7:18 PM, mdipierro  wrote:
> way, I do think the current system can be improved and made more
> general. I do not see how this decoup

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: [web2py:38394] Re: SQLFORM without tables

2010-03-30 Thread Thadeus Burgess
I have about two or three pages in my saved drafts about this subject :)

I just havn't had the time to sit down and figure out a real workable
solution that can integrate into everything else web2py does.

Your right, the defaults are integrated into everything, everything
from default widgets set by the DAL/Fields so that a SQLFORM can
display them.

So the question is, what changes could be made to the DAL to separate
it from data representation.

-Thadeus





On Fri, Jan 8, 2010 at 10:55 AM, Alex Fanjul  wrote:
> is is the most recurrent topic I think. It should be called "Decoupled,
> Custom and Tableless Forms". I'd say it would involve lot of changes for
> "default" things that web2py does now very well, and that is the proble

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: [web2py:38474] Re: template, static files, routes.py

2010-03-30 Thread Thadeus Burgess
Alright, look at this example. "helloworld" always gets printed, the
function is not being redefined as expected. This is a simple example,
but in theory I would use this for say the websites sidebar not the
page title...

Any suggestions I have require changes to gluon and add support for blocks.

## layout.html
{{def title():}}
helloworld
{{pass}}


{{title()}}
{{include}}


## view.html
{{extend 'layout.html'}}

{{def title():}}
I Like Pie
{{pass}}

Hello, Did you know that I like Pie... also.. The Cake Is A Lie!

I expect my title to be I Like Pie... but really my title is helloworld

-Thadeus





On Wed, Jan 6, 2010 at 1:57 PM, mdipierro  wrote:
> Mind that if you have
>
> {{def a()}}hello{{return 'world'}}
>
> then
>
> {{a()}} prints renders as 'hello' but {{=a()}} renders as 'helloworld'
>
> Massimo
>
> On Jan 6, 1:07 pm, KMax  wrote:
>> I just check layout.html and found there place for menu.
>> So it should not be the issue to plase at layout.html code like
>> {{=myhead()}} and only issue will be valid return of myhead().
>> is it?
>> On 6 янв, 21:36, mdipierro  wrote:
>>
>> > Yes and no. the web2py template language is very different from
>> > Django's because everything inside {{...}} is pure python. This means
>> > there is no concept of blocks but in python you have function calls.
>>
>> > You can do
>>
>> > #based.html
>> > {{def something()}}text goes here{{return}}
>> > {{extend 'layout.html'}}
>> > Hello world
>>
>> > #layout.html
>> > 
>> > {{something()}}
>> > {{include}}
>> > 
>>
>> > The def defines a funciton that you can use as a block.
>>
>> > On Jan 6, 6:13 am, Sujan Shakya  wrote:
>>
>> > > I have some questions that I have not understood.
>>
>> > > In layout.html, I found only one {{include}}.
>> > > Is it possible to use more {{include}} in layout.html so that we can
>> > > achieve equivalent of the following:
>> > > {% block head %}{% endblock %}
>> > > {% block content %}{% endblock %}
>> > > {% block col3 %}{% endblock %}
>>
>> > > How are the static files served in production servers? Are they served
>> > > thru apache/lighttpd or web2py itself ?
>>
>> > > And why is it that the use of routes.py not preferred?
>>
>> > > Thanks.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Stored Procedures DAL

2010-03-30 Thread Kuba Kucharski
I remember massimo's answer in this subject, calling them yes - with
executesql, but writing no, as they are db platform specific

-- 
Kuba

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Here's a theory question

2010-03-30 Thread Timothy Farrell

This is my best understanding (using ExtJS as an case-study):

Models --> Stores (Generally these communicate with the server side)
Views --> Layouts + Widgets (these generate and respond to events)
Controllers --> Events that control interactions between widgets and stores

Ext has simplified Models with its Ext.direct stuff.

How's that?

-tim

On 3/30/2010 1:01 PM, Thadeus Burgess wrote:

How do you MVC a javascript client application?

So I have web2py acting as the server, and I write a Javascript GUI 
(based off extjs or similar library).


So of course this goes in the View files... The interesting question 
is that these client side js have their own MCV on top of that (models 
are your JSONRPC, controllers to format data/communicate with server, 
and then view code to generate/populate the html).


-Thadeus


--
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.

To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


--
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Here's a theory question

2010-03-30 Thread Thadeus Burgess
Aye, this I understand, but for every web2py view, you need a js
(model, view, controller). The question is how should these be
physically laid out while still keeping symbolism as they all are
apart of the same web2py view?

-Thadeus





On Tue, Mar 30, 2010 at 1:45 PM, Timothy Farrell  wrote:
> This is my best understanding (using ExtJS as an case-study):
>
> Models --> Stores (Generally these communicate with the server side)
> Views --> Layouts + Widgets (these generate and respond to events)
> Controllers --> Events that control interactions between widgets and stores
>
> Ext has simplified Models with its Ext.direct stuff.
>
> How's that?
>
> -tim
>
> On 3/30/2010 1:01 PM, Thadeus Burgess wrote:
>>
>> How do you MVC a javascript client application?
>>
>> So I have web2py acting as the server, and I write a Javascript GUI (based
>> off extjs or similar library).
>>
>> So of course this goes in the View files... The interesting question is
>> that these client side js have their own MCV on top of that (models are your
>> JSONRPC, controllers to format data/communicate with server, and then view
>> code to generate/populate the html).
>>
>> -Thadeus
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Here's a theory question

2010-03-30 Thread Timothy Farrell
I think you're trying to over-complicate things.  web2py is built around 
the idea of the server-client (or request-response) relationship.  While 
capable of Ajax, the default paradigm of web2py reloads pages on most 
requests.  In this model (not to be confused with the Model portion of 
MVC), what is sent to the browser is all View.


However, in the context of Rich Internet Applications, I don't think it 
makes much sense for web2py to try to match its Models with client-side 
Models in Javascript.  To do so, web2py would need to be married to a 
specific Javascript toolkit (more-so than it already is).  It's possible 
that web2py's DAL could have added functionality that exposes ExtJS's 
directStore functionality, but that's the only way I could see marrying 
both server-side and client-side MVC components.


Am I misunderstanding you?

On 3/30/2010 1:51 PM, Thadeus Burgess wrote:

Aye, this I understand, but for every web2py view, you need a js
(model, view, controller). The question is how should these be
physically laid out while still keeping symbolism as they all are
apart of the same web2py view?

-Thadeus





On Tue, Mar 30, 2010 at 1:45 PM, Timothy Farrell  wrote:
   

This is my best understanding (using ExtJS as an case-study):

Models -->  Stores (Generally these communicate with the server side)
Views -->  Layouts + Widgets (these generate and respond to events)
Controllers -->  Events that control interactions between widgets and stores

Ext has simplified Models with its Ext.direct stuff.

How's that?

-tim

On 3/30/2010 1:01 PM, Thadeus Burgess wrote:
 

How do you MVC a javascript client application?

So I have web2py acting as the server, and I write a Javascript GUI (based
off extjs or similar library).

So of course this goes in the View files... The interesting question is
that these client side js have their own MCV on top of that (models are your
JSONRPC, controllers to format data/communicate with server, and then view
code to generate/populate the html).

-Thadeus


--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.
   

--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.


 
   


--
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Here's a theory question

2010-03-30 Thread Yarko Tymciurak
On Mar 30, 1:01 pm, Thadeus Burgess  wrote:
> How do you MVC a javascript client application?

Here's the "simple" of it:

An application is ... an application.

Layered applications are partitioned into layers for (among other
things)  a clean interface between layers.
This is important for a couple of reasons, one of them being the
ability to move where the network boundary is.

In typical, plain web2py applications, the network boundary is placed
at the junction between the controller and the view (the controller
being server-side).

Now - more generally, layered applications are a way of structuring
your solution.

I like the 4 layer model, as it is descriptive and usually brings home
another point:

Presentation:

How you display things to the end users;  the problem is presented in
a "language" describing the problem (and results) familiar to the end
user, i.e. in the language of the problem domain.Typically, this
is NOT in terms of "classes" or function calls (that is the "language"
of the presentation), but rather (for example) in terms of account
status, or amount due, or things registered for.

Corresponds closely to "V" from MVC terminology.

Business Rules:
This is the solution, in the language of the problem-domain, i.e. in a
way the end-user would be able to understand.   Accounts are
represented as accounts,  names as names, etc.   This is devoid of
implementation logic (that is, there is nothing that says "but you
have to hold it this way for it to work in a python dict" --- because
a python dict has nothing to do with the end-user's problem domain).

Engineering Rules:
This is whatever logic you need to implement the Business rules, in
the language needed to accomplish this in the technology in use.  For
example,
account_in_good_standing() - lets say this will be business-rule-like
- would list things like:   account_exists(),
account_positive_balance(), etc.   The engineering rules would
implement   account_exists() logic as DAL validator statements
(depends on table definitions - even if they are "close" to the
business language),  perhaps queries.   Since another implementation
might use sqalchemy rather than DAL, the Engineering rules (the way
you would implement)  would differ for that system, BUT NOT the
Business Rules.

Together, Business Rule and Engineering Rule layers correspond to "C"
from MVC.

Data Persistence Layer:
This is where sqalchemy, DAL,  data manipulation and storage code (and
device and network layer drivers) would go.   db.define_table()  (and
all it's contents) are here.   Even as you might be accustomed to
seeing "requires" - standard statements in something like db.py, by
this definition, those would only be standard validators required to
ensure data consistency -- validators that belong in the Engineering
Rule layer would appear elsewhere, strictly speaking.

This corresponds closely to "M" from MVC.

So much for background definitions - we have MVC

Now - client-server is nothing special:  it is just communicating
programs.   When you want responsiveness, or other forms of
partitioning your solution, you simply put more out on the client-
side.

BEFORE you parrition parts of your solution between client and server,
they are all part of the solution stack.   By writing pieces in
javascript, you are just choosing another language (you _could_ write
your entire application - using something like jsshell - on the server
if you wanted).   This is even clearer if you consider Java (and the
same goes for actionscript, or 'processsing' language).

Now - architecturally, you have a solution, and it potentially is a
networked solution.   So it will have a network boundary.   In the
simplest form, contollers all reside on the server, and business
ruiles (BR) may be the direct connection the the view, and in turn
call engineering-rule (ER) entities by simple function calls (lets
say).

If some of the view logic (pre-processing - i.e. selecting menu
elements) is done on the server (web2py views), the rest is computed
at the client (i.e. css rendering, javascript).

This "traditional" or simple web app architecture is MVC  (or PL, ER/
BR,  DL), and looks something like this:

[client]---> PRESENTATION
 ---
[servr]--> CONTROLLER
[servr]--> MODEL

or simply:

V
--
C

M

WHen you split this functionality, hand part off to javascript, you
might have something like this:

V V V V
   --
C C C C
--
M M M M (client)
   ---
   M (server)

You now have to decide:   does the client data store (say, for a full
editor, such as Aviary.com) communicate directly with a counterpart on
the server (i.e. little more than a storage service), or will the
client-M need to talk through a server-C to further validate
consistency at the server.

If you are with me so far, then Thadeus's question sounds like "where
do I put the client-code, to keep it MVC-like in organization, to help
me keep my sanity during development and revision"

This is a good question - and even m

Re: [web2py] Re: Here's a theory question

2010-03-30 Thread Thadeus Burgess
> If you are with me so far, then Thadeus's question sounds like "where
> do I put the client-code, to keep it MVC-like in organization, to help
> me keep my sanity during development and revision"

You hit the nail on the head.

In the simplest form of the issue.

To take an idea from gaming.

There are two parts, the gaming client, and game server.
The server handles all data storage/retrieval, it handles all logic
(damage calculations, position movement, unit spawns, chat logs).
The client takes data from the server (a list of all sprites) and
renders them, and allows you an interface to send the server input.
However the client has special logic to make sure your input matches
only that which makes sense to the games logic.

In this case, javascript is the game client, and web2py is the game server.

Javascripts job is to take data, format it in a pretty way, and
provide interfaces to allow for input that still adhears to the
business logic.

web2py handles the data storage/retrieval, and all logic
(calculations, accounts, appointments, contact history).

So here, what is returned as a "web2py view" is not really a view at
all, but a client side application that happens to be in javascript.

Now client side applications of any type (javascript, java swing,
tkinter, pygame) follow their own MVC conventions. Where your "model"
is the interface to communicate with the server, your "view" is the
presentation and input handling layer, and your "controller" handles
the transition from presentation to engineering layer.

Now we get into the grit of the issue. If web2py can only return one
view/.html file, how do I separate my javascript in such a way that
makes sense, so that it can all be streamed in one request by web2py,
but still communicate via ajax with web2py without refreshing the page
completely. So you end up with your view files actually being the
cilent application, and your server exposing services, where your
controllers response is now the "view"

-Thadeus





On Tue, Mar 30, 2010 at 4:16 PM, Yarko Tymciurak
 wrote:
> On Mar 30, 1:01 pm, Thadeus Burgess  wrote:
>> How do you MVC a javascript client application?
>
> Here's the "simple" of it:
>
> An application is ... an application.
>
> Layered applications are partitioned into layers for (among other
> things)  a clean interface between layers.
> This is important for a couple of reasons, one of them being the
> ability to move where the network boundary is.
>
> In typical, plain web2py applications, the network boundary is placed
> at the junction between the controller and the view (the controller
> being server-side).
>
> Now - more generally, layered applications are a way of structuring
> your solution.
>
> I like the 4 layer model, as it is descriptive and usually brings home
> another point:
>
> Presentation:
>
> How you display things to the end users;  the problem is presented in
> a "language" describing the problem (and results) familiar to the end
> user, i.e. in the language of the problem domain.    Typically, this
> is NOT in terms of "classes" or function calls (that is the "language"
> of the presentation), but rather (for example) in terms of account
> status, or amount due, or things registered for.
>
> Corresponds closely to "V" from MVC terminology.
>
> Business Rules:
> This is the solution, in the language of the problem-domain, i.e. in a
> way the end-user would be able to understand.   Accounts are
> represented as accounts,  names as names, etc.   This is devoid of
> implementation logic (that is, there is nothing that says "but you
> have to hold it this way for it to work in a python dict" --- because
> a python dict has nothing to do with the end-user's problem domain).
>
> Engineering Rules:
> This is whatever logic you need to implement the Business rules, in
> the language needed to accomplish this in the technology in use.  For
> example,
> account_in_good_standing() - lets say this will be business-rule-like
> - would list things like:   account_exists(),
> account_positive_balance(), etc.   The engineering rules would
> implement   account_exists() logic as DAL validator statements
> (depends on table definitions - even if they are "close" to the
> business language),  perhaps queries.   Since another implementation
> might use sqalchemy rather than DAL, the Engineering rules (the way
> you would implement)  would differ for that system, BUT NOT the
> Business Rules.
>
> Together, Business Rule and Engineering Rule layers correspond to "C"
> from MVC.
>
> Data Persistence Layer:
> This is where sqalchemy, DAL,  data manipulation and storage code (and
> device and network layer drivers) would go.   db.define_table()  (and
> all it's contents) are here.   Even as you might be accustomed to
> seeing "requires" - standard statements in something like db.py, by
> this definition, those would only be standard validators required to
> ensure data consistency -- validators that belong in the Engineering
> Rule layer

[web2py] Re: Inserting into multiple related tables.

2010-03-30 Thread mdipierro
Notice you can do

user = db.users.insert(name="John")
print user
1
print isinstance(user,int)
True
print user.name
"John"

magic!


On Mar 30, 12:18 pm, Thadeus Burgess  wrote:
> user_id = db.users.insert(.)
> contact = db.contacts.insert(user = user_id, user_recording='/hi/')
>
> So insert returns the id of the newly inserted record..
>
> If you want the actual object of what you just inserted you need
>
> user = db.user[db.users.insert(...)]
>
> Now you can perform, user.update/user.update_record() etc etc.
>
> -Thadeus
>
> On Tue, Mar 30, 2010 at 12:09 PM, compassiontara  wrote:
> > Perhaps I'm missing the obvious, but I can't figure out how to make
> > this work:
>
> > db.define_table('users',
> >        Field('phone','string',unique=True),
> >        Field('safe','boolean',default=False),
> >        Field('allow_le','boolean',default=False),
> >        Field('safe_time','datetime'),
> >        Field('finished','boolean'),
> >        Field('finished_time','datetime'),
> >        Field('start_time','datetime'),
> > )
> > db.define_table('contacts',
> >        Field('user',db.users),
> >        Field('phone','string'),
> >        Field('user_recording','string'),
> >        Field('called','boolean',default=False),
> > )
>
> > db.users.insert(phone='17125551212',safe_time=datetime.datetime.now()
> > +3600)
> > db.contacts.insert(user=user_id,user_recording='/var/sounds/
> > blah.wav',phone='1551212')
>
> > where the db.contacts insert needs the .id from the db.users.insert.
> > I want both to be within a transaction, but because web2py does
> > transactions and commits automatically at end, how would I make this
> > happen?
>
> > I understand I could do something insane like commit(), do a query to
> > get the new ID record, and then do the insert for contacts, and then
> > if that fails, go delete the record from users, but I'm hoping that
> > there is a more humane way of doing this?
>
> > With Love,
> > Tara
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Does fake_migrate work?

2010-03-30 Thread mdipierro
web2py.com/book or web2py.com/AlterEgo

On Mar 30, 12:44 pm, Thadeus Burgess  wrote:
> Where would be the most appropriate places to place this explanation?
>
> -Thadeus
>
> On Fri, Feb 26, 2010 at 5:09 PM, villas  wrote:
> > @Thadeus,  Thanks for such a comprehensive and helpful answer.
>
> > I did get fake_migrate to work eventually,  I had been blocking it
> > with another problem in my code.  That aside, part of my confusion was
> > that the latter two combinations you mention do the same. I suppose
> > one simply has to remember that fake_migrate is given precedence when
> > True.
>
> > Much appreciated!  D
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: template, static files, routes.py

2010-03-30 Thread mdipierro
{{def title():}}
helloworld
{{return}}

On Mar 30, 1:02 pm, Thadeus Burgess  wrote:
> Alright, look at this example. "helloworld" always gets printed, the
> function is not being redefined as expected. This is a simple example,
> but in theory I would use this for say the websites sidebar not the
> page title...
>
> Any suggestions I have require changes to gluon and add support for blocks.
>
> ## layout.html
> {{def title():}}
> helloworld
> {{pass}}
>
> 
> {{title()}}
> {{include}}
> 
>
> ## view.html
> {{extend 'layout.html'}}
>
> {{def title():}}
> I Like Pie
> {{pass}}
>
> Hello, Did you know that I like Pie... also.. The Cake Is A Lie!
>
> I expect my title to be I Like Pie... but really my title is helloworld
>
> -Thadeus
>
> On Wed, Jan 6, 2010 at 1:57 PM, mdipierro  wrote:
> > Mind that if you have
>
> > {{def a()}}hello{{return 'world'}}
>
> > then
>
> > {{a()}} prints renders as 'hello' but {{=a()}} renders as 'helloworld'
>
> > Massimo
>
> > On Jan 6, 1:07 pm, KMax  wrote:
> >> I just check layout.html and found there place for menu.
> >> So it should not be the issue to plase at layout.html code like
> >> {{=myhead()}} and only issue will be valid return of myhead().
> >> is it?
> >> On 6 янв, 21:36, mdipierro  wrote:
>
> >> > Yes and no. the web2py template language is very different from
> >> > Django's because everything inside {{...}} is pure python. This means
> >> > there is no concept of blocks but in python you have function calls.
>
> >> > You can do
>
> >> > #based.html
> >> > {{def something()}}text goes here{{return}}
> >> > {{extend 'layout.html'}}
> >> > Hello world
>
> >> > #layout.html
> >> > 
> >> > {{something()}}
> >> > {{include}}
> >> > 
>
> >> > The def defines a funciton that you can use as a block.
>
> >> > On Jan 6, 6:13 am, Sujan Shakya  wrote:
>
> >> > > I have some questions that I have not understood.
>
> >> > > In layout.html, I found only one {{include}}.
> >> > > Is it possible to use more {{include}} in layout.html so that we can
> >> > > achieve equivalent of the following:
> >> > > {% block head %}{% endblock %}
> >> > > {% block content %}{% endblock %}
> >> > > {% block col3 %}{% endblock %}
>
> >> > > How are the static files served in production servers? Are they served
> >> > > thru apache/lighttpd or web2py itself ?
>
> >> > > And why is it that the use of routes.py not preferred?
>
> >> > > Thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] web layouts

2010-03-30 Thread elegant_hippie
I have a few questions

1) I'm a new user - I would like to learn how to change layouts in
web2py and possibly add javacript, ajax etc.

2) How to I view the changes I make? I have been playing with the code
but can't seem to understand how to view the changes I make.

probably very basic question - but when it comes to web2py my skills
are as basic as it can get. Please help.

thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Ajax and Auth API

2010-03-30 Thread Yannick
Thanks for the note I followed your instructions step by step
unfortunately even this solution doesn't work... the Action dictate
the display, I have NO control on the view...

#
#here is the view Register.html:
#

{{=form.custom.begin}}
 Full Name: 
 Email: 
 Password:  
 Verify Pwd: 
 
{{=form.custom.end}}

#
# Here is the action
#
def register():
...
next = URL(r=request,f='index')
return auth.register(onaccept=lambda form:
(updateInfo(form),response.headers.update({'web2py-component-
command':"document.location='%s'"%next})))

Whatever I enter in the view will not be display NOTHING, only the
registration form return from the action will be displayed... It's
like  the form from the action override everything html code I
enter...

I'm kind of desperate... If you have any other idea please let me
know... Or if you know a place where there is a working example please
send me a link... In the meantime I'll just drop this Auth API -
Ajax...

Thanks a lot for your help...
Yannick P.



On Mar 27, 8:36 pm, mdipierro  wrote:
> IF, as I assume, the register action is called via the
> {{=LOAD('controller','register')}} helper THEN
>
> there should be no ajax handling in register.html. It should just be:
>
> {{=form.custom.begin}}
>  Full Name:  name="fullname" type="text" value="" />
>  Email:  type="text" value="" />
>  Password:   name="password" type="password" value="" />
>  Verify Pwd:  type="password" />
>  
> {{=form.custom.end}}
>
> Moreover all the INPUT fields in the custom form must have names as
> the corresponding fields in auth_user table and all required fields i
> auth_user MUST be present in the custom form.
>
> Moreover since you form is using
>  type="text" value="" />
> instead of {{=form.custom.widget.fullname}} (assuming you do have a
> field called fullname, which is not there in the default) you will
> have to handle manually all error reporting.
>
> On 27 Mar, 10:10, Yannick  wrote:
>
>
>
> > Hello Massimo,  First thanks for you help... I'm stil not successful
> > with customizing the form for Auth Api using Ajax. Please let me know
> > what I'm doing wrong... Here is my view and controller (I did not
> > extend Layout.html)
>
> > #
> > # Register.html
> > ##
> > 
> > 
> >  $('#regForm').submit(function(){
> >     url = "{{=URL(r=request, f='register')}}";
> >     ids = [ 'auth_user_fullname', 'auth_user_email',
> > 'auth_user_password', 'auth_user_password_2' ];
> >          ajax(url, ids , 'registerMsg');
> >  });
>
> > // I took this from Web2py_ajax just for testing this Register
> > function ajax(u,s,t) {
> >   var query="";
> >   for(i=0; i >      if(i>0) query=query+"&";
> >      query=query+encodeURIComponent(s[i])
> > +"="+encodeURIComponent(document.getElementById(s[i]).value);
> >   }
> >   jQuery.ajax({type: "POST", url: u, data: query, success:
> > function(msg) { if(t==':eval') eval(msg); else
> > document.getElementById(t).innerHTML=msg; } });}
>
> > 
>
> >  
> > 
> >  > method="post">
> >  Full Name:  > name="fullname" type="text" value="" />
> >  Email:  > type="text" value="" />
> >  Password:   > name="password" type="password" value="" />
> >  Verify Pwd:  > type="password" />
> >  
> > 
> > 
>
> > 
>
> > ##
> > # Controller
> > ##
>
> > def register():
> >     auth.settings.table_user.last_name.writable=False
> >     auth.settings.table_user.last_name.readable=False
>
> >     next = URL(r=request,f='index')
> >     return auth.register(onaccept=lambda form:
> > (updateInfo(form),response.headers.update({'web2py-component-
> > command':"document.location='%s'"%next})))
>
> > #
>
> > When doing this my view has no control on the display, it's like the
> > form return from the register Action overwritte everything... Can you
> > please let me know when I'm wrong here...
> > Thanks,
> > Yannick P.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: web layouts

2010-03-30 Thread mdipierro
look into

http://gluonframework.wordpress.com/2010/03/22/skinning-web2py/

and this

http://web2py.com/book/default/section/5/4

hope it helps.

Massimo

On Mar 30, 5:30 pm, elegant_hippie  wrote:
> I have a few questions
>
> 1) I'm a new user - I would like to learn how to change layouts in
> web2py and possibly add javacript, ajax etc.
>
> 2) How to I view the changes I make? I have been playing with the code
> but can't seem to understand how to view the changes I make.
>
> probably very basic question - but when it comes to web2py my skills
> are as basic as it can get. Please help.
>
> thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Ajax and Auth API

2010-03-30 Thread mdipierro
One more try.. closer to the solutions...

view  as before and action

def register():
...
next = URL(r=request,f='index')
return dict(form=auth.register(onaccept=lambda form:
(updateInfo(form),response.headers.update({'web2py-component-
command':"document.location='%s'"%next}

On Mar 30, 8:06 pm, Yannick  wrote:
> Thanks for the note I followed your instructions step by step
> unfortunately even this solution doesn't work... the Action dictate
> the display, I have NO control on the view...
>
> #
> #here is the view Register.html:
> #
>
> {{=form.custom.begin}}
>  Full Name:  name="fullname" type="text" value="" />
>  Email:  type="text" value="" />
>  Password:   name="password" type="password" value="" />
>  Verify Pwd:  type="password" />
>  
> {{=form.custom.end}}
>
> #
> # Here is the action
> #
> def register():
>     ...
>     next = URL(r=request,f='index')
>     return auth.register(onaccept=lambda form:
> (updateInfo(form),response.headers.update({'web2py-component-
> command':"document.location='%s'"%next})))
>
> Whatever I enter in the view will not be display NOTHING, only the
> registration form return from the action will be displayed... It's
> like  the form from the action override everything html code I
> enter...
>
> I'm kind of desperate... If you have any other idea please let me
> know... Or if you know a place where there is a working example please
> send me a link... In the meantime I'll just drop this Auth API -
> Ajax...
>
> Thanks a lot for your help...
> Yannick P.
>
> On Mar 27, 8:36 pm, mdipierro  wrote:
>
> > IF, as I assume, the register action is called via the
> > {{=LOAD('controller','register')}} helper THEN
>
> > there should be no ajax handling in register.html. It should just be:
>
> > {{=form.custom.begin}}
> >  Full Name:  > name="fullname" type="text" value="" />
> >  Email:  > type="text" value="" />
> >  Password:   > name="password" type="password" value="" />
> >  Verify Pwd:  > type="password" />
> >  
> > {{=form.custom.end}}
>
> > Moreover all the INPUT fields in the custom form must have names as
> > the corresponding fields in auth_user table and all required fields i
> > auth_user MUST be present in the custom form.
>
> > Moreover since you form is using
> >  > type="text" value="" />
> > instead of {{=form.custom.widget.fullname}} (assuming you do have a
> > field called fullname, which is not there in the default) you will
> > have to handle manually all error reporting.
>
> > On 27 Mar, 10:10, Yannick  wrote:
>
> > > Hello Massimo,  First thanks for you help... I'm stil not successful
> > > with customizing the form for Auth Api using Ajax. Please let me know
> > > what I'm doing wrong... Here is my view and controller (I did not
> > > extend Layout.html)
>
> > > #
> > > # Register.html
> > > ##
> > > 
> > > 
> > >  $('#regForm').submit(function(){
> > >     url = "{{=URL(r=request, f='register')}}";
> > >     ids = [ 'auth_user_fullname', 'auth_user_email',
> > > 'auth_user_password', 'auth_user_password_2' ];
> > >          ajax(url, ids , 'registerMsg');
> > >  });
>
> > > // I took this from Web2py_ajax just for testing this Register
> > > function ajax(u,s,t) {
> > >   var query="";
> > >   for(i=0; i > >      if(i>0) query=query+"&";
> > >      query=query+encodeURIComponent(s[i])
> > > +"="+encodeURIComponent(document.getElementById(s[i]).value);
> > >   }
> > >   jQuery.ajax({type: "POST", url: u, data: query, success:
> > > function(msg) { if(t==':eval') eval(msg); else
> > > document.getElementById(t).innerHTML=msg; } });}
>
> > > 
>
> > >  
> > > 
> > >  > > method="post">
> > >  Full Name:  > > name="fullname" type="text" value="" />
> > >  Email:  > > type="text" value="" />
> > >  Password:   > > name="password" type="password" value="" />
> > >  Verify Pwd:  > > type="password" />
> > >  
> > > 
> > > 
>
> > > 
>
> > > ##
> > > # Controller
> > > ##
>
> > > def register():
> > >     auth.settings.table_user.last_name.writable=False
> > >     auth.settings.table_user.last_name.readable=False
>
> > >     next = URL(r=request,f='index')
> > >     return auth.register(onaccept=lambda form:
> > > (updateInfo(form),response.headers.update({'web2py-component-
> > > command':"document.location='%s'"%next})))
>
> > > #
>
> > > When doing this my view has no control on the display, it's like the
> > > form return from the register Action overwritte everything... Can you
> > > please let me know when I'm wrong here...
> > > Thanks,
> > > Yannick P.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Integrating GeoModel on AppEngine

2010-03-30 Thread Dane
Hey all,

I need to do some geospatial queries for my current project.
Unfortunately, GAE doesn't allow multiple numerical comparisons in one
query, so proximity queries based on latitude/longitude columns are
out.

GeoModel to the rescue (http://code.google.com/p/geomodel/).

By extending GeoModel, a GAE entity gains a location property that can
be queried by distance/bounding box, etc. My question is how can I use
this in a web2py model?

Example code from http://code.google.com/p/geomodel/wiki/Usage :

from geo.geomodel import GeoModel

class MyEntity(GeoModel):
  foo = db.StringProperty()
  bar = db.IntegerProperty()


some_entity = MyEntity(location=db.GeoPt(37, -122),
   foo='Hello',
   bar=5)
...
some_entity.location = db.GeoPt(38, -122)
some_entity.update_location()
some_entity.put()


resuts = MyEntity.proximity_fetch(
 MyEntity.all().filter('bar <', 10),  # Rich query!
 geotypes.Point(39, -121),  # Or db.GeoPt
 max_results=10,
 max_distance=80467)  # Within 50 miles.


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.