I don't know too much about it yet, but I do know that it is still
experimental, so it hasn't replaced anything yet. There was talk of
replacing it in the future, but it may end up complimenting it. Again, I'm
not totally sure about the future of it, but right now, you can play with
it, but pro
You typically need to run it in the web2py environment (use absolute paths):
*/1 * * * * python /path/to/web2py/web2py.py -J -S app_name -R
/path/to/script
You could also add something like "2&1> /path/to/log.log" so that output
gets put into a log file in case there's an error in your script.
I forgot to mention that if you are using db at all in your script, that you
need to use the -M option to import the models.
I think SSL is broken (and so is Google Groups as this will be my second
post. The first one didn't seem to make it). I just did a web2py update to
the latest trunk version and haven't done an update since x509 was added. I
think the x509 patch for rocket is what started all of this. I have atta
It was the admin application, which should be using HTTPS when you access it
over HTTPS right? I just tried with a test app and the same thing happens.
I commented out like 518 in rocket.py and that silences the errors, but is
that a good thing?
There might be another problem here. I just check
It would be really cool if web2py's DAL supported an XMLRPC backend.
Please forgive me if this post shows up a bunch of different times, but I'm
having trouble with Google Groups not posting my replies, even though it
says it did. So for the fourth time:
We could add an XMLRPC adapter to the DAL that instead of making SQL calls,
could build an XML version of the
Look in your app's controllers/appadmin.py file and remove these lines:
if request.env.http_x_forwarded_for or request.env.wsgi_url_scheme\
in ['https', 'HTTPS']:
session.secure()
elif (remote_addr not in hosts) and (remote_addr != "127.0.0.1"):
raise HTTP(200, T('appadmin is disabled
The following commit has caused an error when columns/fields are not
specified:
http://code.google.com/p/web2py/source/detail?r=48e6f24a4ed36bb35bcd3f37e9ebc955dc9868a1
I have been trying to figure out where this error has been coming from and
finally narrowed it down. Here is the code I have b
Previously, this type of problem was related to connection pooling. Try
turning it off and see if that has any effect.
Whenever I use redirect after a form submission, the flash message is
always:
You are being redirected here"
I have tried setting response.flash and session.flash, but this message
always pops up after the page is refreshed. This is really annoying. At the
end of http.py, I see that the redir
Sorry it took so long to get back. Been a crazy couple of days:
This is my controller:
@auth.requires_login()
def index():
form = SQLFORM.factory(
Field('partnumber', length=30, requires=IS_NOT_EMPTY()),
Field('quantity', 'double', default=1,
requires=IS_FLOAT_IN_RANGE(0.1, 1
I used Python's PDB extensively. I develop a couple of JSONRPC/XMLRPC
services with no GUI on web2py and logging helps, but sometimes you just
need to step through the code. Anywhere I need the Python code to break
execution, I just put in this line:
import pdb; pdb.set_trace()
Then you are gi
I didn't think about the try/except. The add_partnumber method will throw an
HTTP exception if something fails, so that's why I was catching it. I moved
the redirect() outside of the try/except and it is working as expected now.
Thanks for catching that!
I don't know how everyone else feels about this, but I am not easily
offended. I'm generally very laid back and take a "to each their own"
approach to something I don't agree with. Having said that, I have to deal
with extremists on both sides of a wide variety of different topics in
regular li
I recently ran into this.
Instead of looking for request.vars.myarray, you have to do it like this:
myarray = request.vars.get('myarray[]', None)
When you get an array as a var, '[]' gets appended to the name of the var,
and since you can't use brackets for Python variable names, you have to gr
Not sure what effect it will have, but I believe the only way to really free
memory in Python is to use something like this:
rows = db(...).select(...)
del rows
This won't immediately free the memory, but might make it free faster than
dereferencing it. Alternatively, you can call gc.collect()
I think 1.95.1 was the last version to support Python 2.4. If you are using
modules, this release will require you to use the old import method by
calling local_import('module_name'). I couldn't immediately find where to
download it, so maybe someone else can direct you to it, now that you know
I know this was mentioned elsewhere, but I feel that being mobile-friendly
is a must, since these devices are being used to browse the web as much as
(if not more than) regular desktops.
That would be cool. I've never used Ninja IDE, but it looks nice. I'm all
for more IDE support for web2py. Then all it needs is the Mac version, and
we're all set :)
That is very odd. I have a production SSL site that I have been running for
months without an issue. Even my development server (which runs trunk, but
as of a week ago...haven't updated in a while) runs SSL only and it can run
for weeks at a time.
I guess the usual questions apply: what version
I don't think so. I access my dev machine using the IP all the time. Can
you try using the source code version instead of the binary and see if that
makes a difference?
Having a little trouble with getting an attachment to work. This is a
simplified version of the controller:
form = FORM('Attach', [INPUT(_name='attachment', _type='file')])
if form.accepts(request):
v = form.vars.attachment
if not v is None and not v == '':
v = db.attachments.att
I'm starting to think this is a bug since SQLFORM calls store() like this:
store(f.file, f.filename)
I could do the same thing in my code, but the documentation I've seen so
far only requires you to pass one parameter to store(). So, if the DAL was
changed to look something like this (starting
The list part was a typo, because the controller was just an example. I
found the original thread where I got the store() code from:
https://groups.google.com/forum/#!searchin/web2py/manual$20upload/web2py/a5YanKxNbVU/99bxaB7A82IJ
See Massimo's first reply. Also see this thread, because this per
I was originally going to suggest checking for FieldStorage rather than
StringIO, but wasn't sure if I wanted to suggest adding another import (of
cgi).
We REALLY need a CMS. I regularly develop sites that may have one or two
pages that need web2py's power, but the rest of the pages only need basic
CMS/Blog functionality. So I end up writing the those pages by hand in
HTMLseems like such a waste.
Since I would regularly use and CMS/Blog fun
I spent months evaluating different web frameworks written in Java, Python,
PHP, and several others. I found that web2py was the easiest and most
productive of them all. Being Python-based, web2py combines ease-of-use and
fast performance with an incredible amount of power. Put simply, I have
d
I can help with development. We need this functionality. Sort of like a
reverse Drupal in that web2py would be a framework that also does CMS.
try moving PIL to "modules", not models.
I watched it yesterday and it worked. Though Chrome flagged the JavaScript
as insecure, so I told it to run anyways and the video worked.
Nice job. I'll be testing soon. By the way: Is @mobilize documented in the
book? I looked through it briefly but didn't see any mention of it.
Out of curiosity, what is the benefit of having the browser "compile" the
view for display? Web2py's template engine is very fast. I could understand
building the view in Python code (like Pyjamas or Qooxdoo), since they
provide "widgets" that make interacting with an application better. But I
You typically have to use the web2py shell:
python web2py.py -S appname -M
If you are trying to use gluon libraries by themselves in some other
application (without using web2py at all), then you either need to put
web2py on your PYTHONPATH or copy the needed libraries where you want to
use th
>
> Is 'decimal' the best field type for storing financial amounts that will
> be involved in math calculations?
>
I've been doing a lot of research on the decimal vs float thing for a
while, and every database admin I've ever talked to about it says the same
thing: When it comes to financial
Further examples:
quantity = 20.5
unit_cost = Decimal('2.99')
total_cost = Decimal(str(quantity)) * unit_cost
Or using the the example you provided above:
if ((form.vars.drops * form.vars.price_change) / form.vars.start_price) <
0.20
Assuming that form.vars.drops is a float, and form.vars.pri
Great find Angelo! Would things like Cython and other CPython extensions
(.so) work with StaticPython (obviously they would need to be built for the
platform)?
Glad to know someone is using my plugin :)
I had attempted to make a full-service CMS at one time, but I got caught up
on how theming and templating would work. I never did figure it out
completely, but I did learn a few things:
- I used a bare minimum layout. This basically contained the doctag,
, and . Everything else was generated by
I am new to web2py and I just finished reading the book and have
started to develop my first application. I recently had the same
problem mentioned in this thread:
http://groups.google.com/group/web2py/browse_thread/thread/e620c5708f746629/2b123921e3695e77?lnk=gst&q=mssql2#2b123921e3695e77
I was w
I am trying to integrate with an existing database which uses varchar
primary key fields as references instead of integers. Reading the
book, I found that I could still get this to work by setting
primarykey=['the_field'] in the define_table definition. The table I
am defining has two fields that r
but in ascii. That means the length of
> the fields is not the number of unicode chars but the length of the
> utf8 encoded chars. It also uses BIT for booleans.
>
> mssql2 uses unicode so length is correct and CHAR(1) (T or F) for
> booleans. This is newer and less tested.
>
>
I am trying to make an 'admin' controller that will allow
administrators of the app to administer different parts of the app.
One of the things to administer will be listing, adding, and removing
of users. So, ideally, I would like my URL structure to be like this:
"/[app]/admin/users/index". I hav
; def new():
> return dict(message="Add new user")
> def edit():
> return dict(message="Edit an existing user")
> return locals().get(request.args(0),'not defined')
>
> On Feb 18, 12:47 pm, Ross Peoples wrote:
>
>
&
How are you hosting this? Shared hosting provider, VPS, or running
your own server?
The reason I'm asking is because I run WordPress with BlueHost shared
hosting, and more recently, I started running a site on my own
dedicated server. The performance of WordPress is terrible. At first I
thought it
I have played around with several of the plugins and such. None of them
individually cause a slow down, but adding 4 or more starts slowing down
everything. I mean everything: the site and the admin interface. Regardless,
even a stock WordPress installation chews up a CPU whether using mod_php5
I ran across this problem a little bit ago and can't seem to solve it.
I have two tables similar to this:
db.define_table('site',
Field('site_name', length=255),
format='%(site_name)s'
)
db.define_table('content',
Field('site', db.site, unique=True),
Field('slug', length=80, requi
It still fails because MySQL has only slug set as UNIQUE. The line you gave
me doesn't have anything to do with database-level validation.
Ok, removing unique=True and using the line that Massimo gave me seems to do
the trick. The validation is only at form level, but that should be good
enough for my needs.
Thanks guys.
I am trying to develop a WordPress-like application with web2py and now I'm
thinking about URL structures. WordPress lets you select what kind of
permalink structure you want to use. With my application, I would like to
have pages mapped like this:
http://domain.com/the-page
I have played with
You mention that it prevents access to other controllers. In /default/page
would I need to check for the page title, and if doesn't exist, try to do a
redirect(URL(request.args(0)) or something like that?
I wouldn't mind doing /blog/the-post, but if I wanted to do an about or contact
page, I would always want that to be http://domain.com/about
Is there some way to catch error pages, check for an existing page slug and
redirect if there is one instead of just showing Invalid request?
On Feb 19, 2
, at 11:12 PM, Jonathan Lundell wrote:
> On Feb 19, 2011, at 4:38 PM, Ross Peoples wrote:
>>
>> I wouldn't mind doing /blog/the-post, but if I wanted to do an about or
>> contact page, I would always want that to be http://domain.com/about
>
> In that case, if you
I spoke too soon. Just going to / forwards the browser on to
/welcome/default/index. So at this point setting default_application did
absolutely nothing. Here is my entire routes.py just in case I did something
wrong:
router = dict(
BASE=dict(
default_application='SiteNet'
)
)
I figured out part of the problem. In the code above, it needs to be
'routers =', not 'router ='. This works exactly like you mentioned it would.
If you go to /test, it expects to find a test() function in your default
controller. In my case, since this is going to be a WordPress-like
applicati
That makes sense. So let me ask you this: would it be possible to
programatically add to routes_in and routes_out? I know this is probably
getting a little silly, but I really like a specific URL structure. So if I
used /posts/ for posts and /pages/ for pages, and the user created an about
page
That would be pretty cool! So, assuming this was in the current release now,
I would set the 'functions' variable inside routes.py or to the controller?
And then if you visit a function that doesn't exist, it falls back to index,
with the original URL as the first argument?
something like this should work:
my_object = db(db[table_name]['id']==my_id).select().first()
If you use brackets instead of dot notation for table names, you may not be
able to use dot notation for the field name. I don't know for sure, but
instead of doing this:
db[key].id
Try this instead:
I haven't tried it yet, but I looked at the diff in the trunkvery nice
:) Hopefully, I'll get a chance to check this out soon. I'm actually
writting two web2py apps. One is my WordPress clone which is my side
project, which is what I needed short URLs for, and my other app is one for
work t
I know that you can run tests on controller from Admin, but you cannot do
this for modules. I am planning on adding the core functionality of my
application into a module so that this functionality can be accessed from
any controller. This also provides some extra modularity. Since the bulk of
The main routes.py file in /web2py/routes.py should be editable from the
admin interface. And now that applications can have their own routes.py
files, it would be awesome if these could be edited in the admin interface
as well.
This is a temporary problem with Google Groups. They are working on it. Here
is the actually announcement from Google:
https://groups.google.com/d/topic/googlegroups-announce/2WNQAoNct1Q/discussion
This may not be the place for this question, but I just started using Git a
couple months ago. I'm still really new to version control and I use a GUI
for Git, so I couldn't even tell you what the commands are for it. But, what
is the difference between Git and Mercurial, and why would one choos
Thanks for the info. I'll be checking out Mecurial: The Definitive Guide.
On Feb 22, 2011, at 7:18 PM, Jonathan Lundell wrote:
> On Feb 22, 2011, at 11:49 AM, Ross Peoples wrote:
>> This may not be the place for this question, but I just started using Git a
>> couple m
True, but you could always keep a default routes.py file around, like you do
with routes.example.py. If the user screws something up, wipe out routes.py
and copy routes.default.py to routes.py. It's really no different than the
way it's done now if you screw up, the only difference is the added
After reading Jonathan's posts about Mercurial, I have decided to start
using it during my development. My only problem is I can't seem to figure
out how to set this up properly. I am using MacHG and have only made a
couple of test commits. Then, I wanted to download the web2py trunk and
merge
pbreit,
I already had a repository set up using the method you described. My problem
is that I wanted to update the web2py version I had to the one in the trunk,
but MacHG didn't like that.
Richard,
So, according to your first link, I should hit the Clone button to download
the web2py trunk to a folder on my machine, then copy my application's files
to the new directory. Then delete the old folder and rename the new one to
the name of the old one. Then do a commit.
Does that soun
Ok, I was confused about whether I should make a repository out of the
web2py folder or just my application's folder, so that helps clear that up.
So when you want to update your web2py installation from the trunk without
touching your applications, how do you do that? Just switch to the
web2py
Sorry, I was using the new Google Groups interface. I guess it doesn't include
quotes when you reply to a message from that interface. This reply was sent
from my mail client.
On Feb 24, 2011, at 2:39 PM, Jonathan Lundell wrote:
> On Feb 24, 2011, at 11:33 AM, Ross Peoples wrote:
>
Just noticed the update button...very cool. And luckily, I zipped up my entire
web2py folder before I started messing with MacHG so incase I screwed it up, I
could always wipe it out, decompress and start over. Also, I finally figured
out how it handles branching which is also very cool. Branchi
I am integrating with a legacy database running MSSQL. The table names are
in camel case, so the global settings table is called GlobalSettings. Here
is the table definition as I have it:
db.define_table('GlobalSettings',
Field('SettingName', length=255),
Field('SettingValue', length=255
nd use the var in place for all practical purposes e.g.
>
> db().select(db.GlobalSettings.ALL)
>
> becomes
>
> db().select(global_settings.ALL)
>
>
> On Feb 25, 11:04 am, Ross Peoples wrote:
>> I am integrating with a legacy database running MSSQL. The table
I believe we are using case insensitive collation, but I we weren't we'd be
screwed...as would any PostgreSQL user with forced capitals in the table names.
What is the web2py convention for naming tables and fields anyways?
On Feb 25, 2011, at 11:42 AM, Vasile Ermicioi wrote:
> http://weblogs.s
I guess this was more of a feature request, since I will soon have to tackle an
application using PostgreSQL that forces case-sensitive naming.
On Feb 25, 2011, at 3:03 PM, DenesL wrote:
>
> What issue?.
>
>
> On Feb 25, 11:32 am, Ross Peoples wrote:
>> True, but I'
I am running into a problem where web2py creates all the tables in my MSSQL
database with fields that do not allow NULL values. This is regardless of
the notnull=False setting on the fields.
I am using mssql:// as the adapter and having web2py create table
structures. A test table definition:
I know how to do this at the database level, but since web2py controls the
table structure, my problem was that web2py doesn't generate the code you
mentioned. But thanks.
I don't know how anyone else handles this, but I have been setting up things
like global settings in modules like this:
class GlobalSettings:
@staticmethod
def get_settings(db, cache:
return cache.ram('globalsettings', lambda:
GlobalSettings._get_settings_from_db(db), time_expire
I've always read that if you needed to centralize your logic, that you
should use modules instead of trying to do it in a model or trying to wire
up one controller to another. I used global settings as an example, as you
might need access to these settings in every controller, and duplicating th
The only I problem I see is that MSSQL 2000 will not understand
varchar(max). For reference, there is a StackOverflow question that relates
to
this:
http://stackoverflow.com/questions/737755/varcharmax-ms-sql-server-2000-problems
I am finding myself using auth.has_membership() and auth.has_permission()
quite often in a module. Are either of these cached? I looked through the
Auth code a bit and didn't see anything, so I was wondering it if did it
somewhere else. If not then I should probably write my own
has_membership/
Well, varchar(max) was introduced in SQL 2005, and it will be like that
going forward. Text will be removed in a future version of MSSQL, though
they do not mention when. Here is the actual MSDN page about the text data
type: http://msdn.microsoft.com/en-us/library/ms187993.aspx
AM, Massimo Di Pierro wrote:
> Let's create a mssql3 that does it by the book (or do you think MS
> will keep changing the API?)
>
> On Mar 2, 9:11 am, Ross Peoples wrote:
>> The only I problem I see is that MSSQL 2000 will not understand
>> varchar(max). For refere
t;'datetime': 'DATETIME',
>'id': 'INT IDENTITY PRIMARY KEY',
>'reference': 'INT, CONSTRAINT %(constraint_name)s FOREIGN KEY
> (%(field_name)s) REFERENCES %(foreign_key)s ON DELETE %
> (on_delete_action)s',
I have begun to move from models, modules, and controllers into actually
writing the view for my application. Now, I am at the point where I need to
loop through a Rows object, building a TR for each row. I wrote a version
that works by writing it in HTML, using {{=x}} where needed, but it looks
That was a very helpful example. Thank you. So using the web2py TABLE helpers
is best used for creating simple, static tables where the rows aren't
generated? I guess that's ok, I always thought that the controller was meant to
get the data, while the views format the data. But if the web2py way
Thanks Joe, I was wondering about this.
On Mar 3, 2011, at 2:44 PM, Joe Barnhart wrote:
> One thing I find handy about the helper objects is that they can be
> treated as lists:
>
> {{t=TABLE()}}
> ...
> {{t.append(TR(val11,val12,val13))
> ...
> {{t.append(TR(val21,val22,val23))
> ...
> {{=t}}
. I put most of the computational stuff in
the controller, and only a couple of things needed to be formatted for the view.
On Mar 3, 2011, at 4:07 PM, Anthony wrote:
> On Thursday, March 3, 2011 10:31:18 AM UTC-5, Ross Peoples wrote:
> I know that web2py has HTML helpers like TABLE(
Yea, for some reason I thought that 'tables[] = ' would append to the list. I'm
not sure which language that's from, but it doesn't matter now, as it is
certainly much more readable to me. Before, the view had a hacky way of
grouping the data into a table and I was confused about the meaning of
Updated to R-1.32.2 from trunk this morning. Ran into this error a few times
today: ProgrammingError: Cannot operate on a closed database. I don't know
if it's because of a bug introduced in the release or if my ajax is killing
it. I just start playing with submitting ajax forms and right after
Let's not forget about SQLFORM.factory either. This lets you create a
SQLFORM based on a virtual table that you create as an argument to
SQLFORM.factory. For example, I used this code to provide edit capabilities
when editing time clock entries for an app I'm writing. It includes form
validatio
I would read a few short tutorials on JavaScript before jumping into jQuery.
It is important to understand things like dictionaries, as nearly every
jQuery UI component requires you to pass a dictionary of arguments. Working
with jQuery is much different than working with regular JavaScript, so
Massimo created a new revision (1693) in the trunk about an hour ago that
reverts the changes to template.py temporarily until it gets fixed. Thanks.
I noticed that you use mssql2:// in there. I don't know if it will help, or
make things worse, but try just mssql:// instead of mssql2://, as that
adapter is still in development and is not yet supposed to be backwards
compatible. I have to use MSSQL2000 for an application I'm developing, and
t
I tried using DataTables a year or two ago for a project, but I ended up
needing to use jqgrid because with DataTables, you had to load all of your
table entries into the HTML at once. When you have 30 items or so, this
isn't a big deal, but I had to deal with about 10,000 records, so loading
a
I have a legacy PostgreSQL database that has its tables and field names
created using a case-sensitive means. Whenever I try to do a select(), it
returns no rows, and an insert() fails. This is the error that web2py gives:
ProgrammingError: relation "globalsettings_id_seq" does not exist
LINE 1:
ld('settingValue', 'text'),
> Field('settingID', 'id'),
> sequence_name='GlobalSettings_settingID_seq'
> )
>
> It should works...
>
> Richard
>
> On Thu, Mar 10, 2011 at 2:42 PM, Ross Peoples wrote:
>
>> I have
27;),
>Field('settingID', 'id'),
>sequence_name='GlobalSettings_settingID_seq',
>migrate=False)
>
> Case must match DB. migrate=False because it exists. I am not 100%
> sure but I think this should work.
>
> On Mar 11, 12:56 pm,
web2py cannot do this (yet). You would need to create a view for
> your tables with lowercase table names or perhaps there is some
> obscure postgresql parameters to make the queries case sensitive
> (mysql has it).
>
> On Mar 11, 2:10 pm, Ross Peoples wrote:
> > I should h
I am not aware of any way to backup the database along with the application
if you are not using SQLite, however, in appadmin, you could export your
tables to CSV files. You could probably write a backup script in web2py that
does the CSV export. Though the best way is to backup is using your da
201 - 300 of 573 matches
Mail list logo