Hello,
I have an Apache server with mod_wsgi, and I would like to host web2py
alongside a variety of other things. For example:
http://example.com/ hosts a PHP website. Might link to things like /
about.php, /users/view.php, etc
http://example.com/files a standard Apache listing of files in a
the web server."
Cheers,
Kevin
On Nov 7, 2:57 pm, Anthony wrote:
> On Monday, November 7, 2011 4:34:26 PM UTC-5, Kevin Ivarsen wrote:
>
> > FWIW - back in March I had been given access as a book editor through
> > my gmail account, and I'd be happy to make these correcti
Hi folks,
I spotted a couple formatting errors in the online book today. In
chapter 7, under the section about the process and validate methods:
1. The formatting of the section header is a little strange - the
words "process" and "methods" are smaller than the rest of the text. I
assume that "va
SQL WHERE statements as strings is to
start with "WHERE 1=1" (which should get optimized away by the SQL
engine) and go from there. However, I couldn't find a way to make a
Query that evaluated to the equivalent of "1=1".
Cheers,
Kevin
On Oct 5, 1:39 pm, Kevin Ivarsen wrote:
&
Hi everybody,
I'm building a page that will search for rows in a database table
based on optional URL parameters, or return all rows if no parameters
are given. However, I'm having trouble finding a good way to build up
the query without having an existing Query object to start with.
Web2py curren
>
>
> On Monday, August 15, 2011 8:18:30 PM UTC-4, Kevin Ivarsen wrote:
> > Hi Anthony,
>
> > Thanks for the quick response.
>
> > I do use migrate=False already. I have not tried bytecode compiling
> > the app, but earlier today I did a quick test: I wrapped
won't be based solely on the controller and
> function.)
>
> Anthony
>
>
>
>
>
>
>
> On Monday, August 15, 2011 6:30:06 PM UTC-4, Kevin Ivarsen wrote:
> > Hello,
>
> > I'm using web2py with a relatively large legacy database. We have
> >
Hello,
I'm using web2py with a relatively large legacy database. We have
about 70 tables, and models/db.py is close to 1000 lines long.
The problem I'm facing is that all of these Field() constructors and
define_table() calls take about 150-200ms to execute, and this
overhead occurs each time any
Hi folks,
At some point between 1.94 and 1.96, the DAL seems to have lost the
(presumably supported) ability to select all entries from a keyed
table. Consider the following test:
db = DAL(None)
db.define_table('mytable',
Field('foo'),
Field('bar'),
primarykey=['foo'])
db(db.mytable).selec
Oops - looks like the fix already made its way into 1.96.2 or 1.96.3.
Great!
Kevin
On Jun 2, 2:34 pm, Massimo Di Pierro
wrote:
> will fix this tonight.
>
> On Jun 2, 1:00 pm, Loren McGinnis wrote:
>
>
>
>
>
>
>
> > I'm bumping this message, because the bug still hasn't been fixed in
> > the new
I ran into this awhile back, and the following fix worked for me.
There might be a cleaner way to do it, but I'll offer it here:
if hasattr(table,'_primarykey'):
fields = [(field.name, value) for field, value in fields]
fields = dict(fields)
return dict( [ (k,fields[k]) for k in table._prima
I see - guess I hadn't noticed that behavior previously. For what it's
worth, I found it to be surprising behavior today when I was testing
it out.
Kevin
On Jun 5, 7:21 pm, Anthony wrote:
> On Sunday, June 5, 2011 6:42:20 PM UTC-4, Kevin Ivarsen wrote:
>
> > I downloade
I downloaded the new 1.96 release today to try out. I spotted one
small bug in generic.html - the toolbar is not shown if there is only
one variable sent to the template. For example, given this controller:
def test():
return dict(foo=1, bar=2)
the toolbar shows up, but in:
def test():
r
It appears that Python's __getslice__(self, a, b) overload has a surprising
behavior. From
http://docs.python.org/reference/datamodel.html#object.__getslice__:
"If negative indexes are used in the slice, the length of the sequence is
added to that index."
So when you evaluate rows[-20:], Pytho
Yes, this is a replacement.
Trivial differences - just replaced MySQLdb references to
gluon.contrib.pymysql, removed the comment up top about depending on
MySQLdb, and added ".." to the python path so that it can find gluon.contrib
even if the web2py directory isn't in your system pythonpath.
I'm not sure if carrying a transaction across multiple requests is possible,
mainly because you can't be assured of getting the same connection to the
database across requests.
Looking through the code, it does appear to be possible to override the
default commit behavior at the end of a succes
alko Krause, minor modifications by Massimo Di Pierro,
Ron McOuat, and Kevin Ivarsen
'''
from optparse import OptionParser
import re
import sys
sys.path.append("..")
from gluon.contrib import pymysql
# If true, write some diagnostic messages to stderr. Overridden by -v opti
I see that the web2py book describes tarting the shell in Chapter 2 under
Starting Up:
http://web2py.com/book/default/chapter/02#Starting-up
However, I think Chapter 6 should clarify that you need to use the command
line shell and not the browser-based shell for doing the interactive
examples,
As of right now the site is working for me. It may have been a temporary
error.
Kevin
Are you using the shell in the web browser, accessed via the Admin app, or
the command line shell?
There are currently some limitations in the browser-based shell that prevent
things like database connections and open file handles from working.
(Speaking more precisely, the online shell can onl
Good catch. I've made the edit.
Cheers,
Kevin
The extract_mysql_models.py script runs at the command line - either from
cmd.exe in Windows or a Terminal window in Mac / Linux. Which operating
system are you running? I can try to walk you through the steps.
Also, I don't believe MySQLdb is included with web2py by default, but it is
easy to
I was about to suggest the same thing as Massimo. It's a trivial change to
the regex; I think the following works:
if (! this.value.match(/^[+-]?[0-9]*[.,]?[0-9]*$/)) {
I like the simplicity of this method, even if it doesn't provide perfect
client-side validation. Getting data about arbitrary
In web2py, you could import MySQLdb and make SQL queries directly, but you
would lose out on a lot of the time-saving features that web2py offers, such
as automatic form generation for database tables. Instead, you would
typically use web2py's DAL (Database Abstraction Layer), which provides a
One other thought - if web2py wasn't rejecting the form based on the formkey
after redirect, I think you would actually be running into an infinite
redirect loop here the way things are currently structured!
Cheers,
Kevin
Why do you need to redirect back to the same view to display the error? The
normal way of doing this is basically what you currently have: if there is
an error in the form in the POST, immediately redisplay the form.
I think the reason this is failing is because of the formkey technique used
by
To expand on DenesL's reply, from your controller you would access these
values in the following ways:
For http://example.com/app/controller/service.xml/somevalue you would use:
request.args(0) # returns "somevalue", or None if nothing is provided
For http://example.com/app/controller/service.
For another alternative which I think is more flexible, look at the
{{block}} syntax. This lets you define multiple sections that can be
overridden by an extending template. Example (untested):
-- layout.html
{{block title}}My default title{{end}}
{{block scripts}}
{{end}}
{{block content}}
{
Hi all,
I find the default javascript validators for integer, double, and decimal
SQLFORM fields to be a little annoying. Consider the following surprising
behaviors:
- You can't navigate within the textbox using the keyboard. Pressing left,
right, home, or end all result in the cursor jumping
Hi kyrussa,
Try the following:
layout.html:
Begin main layout
{{include}}
End main layout
layout_body.html:
{{extend "layout.html"}}
Begin layout body
{{include}}
End layout body
mypage.html
{{extend "layout_body.html"}}
This is my content
When you render mypage, you should get:
to integrate into the web2py source if you think it would
be useful.
Cheers,
Kevin
'''
Create the web2py code needed to access your mysql legacy db.
This plugin needs the MySQLdb module
Access your tables with:
legacy_db(legacy_db.mytable.id>0).select()
If the script crash
As I understand it, there was an error and the second part unfortunately did
not get recorded.
Cheers,
Kevin
Hi Massimo,
The latest changelog entry shows 1.64.4 rather than 1.94.4. The same thing
happened with 1.93... have you checked to see if your keyboard is
upside-down? :-)
Also, should there be a 1.94.5?
Cheers,
Kevin
Hi Neveen,
Without a bit more context I'm having trouble determining the problem. In
principle you should be able to pass vars=request.vars to URL and have them
show up in the redirected URL. For example:
def func1():
if request.vars.value == "hello":
return "you submitted hello"
Massimo's method may be better -- I haven't personally experimented with the
restful stuff yet.
But you can still use SQLFORM or SQLFORM.factory with form.accepts() to run
the validators. You just don't display the form anywhere if you don't need
to. You also need to pass formname=None to acce
villas: tonight I went through the edits you made, and just about everything
looks like it was correctly added to the book, including these two IS_DATE
corrections. Thanks for your work on this!
Kevin
Another very useful video - thanks for putting these out! Clever use of
decorators for template support.
While we're on the topic of using web2py features outside of web2py:
I have a package with library code, command line scripts, etc. -- let's call
it "mypackage"
Let's say I also have a web2
With today's new release I checked the changelog and noticed that the
most recent entires are still at the bottom of the page.
There was a thread a couple weeks ago where Nik Go submitted a
reversed changelog, which I find more readable:
http://groups.google.com/group/web2py/browse_thread/thread/
I was confused by this as well. In the message above, I think
"simply add this to your model"
should read
"simply add this to your *controller*"
which of course makes much more sense.
On Mar 17, 4:05 pm, "David J." wrote:
> For clarification; This gets put in the model code not controller cod
I'm biased in that I don't do any GAE development, but even though it's
"only" 7MB, it seems like a big jump relative to the size of the current
code base. If you exclude the "examples" directory under applications, the
web2py source tree comes in at about 5 megs. I really like the lightweight
Nevermind, I see it was addressed in this thread:
https://groups.google.com/d/topic/web2py/-w5YrSs67Mc/discussion
Looking forward to seeing it released!
Kevin
Massimo: I've seen you use a tool called kryten.py to play back python
sessions in some recent videos (e.g. http://vimeo.com/20760298).
Google doesn't seem to know about it... is this something you wrote?
Would you consider making it available?
Thanks,
Kevin
Miguel,
MySQL can communicate over either TCP or a named pipe. It's possible
that your MySQL server is only listening on the named pipe. I could
imagine that the mysql command line client would connect successfully
over this channel, but Python would try to connect to the TCP socket
and fail.
Try
I don't know how to fit it in elegantly, but wanted to offer the idea
of relating Python's "batteries included" mantra to web2py. That's one
thing that struck me about web2py early on - it gives you a lot of
nice features right off the bat.
Kevin
On Mar 15, 3:49 pm, mwolfe02 wrote:
> +1 Product
oject.
>
> I have already done thoseedits(and I hope correctly!). If you post
> moreedits, I and other editors are very pleased to make the
> changes.
>
> Best regards,
> David
>
> On Mar 14, 8:53 pm, Kevin Ivarsen wrote:
>
>
>
>
>
>
>
> >
So far I like "Productivity by design".
Although it depends on what the goals of a tagline should be. If you
want to make the framework discoverable through search engines, it
might be more important to include words like python / mvc / web
framework. The web2py name by itself has the strength of
Folks,
I've been working my way through the web2py book. The content is
outstanding - many thanks to everyone who is involved with this work!
However, a few small typos popped out at me along the way. Starting
around Chapter 5 I began recording these as I noticed them. (I haven't
yet tried to go b
Wonderful, thanks! For some reason it isn't coming up when I search
blip.tv for web2py, so I had trouble finding it.
Looking forward to watching it.
Kevin
On Mar 14, 11:39 am, Anthony wrote:
> http://www.blip.tv/file/4879126
>
>
>
>
>
>
>
> On Monday, March 1
Videos from some of the Pycon talks have been showing up on
http://pycon.blip.tv.
Does anyone know if videos or audio from the tutorial sessions
(Massimo's web2py tutorial in particular) will eventually become
available?
Thanks,
Kevin
I recently had a good experience deploying a web2py website with a VPS
on hostgator.com. During peak periods we had several dozen
simultaneous users hitting the site, and everything remained speedy
and responsive. We used MySQL and Apache with mod_wsgi to deploy.
Kevin
On Mar 7, 4:12 am, Alejandr
Hello,
I recently ran into this problem as well - field names with uppercase
characters were ignored in SQLFORM inserts/updates. Luckily, I found
that the behavior is fixed in the latest 1.93.2 release of web2py. Try
upgrading and see if that solves the problem.
Kevin
On Mar 7, 4:15 am, StUStD
I'm connecting to a legacy MySQL database (migrate=False) with a lot
of fields declared BOOLEAN, and noticed that attempts to modify these
fields with the DAL failed. The DAL issues a query like this:
UPDATE sometable SET someflag='T' WHERE ...
but this gets rejected by MySQL.
Reading through da
The latest changelog entry has a small typo: the version is listed as
"1.63.1-2", but I believe it should be "1.93.1-2".
http://web2py.com/examples/default/changelog
Hopefully this is the appropriate place to report that sort of thing.
Cheers,
Kevin
53 matches
Mail list logo