Posted on April 10, 2008 by michaelangela
I was so happy when I first found Amara. It was the easiest thing I had seen for creating XML with Python. It’s quite serious stuff because it can probably handle just about anything you throw at it. Then I heard about the wonderful web2py project. One of it’s beautiful aspects is XML generation, or [...]
Filed under: cool, dev, education, python, tip, tool, web2py | Leave a Comment »
Posted on March 31, 2008 by michaelangela
More python/Flex goodness in the works in the future perhaps? I really like Python… learning all the time with my web2py friends. I’d love to be able to combine this with Flex. Looks like it’s getting easier and easier. Now to combine this with Orbited…
Ted On Flex: The AMF Revolution
The growth [...]
Filed under: django, education, flex, pyamf, python, web2py | Leave a Comment »
Posted on March 30, 2008 by michaelangela
As noted in this post, you need to change a line in pg_hba.conf to “trust” instead of “md5″ (no quotes) to be able to batch create tables. Note this is only for testing purposes and not recommended for production. The only reason is because I am running some benchmarks for web2py. I want to be [...]
Filed under: dev, web2py | Tagged: benchmark, postgres | Leave a Comment »
Posted on March 29, 2008 by michaelangela
I recently wrote about exporting a Django database to xml. As a courtesy, Massimo, creator of web2py, put together a great little example for web2py
exporting in XML – web2py Web Framework | Google Groups
def export_xml(rows):
idx=range(len(rows.colnames))
colnames=[item.replace('.','_') for item in rows.colnames]
records=[]
[...]
Filed under: cool, dev, education, one-liner, orm, web2py | Leave a Comment »
Posted on March 28, 2008 by michaelangela
Web2py is humming along and just got a redesigned front page. Nice, clean, and accessible. Gotta love the “complex” tutorial. Fits in a page!
web2py Enterprise Web Framework
A taste of web2py
Consider the following complete application which consists a model (which describes the data representation): db.py
1.2.
db=SQLDB(’sqlite://images.db’)db.define_table(‘image’,SQLField(‘file’,'upload’))
a controller (which describes the application logic and [...]
Filed under: cool, dev, python, web2py | Leave a Comment »
Posted on March 28, 2008 by michaelangela
Looking at this helps me understand more of what is going on internally with Django’s models. Using web2py is a bit more intuitive for getting some of this info so it’s probably not too hard to port the concept over… for a future exercise.
/home/siddhi: Export django database to an xml file
Export django database [...]
Filed under: dev, django, education, web2py | 1 Comment »
Posted on March 18, 2008 by michaelangela
A full example, albeit with SQLObject, but the concept is pretty clear. With web2py, the form.validate would be followed with an explicit data insert. From the looks of the **form_result insert, form.validate returns a list of fields that can be directly inserted. The same format should be able to be used with Storm.
Handling Form data [...]
Filed under: dev, orm, python, web2py | Leave a Comment »
Posted on March 14, 2008 by michaelangela
This little line right here solved a problem. How do you dynamically assign a function to a variable to be invoked later but you need it to have a preset value? Define it when you assign it. I just didn’t know you could do that with lambda functions. Cool! This was used to update my [...]
Filed under: dev, one-liner, python, web2py | Leave a Comment »
Posted on March 13, 2008 by michaelangela
This shell for web2py is quite cool. (You can look here for a Google tranlation of the original.) For those new to this stuff (like me), and if you’re working on something specific you can specify that in the environment. If you want to play with your model straight away, and it’s named ‘db’, you [...]
Filed under: dev, python, web2py | Leave a Comment »
Posted on March 13, 2008 by michaelangela
So I have a sample data set in a database created by web2py. After some experimentation I can access, modify and create data with Elixir/SQLAlchemy. Just some notes, like remember to encode web2py blobs with utf8 if you’re not going through web2py’s functions.
r=Recipe.query.all() r[0].instructions=u’some text to submit’.encode(‘utf8′) cb.session.flush()
And then something happend before this got pulished [...]
Filed under: dev, elixir, orm, sqlalchemy, web2py | Leave a Comment »
Posted on March 11, 2008 by michaelangela
After some experimentation, at least with the way I am working with web2py’s orm, the migrate command causes problems from an interactive shell session, i.e. within iPython.
So instead of
migrate=’some_file.table’
I have to use
migrate=’some_file.table’ if request.env else False
That’s no so bad. Previously I thought I would have to use
migrate=’some_file.table’ if __name__==’__builtin__’ else False
I didn’t like that. There [...]
Filed under: dev, python, web2py | 1 Comment »
Posted on March 10, 2008 by michaelangela
I really like using web2py. I only have one major problem with developing with it. I like code completion and other good things that come with developing in an IDE.
First off, SqlSoup for SQLAlchemy. Very cool. It’s got runtime introspection which, in plain English, means that you can experiment with the database, seeing what [...]
Filed under: dev, python, web2py | Leave a Comment »
Posted on March 10, 2008 by michaelangela
While using web2py, this is how I am working with databases now.
Make a new application called ‘init’ In init.models create an empty __init__.py file so you can import the settings. In init.models add create a settings.py file. in init.models.settings add:
DB_DEV=’dev connection string’ DB_STAGING=’staging connection string’ DB_PRODUCTION=’production connection string’
def getDBConnection(request): connect_string=None try: # [...]
Filed under: web2py | Leave a Comment »
Posted on March 8, 2008 by michaelangela
web2py is a great web development app. It’s under heavy development and the creator answers tons of questions making many updates to the core code in very short order.
In the quest for TDD, now BDD, I wanted to be able to get an interactive [...]
Filed under: behavior driven development, dev, python, test driven development, web2py | Leave a Comment »