[web2py] Re: web2pyslices migration

2011-01-21 Thread Anthony
On Friday, January 21, 2011 7:21:46 PM UTC-5, Martin.Mulone wrote: 
>
> do you like web2pycentral?. :P
>
> Our idea is to give solution to this items menu from web2py site: 
>
> - User Voice
> - Perhaps alter ego (FAQ)
>
 
If you're going to include the items from Alter Ego, note that although the 
most recent entry is #272, it appears that the most recent entry whose title 
is listed on http://www.web2py.com/AlterEgo is only #264, so make sure you 
don't miss those last few entries.
 
Also, I wonder if it would make sense to include some of the examples from 
http://web2py.com/examples/default/examples.
 
What about layout plugins? Right now we have this: http://web2py.com/layouts. 
Does it make sense to include layout plugins in the new slices site, or do 
layouts need their own special page/interface? If the latter, maybe 
http://web2py.com/layouts can still be integrated into the new site by 
including a link to it in the main navigation so we can truly achieve the 
"ONE PLACE for web2py related stuff" vision.
 
Thanks.
 
Anthony


[web2py] Interesting aspects of Lift framework

2011-01-21 Thread pbreit
Interesting aspects of Lift framework:
http://seventhings.liftweb.net/index


[web2py] Re: article on django vs web2py

2011-01-21 Thread pbreit
Better me than Massimo! :-)

[web2py] Re: article on django vs web2py

2011-01-21 Thread Anthony
On Saturday, January 22, 2011 1:10:05 AM UTC-5, pbreit wrote: 
>
> Nice writeup. I put it on Reddit.

 
Uh-oh.


[web2py] Re: article on django vs web2py

2011-01-21 Thread pbreit
Nice writeup. I put it on Reddit.

[web2py] Re: web2pyslices migration

2011-01-21 Thread pbreit
Is there any web2py-based wiki software that would work? Seems to me a 
simple wiki site with aggressive administration would be best. Check Rails 
or Django for examples. I rarely find the voting very helpful. 

[web2py] Re: step-by step instructions installing web2py on a CentOS server with cPanel installed

2011-01-21 Thread pbreit
Do you have ssh access? Perhaps try the Ubuntu setup 
script: 
http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh

Even if you don't use the script, you can look at the individual commands.

What host are you on? Does it provide any instructions for running Python or 
Django?


[web2py] Re: step-by step instructions installing web2py on a CentOS server with cPanel installed

2011-01-21 Thread stargate

I did a search for installing using cpanel and whm with no success.
Most hosting companies use cpanel or plesk. It would be nice if there
was step by step instructions on how to install web2py with mysql and
cpanel running.


On Jan 21, 4:21 pm, Kenneth Lundström 
wrote:
> Search the mailing lists archive withcpanel. There has been some
> discussion about deploying web2py withcpanel. But I can t remeber the
> outcome of it.
>
> Kenneth
>
>
>
> > I as wondering if there is step-by step instructions installing web2py
> > on a CentOS version 4.x server withcPanelinstalled.


[web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread mart
I have a question: When we say '2 forms', I immediately think 2 forms,
in the sense that both forms are used at times separately, and at
other times, combined. When I think of subforms, I think of either 1
of 2 things: 1) it wouldn't make any sense to have that form stad on
its own (it may be useful in many situations, but never alone. 2) the
subform can go both ways, on its own (requires contexte) and as a
another form's subform (avoids duplication). So, I'm trying to
understad the language used here and t see if I am possibly not doing
something correctly. my take is (and this is where I get "iffy" about
combining forms vs combining tables. It seems to me that the meat in
in the tables where the forms are just there to capture data. That
said, what is the main advantage with combining forms over combining
tables?

Is there any disadvantage to collecting related data to populate a
tables different tables, even if it includes many of those single
value tables (like table category), and building the form by
collecting pertinent tables to create the single, stands-on-its-own
form? and kind of goes to the :audit trail slice. for one particular
app (a requests app),  instead of thinking of combining forms to
create a unique request, I isolated items that could potentially be of
value in more than 1 situation. I used the "audit trail" slice's
technique to achieve this. In the end depending on how and which
tables I combine, I can create unique forms with specific use if the
combined data. I treat the forms like recipes (table noodle goes to
combined_table_spaghetti, or to combined_table_soup, etc,,, would even
go to combined_table_Arts_And_Krafts if noodles were used. If I were
missing a table glue, I would have something (a button or something)
to create a table instead of a row.

example:

table_a is common to al request (general info)
table_b can be source code specific
table_c can IMEI specific
table_d can info about the dev cert
table_e can be a a table with a single field (like yes/no thing)

table_a + table_b = build request form
table_a + table_c = IMEI number request form
table_a + table_c + table_d = dev cert request form

then all I need is to create a dev cert request form is this and throw
a form on it:
db.define_table('dev_cert_request',
 table_a,
 table_c,
 table_d,
 table_e,
  Field('have_device_already', 'boolean'))

So the question: is there and advantage to working with the forms as
opposed to working with the tables? working with tables seems more
flexible and intuitive and is a time saver (re-using existing tables),
but maybe I have the wrong approach regardless and trouble is waiting
for me at some point?

Thanks
Mart :)



On Jan 21, 4:39 pm,
Lennon  wrote:
> Oh I see.  The validation does at least seem to be working on the
> second form.  It won't let me enter values not specified in the model.
>
> If I am to use SQLFORM factory, how do I do an update/delete?
>
> Kenneth said:
>
> "As I understand the only option is to use factory, if you wan t to
> update you have to create a form with factory then fill all fields
> with
> db.t_table.f_field.value = something"
>
> But I'm not exactly sure how to fill the fields in with that method.
> Could somebody give me an example in the following context?:
>
> def test_add_user():
>     form=SQLFORM.factory(db.user,db.address)
>     if form.accepts(request.vars):
>         id = db.user.insert(**db.client._filter_fields(form.vars))
>         form.vars.client=id
>         id = db.address.insert(**db.address._filter_fields(form.vars))
>         response.flash='Thanks for filling the form'
>     return dict(form=form)
>
> On Jan 21, 4:22 pm, DenesL  wrote:
>
>
>
>
>
>
>
> > Doing form.append(SQLFORM(...)) creates invalid HTML since you can not
> > nest FORMs, but your browser is saving the day by ignoring the nested
> > form and including its fields only.
>
> > Moreover form.accepts only validates your db.user fields, and none of
> > db.address (unless they happen to be named the same).
>
> > You should be following what Bruno 
> > recommended:http://web2pyslices.com/main/slices/take_slice/102
>
> > On Jan 21, 3:48 pm, Lennon  wrote:
>
> > > I solved my problem.  Since the form.vars were passing through to the
> > > controller, I just simply did my own manual insert:
>
> > > def test_add_user():
>
> > >     form = SQLFORM(db['user'])
> > >     form.append(SQLFORM(db['address']))
>
> > >     #submit data
> > >     if form.accepts(request.vars):
>
> > >         #check whether the form had errors
> > >         if form.errors:
> > >             response.flash = 'Form has errors'
> > >             return dict(form=form)
> > >         else:
>
> > > db.address.insert(user_id=form.vars.id,address=form.vars.address)
> > >             session.flash = "User Added"
> > >             redirect(URL('admin', 'test_add_user'))
>
> > >     #return the view
> > >     return dict(form=form)
>
> > > Now

[web2py] Re: Question about DAL

2011-01-21 Thread Massimo Di Pierro
I think:

rows = db(db.thumbnails.rolic_id==db.rolic.id).select()
rows =
[{'rolic':row.rolic.as_dict(),'thumbnail':row.thumbnail.as_dict()} for
row in rows]

this may work too but I am not sure:

rows = db(db.thumbnails.rolic_id==db.rolic.id).select().as_dict()


give it a try.

Massimo

On Jan 21, 6:34 pm, LightOfMooN  wrote:
> db.define_table('rolic',
>     Field('name', 'string')
>     )
> db.define_table('thumbnails',
>     Field('rolic_id', db.rolic),
>     Field('image', 'upload')
>     )
>
> Is there a way to make SQL Query to get results like this?
>
> [{'rolic': {'id':1, 'name':'name1'}, thumbnails: [{'id':1,
> image:'...'}, {'id':2, image:'...'}]},
> {'rolic': {'id':2, 'name':'name2'}, thumbnails: [{'id':3,
> image:'...'}, {'id':4, image:'...'}, {'id':5, image:'...'}]}]
>
> thx


[web2py] Re: Twisted client/server system with web2py as frontend

2011-01-21 Thread Massimo Di Pierro
I have not used twisted but I have used tornado for html5 websockets.

web2py notifies tornado by digitally signing post requests.

The source is here http://code.google.com/p/emte-trading/

Massimo

On Jan 21, 6:08 pm, "Peter M."  wrote:
> I have made small demonstration client/server project using the
> Twisted framework (http://twistedmatrix.com/) which is just as easy to
> use for client/server projects as web2y is for for web applications
> and now I want to use web2py as frontend for a shared database.
> Twisted web component(s) is not at a state where I want to use it
> (http://twistedmatrix.com/trac/wiki/TwistedWebPlan) and I much rather
> prefer web2py.
>
> I have seen at least one person on this list saying he is using web2py
> as frontend for a "Twisted server". I would like advice on how to make
> web2py notify the "Twisted server" about changes in the database. Both
> server applications (the "Twisted server process" and web2py) are
> running on the same server. I guess I could use a table as message
> queue which the Twisted server would read every few seconds.
>
> But if wanted a here-and-now notification then how to do it most elegantly?
>
> There is a solution which works for PostgreSQLhttp://www.divillo.com/
> but I prefer a more general solution.
>
> Should I send a xml-rpc or soap request from web2py -> Twisted server?
>
> Are there other ways to communicate?
>
> Has anyone had success trying to import twisted modules into web2py?
>
> I guess an integration of Twisted and web2py would make it such a big
> killer product that it will require a license to operate it ;-)
>
> Regards
> Peter


[web2py] Re: pyQT & web2py

2011-01-21 Thread mart
@ Richard - yes, this one : http://en.wikipedia.org/wiki/Peter_Principle

@ Jason - yes. In a more traditional build & release infrastructure,
that kind of setup does make sense... However, this place isn't really
traditional, actually far from it ;)  I'd be happy to show you how
web2py is used within the automation and why it makes the most sense
(for them and their particularities).

Thanks,
Mart :)





On Jan 21, 2:05 pm, Jason Brower  wrote:
> It sounds like you could start the QT interface from web2py if you
> wanted. :P  But I think the best think would be to have two programs,
> the Interface (Web, QT, Mobile app (nokia supports qt) etc...) and then
> an application that communicates with that for the automation stuff. It
> would have an interface that would be universally accessable from a
> network. (I use amp in twisted, but you may xml or something) and your
> interfaces would read that.  You could have web2py do that serving of
> that data and that would simply things a bit.
> Best Regards,
> Jason Brower
>
> On 01/21/2011 08:58 PM, Richard V�zina wrote:
>
>
>
>
>
>
>
> > Peter's principles
>
> > I should reread it...
>
> > Richard
>
> > On Fri, Jan 21, 2011 at 1:53 PM, mart  > @gmail.com > wrote:
>
> >     Hey,
>
> >     Its in-house (mostly all python) automation framework for
> >     builds&releases, and other process specific tasks (and acts a the
> >     interface between test and releas automation). Its all up and running
> >     as it is, and is doing a great job. So, I;m doing some feature
> >     development now that the foundation is up and running. The  way I made
> >     layout the code structure means there is no separation beween blueLite
> >     (the automation) and web2py.. one can work on its own independently
> >     from the other if needed (but made to work together). I can launch
> >     web2py (the web app0 and serve applications, and those applications
> >     that act as front end to blueLite make reference to the blueLite
> >     modules s well.
>
> >     So, it came as a surprise a little while when different team had asked
> >     to use the framework, but the ask mad lit of sense to. Since the whole
> >     thing is basically "dump to ds and run", new uses are coming up. Teams
> >     use it for continues build/integration in their sandboxes, dev folks
> >     use it on there desktop or laptop, and this a support fully, because
> >     they try to match as close as possible the actual production
> >     environment, and that often starts with the tooling. Some of the folks
> >     that want to make use of it and that are not that technical, find that
> >     having to launch a webApp + browser intimidated (even though its
> >     not)... so, pyQT can quell that "fear" of os the unknown for them. its
> >     the same thing really, but... the idea of having the ability to verify
> >     dev/build data on someone's desktop is quite appealing to them. The
> >     setup os the same, but the server part becomes invisible... almost
> >     like giving someone a placebo... as long as they believe it ;)  So, s
> >     mentioned, when we will be able to dump a fully deployable web2py (as
> >     in dump and deploy, one click), things should start to get
> >     interesting :)
>
> >     so it ends up like this:
>
> >     they use a browser (that doesn't look like a browser - actually a
> >     browser that doesn't enable browsing), and they are happy... the only
> >     requirement is that they install python, which they can download
> >     internally n=on the corporate network, with a nice page with very
> >     simple instruction, to the letter (which always makes me giggle,
> >     because some are so focused on the litte detail that don;t make much
> >     of a difference ;)).
>
> >     You ever hear of the Peter principle? this is it, at its best! :)
>
> >     Mart :)
>
> >     On Jan 21, 1:23 pm, Jason Brower  >     > wrote:
> >     > What product are you making.  It really depends on the product
> >     you are
> >     > making as how you plan on making a gui that uses web2py tools.
> >     > I personally have made a web2py server that calls a wine program
> >     that
> >     > has a qt user interface and and a specially modified twisted server.
> >     > What is that, like 5 different programs?!) Each run seporatly
> >     but may
> >     > need to pull data from each other at times.  It is certainly
> >     possible,
> >     > it's one of the reasons I chose web2py, because it was written in
> >     > python, and python can do just about anything. :P
> >     > Best Regards,
> >     > Jason Brower
>
> >     > On 01/20/2011 10:08 PM, mart wrote:
>
> >     > > Hi,
>
> >     > > has anyone considered using pyQT within their apps? and if
> >     yes, any
> >     > > comments on its use?
>
> >     > > Thanks,
> >     > > Mart :)


[web2py] Question about DAL

2011-01-21 Thread LightOfMooN
db.define_table('rolic',
Field('name', 'string')
)
db.define_table('thumbnails',
Field('rolic_id', db.rolic),
Field('image', 'upload')
)

Is there a way to make SQL Query to get results like this?

[{'rolic': {'id':1, 'name':'name1'}, thumbnails: [{'id':1,
image:'...'}, {'id':2, image:'...'}]},
{'rolic': {'id':2, 'name':'name2'}, thumbnails: [{'id':3,
image:'...'}, {'id':4, image:'...'}, {'id':5, image:'...'}]}]

thx


[web2py] Re: web2pyslices migration

2011-01-21 Thread Martin.Mulone
do you like web2pycentral?. :P

Our idea is to give solution to this items menu from web2py site: 

- User Voice
- Perhaps alter ego (FAQ)
- Videos
- Web2py slices
- Free Appliance
- Plugins

But we don't want to make it too complex, because the time we can dedicated 
to this. For comments we are going to use plugin comments. The vote system, 
we are going to have vote system (to show most popular) and ratings. Also 
for applications and plugin we are going to keep trak of downloads, to show 
the most download. The main idea is to promote web2py, people and projects 
too, open source and not.


[web2py] Re: get_or_create() for Web2py?

2011-01-21 Thread dominatus
What I'm doing is allowing the user to enter their exercise routine(s)
for the day.  I could just do a crud.create() if they were just going
to enter once a day, but I am making it to where they can log in
multiple times to add more exercise routines if they so choose.  It is
tied in the the calendar.js.  I just do not want crud.create()
producing an error if they decide to log on multiple times a day.

On Jan 21, 4:24 pm, Massimo Di Pierro 
wrote:
> Something like this?
>
> form=SQLFORM(db.schedule)
> if form.accepts(request,dbio=False):
>    if db.schedule(todays_date==form.vars.todays_date):
>       form.errors['todays_date']="sorry busy that day"
>    else: db.schedule.insert(todays_date=form.vars.todays_date)
>
> It really depends on details.
>
> On Jan 21, 3:45 pm, dominatus  wrote:
>
>
>
>
>
>
>
> > If a db.schedule table exists with db.schedule.todays_date set to
> > today's date.  For example, if I, as a user, wake up today to enter my
> > daily tasks for the current day, it gives a crud.create() form to
> > insert a new db.schedule record.  If I log in at lunch to add/modify
> > activities further, it gives a crud.update() form to the same
> > db.schedule record for today's date.
>
> > On Jan 20, 9:37 pm, Massimo Di Pierro 
> > wrote:
>
> > > what is the condition to decide whether is exists or not?
>
> > > On Jan 20, 7:24 pm, dominatus  wrote:
>
> > > > I have a table in one of my models that I am trying to either create
> > > > or update based on the current date when the user logs in.  I noticed
> > > > there is no explainable way to check if a current record exists in a
> > > > model from within a controller function.  Do we have to use:
>
> > > > crud.create(db.schedule) or crud.update(db.schedule,
> > > > db.schedule((auth.user.id == db.schedule.user)) &
> > > > (db.schedule.todays_date == datetime.date.time())).select(id)
>
> > > > In Django there is simply a get_or_create() function to perform this
> > > > task.  Just wondering if this is the right way of going about it.
> > > > Thanks.


[web2py] Twisted client/server system with web2py as frontend

2011-01-21 Thread Peter M.
I have made small demonstration client/server project using the
Twisted framework (http://twistedmatrix.com/) which is just as easy to
use for client/server projects as web2y is for for web applications
and now I want to use web2py as frontend for a shared database.
Twisted web component(s) is not at a state where I want to use it
(http://twistedmatrix.com/trac/wiki/TwistedWebPlan) and I much rather
prefer web2py.

I have seen at least one person on this list saying he is using web2py
as frontend for a "Twisted server". I would like advice on how to make
web2py notify the "Twisted server" about changes in the database. Both
server applications (the "Twisted server process" and web2py) are
running on the same server. I guess I could use a table as message
queue which the Twisted server would read every few seconds.

But if wanted a here-and-now notification then how to do it most elegantly?

There is a solution which works for PostgreSQL http://www.divillo.com/
but I prefer a more general solution.

Should I send a xml-rpc or soap request from web2py -> Twisted server?

Are there other ways to communicate?

Has anyone had success trying to import twisted modules into web2py?

I guess an integration of Twisted and web2py would make it such a big
killer product that it will require a license to operate it ;-)

Regards
Peter


[web2py] Re: web2pyslices migration

2011-01-21 Thread Anthony
On Friday, January 21, 2011 5:43:19 PM UTC-5, Massimo Di Pierro wrote: 
>
> I think it is important that things be marked clearly as: 
>
> - plugin/app/recipe 
> - production/beta 
> - have a screenshot 
> - be hosted locally or remotely (github/bitbicket/whatever) 

 
And as I've mentioned, it would also be helpful to have some ways to clear 
out the clutter of outdated/obsolete slices (e.g., plugins or recipes that 
have been superceded by better alternatives or new features built into 
web2py). For starters, it should be made easy to sort/filter by 
last-modified date. Maybe also include the latest version of web2py with 
which the slice has been tested and/or used in production by someone. Also, 
maybe let administrators or even regular users flag slices as out-of-date or 
in need of updating.
 
Thanks.
 
Anthony


Re: [web2py] Re: form.vars.something = value is not working on submission

2011-01-21 Thread Kenneth Lundström
form = SQLFORM.factory(Field('description', 'string', 
requires=IS_NOT_EMPTY()),
Field('customer', 
requires=IS_IN_DB(db((db.t_customer.f_company == 
session.company)&(db.t_customer.f_internal != 
True)&(db.t_customer.f_billable == True)), 't_customer.id', 
'%(f_internal_name)s %(f_default_ho
Field('employee', 
requires=IS_IN_DB(db((db.t_customer.f_company == 
session.company)&(db.t_customer.f_internal == True)), 't_customer.id', 
'%(f_internal_name)s')),
Field('product', 
requires=IS_EMPTY_OR(IS_IN_DB(db((db.t_product.f_company == 
session.company)&(db.t_product.f_frontpage == True)&(db.t_product.f_type 
== 'product')), 't_product.id', '%(f_internal_name)s'))),
Field('hour', 
requires=IS_EMPTY_OR(IS_IN_DB(db((db.t_product.f_company == 
session.company)&(db.t_product.f_type == 'hour')), 't_product.id', 
'%(f_internal_name)s'))),
Field('value', 'double', default = 1, 
requires=IS_NOT_EMPTY()),)


form.vars.employee = session.worker

if form.accepts(request.vars, session):

adding_hour = 0
adding_product = 0

for var in form.vars:

if (var == 'product')&(form.vars[var] != None):
adding_product = 1
response.flash=T('Product added')
if (var == 'hour')&(form.vars[var] != None):
adding_hour = 1
response.flash=T('Hours added')

if adding_hour & adding_product:
response.flash = T('Choose either a product or hour')
redirect(URL('default', 'index'))

if adding_product:
product_id = form.vars.product
elif adding_hour:
product_id = form.vars.hour
else:
response.flash = T('Choose either a product or hour')
redirect(URL('default', 'index'))

new = db.t_sold_products.insert(**{
'f_name': form.vars.description,
'f_amount': form.vars.value,
'f_customer': form.vars.customer,
'f_worker': form.vars.employee,
'f_product': product_id,
})
redirect(URL('default', 'index'))

elif form.errors:
response.flash="form error"

return dict(form = form)


The view:
{{extend 'layout.html'}}



News:

TODO
Issues:





{{=form.custom.begin}}

{{=T(form.custom.label.description)}}{{=form.custom.widget.description}}
{{=T(form.custom.label.customer)}}{{=form.custom.widget.customer}}
{{=T(form.custom.label.employee)}}{{=form.custom.widget.employee}}
{{=T(form.custom.label.hour)}}{{=form.custom.widget.hour}}
{{=T('Choose either product or hour')}}
{{=T(form.custom.label.product)}}{{=form.custom.widget.product}}
{{=T(form.custom.label.value)}}{{=form.custom.widget.value}}
{{=form.custom.submit}}

{{=form.custom.end}}




Kenneth


we need to see the code to be able to answer.

On Jan 21, 4:07 pm, Kenneth Lundström
wrote:

I have a form created with factory.

After creation I define form.vars.employee = session.worker

This value is the default when viewing the form. I submit the form and
in if form.accepts I have a redirect to the same page. I want to have a
new empty form with this one fields predefined, but it s empty. Only if
I reload the page the field is occupied. Why is this happening?

Should not a redirect reload the whole page?

Kenneth




[web2py] Re: web2pyslices migration

2011-01-21 Thread Massimo Di Pierro
I think it is important that things be marked clearly as:

- plugin/app/recipe
- production/beta
- have a screenshot
- be hosted locally or remotely (github/bitbicket/whatever)


On Jan 21, 12:18 pm, Bruno Rocha  wrote:
> 2011/1/21 contatogilson...@gmail.com 
>
> > What do you think of having a wiki on the framework and its libraries in
> > web2pyslices?
>
> I don't know if a wiki is needed, in web2pyslices we are planning to have a
> follow system, so people will be able to follow slices, and people will be
> able to fork slices, Slices can be anything (it is like a post), but it is a
> post specifically categorized and with exclusive features for each category.
>
> We can add the functionality to make a slice public, so anyone can edit a
> slice (option-able by the creator of the slice)
>
> Slices will be connected itself with other slices (slices follows slices),
> so we finish having a tree of related stuff.
>
> Imagine the workflow:
>
> Enter web2pyslices
> Search keyword 'form'
> results shows :
> 5 last people who recently have 'form' on his actions
> 5 latest recipes/tutorials tagged and with 'form' on content
> 5 lates plugins related to form
> 5 latest slices that follows any other slice related to 'form'
> plus:
> 5 results from web2py source with the 'form' keyword'
> 5 latest google groups threads related to form
> and so...
>
> The idea is ONE PLACE for web2py related stuff.


Re: [web2py] Re: web2pyslices migration

2011-01-21 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I'm pretty interested in the unifying view of this project and also the
idea of forking or public editing of certain slices. Seems a lot like
other idea I proposed, not only oriented to developers, but I lack the
expertise of the people who is behind this new version of Web2pyslices
and I would like to learn from them and contribute when I have more
knowledge. Will be this project free software (as in freedom)?

Cheers,

Offray

El 21/01/11 13:18, Bruno Rocha escribió:
> 2011/1/21 contatogilson...@gmail.com 
> 
>> What do you think of having a wiki on the framework and its libraries in
>> web2pyslices?
> 
> 
> I don't know if a wiki is needed, in web2pyslices we are planning to have a
> follow system, so people will be able to follow slices, and people will be
> able to fork slices, Slices can be anything (it is like a post), but it is a
> post specifically categorized and with exclusive features for each category.
> 
> We can add the functionality to make a slice public, so anyone can edit a
> slice (option-able by the creator of the slice)
> 
> Slices will be connected itself with other slices (slices follows slices),
> so we finish having a tree of related stuff.
> 
> Imagine the workflow:
> 
> Enter web2pyslices
> Search keyword 'form'
> results shows :
> 5 last people who recently have 'form' on his actions
> 5 latest recipes/tutorials tagged and with 'form' on content
> 5 lates plugins related to form
> 5 latest slices that follows any other slice related to 'form'
> plus:
> 5 results from web2py source with the 'form' keyword'
> 5 latest google groups threads related to form
> and so...
> 
> The idea is ONE PLACE for web2py related stuff.
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNOgpCAAoJEGiex2828ICw3D8H/iZVnYKRbhycNOWAFFjoeewV
rmXN/XuhIJg62qqjAeXvT4fcKvNtpewHjjE+v6A+5+y9zcjwLPEm3M0TGpHjUvUH
CQylt3o4d8vAw73U69RcOqt3ebAmrxwzGo4svFt5auLrZPjhe8LkWl9jqsIOV3e/
bm91AIFMD0K8O9wk3q3OKeuWd4I4g0YnmIl6i99ynYo3QnBHHLop5xjyhK8E6MJv
mUyJ3tSYEg3jJdznKMBfpUFoCApvMNAcY1ataTqHf3JLSPTtZGx8PD0ovcjIiE0c
KNHcp8G9hdqQmOFGu9O+mvAIyQRdHRqXYNsgoL1tgdKFHJgebo4MHCjReH3Y7q0=
=CxtY
-END PGP SIGNATURE-


[web2py] Re: driver string regex issues

2011-01-21 Thread Massimo Di Pierro
The proper way to handle this is the following:

from urllib import quote, unquote

db = DAL('mssql://%s:%s@hostname:password/db' %
(quote(username),quote(password)),credential_decoder=unquote)

On Jan 21, 3:45 pm, Loren McGinnis  wrote:
> I recently tried connecting to an mssql legacy database, and was
> getting errors upon trying to connect.
>
> I found out the problem, which was very specific to my case:  I had an
> "@" in my password.  The regex currently used to parse the driver
> string is:
>
> '^(?P[^:@]+)(\:(?P[^@]*))?@(?P[^\:/]+)(\:(?
> P[0-9]+))?/(?P[^\?]+)(\?(?P.*))?$'
>
> This truncated the password before the "@" and appended the rest onto
> the hostname.  I fixed it with this change, allowing the password to
> be any characters:
>
> '^(?P[^:@]+)(\:(?P.*))?@(?P[^\:/]+)(\:(?
> P[0-9]+))?/(?P[^\?]+)(\?(?P.*))?$'
>
> It successfully parsed the string and connected after the change.  Of
> course, there would still be an issue if "@" showed up later in the
> connection string (would this ever happen?), since I'm depending upon
> a greedy qualifier to grab the whole password.


[web2py] Re: form.vars.something = value is not working on submission

2011-01-21 Thread Massimo Di Pierro
we need to see the code to be able to answer.

On Jan 21, 4:07 pm, Kenneth Lundström 
wrote:
> I have a form created with factory.
>
> After creation I define form.vars.employee = session.worker
>
> This value is the default when viewing the form. I submit the form and
> in if form.accepts I have a redirect to the same page. I want to have a
> new empty form with this one fields predefined, but it s empty. Only if
> I reload the page the field is occupied. Why is this happening?
>
> Should not a redirect reload the whole page?
>
> Kenneth


[web2py] driver string regex issues

2011-01-21 Thread Loren McGinnis
I recently tried connecting to an mssql legacy database, and was
getting errors upon trying to connect.

I found out the problem, which was very specific to my case:  I had an
"@" in my password.  The regex currently used to parse the driver
string is:

'^(?P[^:@]+)(\:(?P[^@]*))?@(?P[^\:/]+)(\:(?
P[0-9]+))?/(?P[^\?]+)(\?(?P.*))?$'

This truncated the password before the "@" and appended the rest onto
the hostname.  I fixed it with this change, allowing the password to
be any characters:

'^(?P[^:@]+)(\:(?P.*))?@(?P[^\:/]+)(\:(?
P[0-9]+))?/(?P[^\?]+)(\?(?P.*))?$'

It successfully parsed the string and connected after the change.  Of
course, there would still be an issue if "@" showed up later in the
connection string (would this ever happen?), since I'm depending upon
a greedy qualifier to grab the whole password.


[web2py] Re: get_or_create() for Web2py?

2011-01-21 Thread Massimo Di Pierro
Something like this?

form=SQLFORM(db.schedule)
if form.accepts(request,dbio=False):
   if db.schedule(todays_date==form.vars.todays_date):
  form.errors['todays_date']="sorry busy that day"
   else: db.schedule.insert(todays_date=form.vars.todays_date)

It really depends on details.

On Jan 21, 3:45 pm, dominatus  wrote:
> If a db.schedule table exists with db.schedule.todays_date set to
> today's date.  For example, if I, as a user, wake up today to enter my
> daily tasks for the current day, it gives a crud.create() form to
> insert a new db.schedule record.  If I log in at lunch to add/modify
> activities further, it gives a crud.update() form to the same
> db.schedule record for today's date.
>
> On Jan 20, 9:37 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > what is the condition to decide whether is exists or not?
>
> > On Jan 20, 7:24 pm, dominatus  wrote:
>
> > > I have a table in one of my models that I am trying to either create
> > > or update based on the current date when the user logs in.  I noticed
> > > there is no explainable way to check if a current record exists in a
> > > model from within a controller function.  Do we have to use:
>
> > > crud.create(db.schedule) or crud.update(db.schedule,
> > > db.schedule((auth.user.id == db.schedule.user)) &
> > > (db.schedule.todays_date == datetime.date.time())).select(id)
>
> > > In Django there is simply a get_or_create() function to perform this
> > > task.  Just wondering if this is the right way of going about it.
> > > Thanks.


[web2py] Re: How do I do the following select with DAL?

2011-01-21 Thread Massimo Di Pierro
db(~db.tags.code.belongs(db(db.tags.id==db.items.of_tag)._select(db.tags.code))).select(db.tags.code)

not the _ in the inner _select.

On Jan 21, 8:54 am, vortex  wrote:
> SELECT code FROM tags WHERE code NOT IN (SELECT code FROM tags JOIN
> items ON tags.id=items.of_tag);


Re: [web2py] Re: SQLFORM not working on GAE

2011-01-21 Thread howesc
do you mind trying web2py trunk?  there where several issues with the DAL 
and GAE in the last version that are fixed in trunk.  I did not see this 
particular issue in my testing on GAE yet though, so it might not be 
related.

thanks,

cfh


[web2py] form.vars.something = value is not working on submission

2011-01-21 Thread Kenneth Lundström

I have a form created with factory.

After creation I define form.vars.employee = session.worker

This value is the default when viewing the form. I submit the form and 
in if form.accepts I have a redirect to the same page. I want to have a 
new empty form with this one fields predefined, but it´s empty. Only if 
I reload the page the field is occupied. Why is this happening?


Should not a redirect reload the whole page?


Kenneth



[web2py] Re: What am I doing wrong

2011-01-21 Thread Anthony
Yes, for more details, see 
here[1] 
and here [2].
 
[1] http://docs.python.org/tutorial/floatingpoint.html
[2] http://docs.python.org/library/decimal.html

On Friday, January 21, 2011 4:43:52 PM UTC-5, DenesL wrote:

>
> Nothing wrong, it is a decimal to binary conversion error. 
> To get accurate results you have to use Decimal type. 
>
> from decimal import * 
> test1 = Decimal('250.90') 
> ... 
>
>
> On Jan 21, 4:32 pm, Kenneth Lundström  
> wrote: 
> >  test1 = 250.90 
> >  test2 = 47.90 
> >  test3 = 99.90 
> > 
> >  test4 = test1 + test2 + test3 
> > 
> >  test5 = 398.70 
> > 
> >  test6 = test5 - test4 
> > 
> >  return test6 
> > 
> > This returns -5.68434188608e-14 not 0 as you would expect, or? 
> > 
> > Kenneth



[web2py] Re: get_or_create() for Web2py?

2011-01-21 Thread dominatus
If a db.schedule table exists with db.schedule.todays_date set to
today's date.  For example, if I, as a user, wake up today to enter my
daily tasks for the current day, it gives a crud.create() form to
insert a new db.schedule record.  If I log in at lunch to add/modify
activities further, it gives a crud.update() form to the same
db.schedule record for today's date.

On Jan 20, 9:37 pm, Massimo Di Pierro 
wrote:
> what is the condition to decide whether is exists or not?
>
> On Jan 20, 7:24 pm, dominatus  wrote:
>
>
>
>
>
>
>
> > I have a table in one of my models that I am trying to either create
> > or update based on the current date when the user logs in.  I noticed
> > there is no explainable way to check if a current record exists in a
> > model from within a controller function.  Do we have to use:
>
> > crud.create(db.schedule) or crud.update(db.schedule,
> > db.schedule((auth.user.id == db.schedule.user)) &
> > (db.schedule.todays_date == datetime.date.time())).select(id)
>
> > In Django there is simply a get_or_create() function to perform this
> > task.  Just wondering if this is the right way of going about it.
> > Thanks.


[web2py] Re: What am I doing wrong

2011-01-21 Thread DenesL

Nothing wrong, it is a decimal to binary conversion error.
To get accurate results you have to use Decimal type.

from decimal import *
test1 = Decimal('250.90')
...


On Jan 21, 4:32 pm, Kenneth Lundström 
wrote:
>      test1 = 250.90
>      test2 = 47.90
>      test3 = 99.90
>
>      test4 = test1 + test2 + test3
>
>      test5 = 398.70
>
>      test6 = test5 - test4
>
>      return test6
>
> This returns -5.68434188608e-14 not 0 as you would expect, or?
>
> Kenneth


[web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread Lennon
Oh I see.  The validation does at least seem to be working on the
second form.  It won't let me enter values not specified in the model.

If I am to use SQLFORM factory, how do I do an update/delete?

Kenneth said:

"As I understand the only option is to use factory, if you wan t to
update you have to create a form with factory then fill all fields
with
db.t_table.f_field.value = something"

But I'm not exactly sure how to fill the fields in with that method.
Could somebody give me an example in the following context?:

def test_add_user():
form=SQLFORM.factory(db.user,db.address)
if form.accepts(request.vars):
id = db.user.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)



On Jan 21, 4:22 pm, DenesL  wrote:
> Doing form.append(SQLFORM(...)) creates invalid HTML since you can not
> nest FORMs, but your browser is saving the day by ignoring the nested
> form and including its fields only.
>
> Moreover form.accepts only validates your db.user fields, and none of
> db.address (unless they happen to be named the same).
>
> You should be following what Bruno 
> recommended:http://web2pyslices.com/main/slices/take_slice/102
>
> On Jan 21, 3:48 pm, Lennon  wrote:
>
> > I solved my problem.  Since the form.vars were passing through to the
> > controller, I just simply did my own manual insert:
>
> > def test_add_user():
>
> >     form = SQLFORM(db['user'])
> >     form.append(SQLFORM(db['address']))
>
> >     #submit data
> >     if form.accepts(request.vars):
>
> >         #check whether the form had errors
> >         if form.errors:
> >             response.flash = 'Form has errors'
> >             return dict(form=form)
> >         else:
>
> > db.address.insert(user_id=form.vars.id,address=form.vars.address)
> >             session.flash = "User Added"
> >             redirect(URL('admin', 'test_add_user'))
>
> >     #return the view
> >     return dict(form=form)
>
> > Now all I have to do is remove the first submit button.
>
> > On Jan 21, 2:30 pm, Lennon  wrote:
>
> > > I have two reasons for not wanting to use SQLFORM factory.  First, I
> > > can't figure out or find how to use SQLFORM factory as an update/
> > > delete form when combining multiple table (although I'd love to see
> > > how if it can be done).  Second, I will be wanting to do some really
> > > complicated forms in the future and would like to understand how to
> > > combine SQLforms.
>
> > > With the insert form code listed below, I've been able to combine the
> > > two forms on one page.  They both render (with two submit buttons) and
> > > the form validation works for both of them regardless of which submit
> > > button I hit (which made me think I had successfully combined them).
>
> > > But when the form accepts the data, it only does an insert on the
> > > original form and doesn't work on the appended form.
>
> > > When I run in debug mode I see that FORM.vars correctly has captured
> > > all of the values for both forms.  But FORM.table and FORM.fields both
> > > only have the values for the first SQLFORM.
>
> > > Thanks for any help you can give me.
>
> > > def test_add_user():
>
> > >     form = SQLFORM(db['user'])
> > >     form.insert(len(form),SQLFORM(db['address']))
>
> > >     #submit data
> > >     if form.accepts(request.vars):
>
> > >         #check whether the form had errors
> > >         if form.errors:
> > >             response.flash = 'Form has errors'
> > >             return dict(form=form)
> > >         else:
>
> > >             session.flash = "User Added"
> > >             redirect(URL('admin', 'test_add_user'))
>
> > >     #return the view
> > >     return dict(form=form)
>
>


[web2py] What am I doing wrong

2011-01-21 Thread Kenneth Lundström

test1 = 250.90
test2 = 47.90
test3 = 99.90

test4 = test1 + test2 + test3

test5 = 398.70

test6 = test5 - test4

return test6

This returns -5.68434188608e-14 not 0 as you would expect, or?


Kenneth



[web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread DenesL

Doing form.append(SQLFORM(...)) creates invalid HTML since you can not
nest FORMs, but your browser is saving the day by ignoring the nested
form and including its fields only.

Moreover form.accepts only validates your db.user fields, and none of
db.address (unless they happen to be named the same).

You should be following what Bruno recommended:
http://web2pyslices.com/main/slices/take_slice/102


On Jan 21, 3:48 pm, Lennon  wrote:
> I solved my problem.  Since the form.vars were passing through to the
> controller, I just simply did my own manual insert:
>
> def test_add_user():
>
>     form = SQLFORM(db['user'])
>     form.append(SQLFORM(db['address']))
>
>     #submit data
>     if form.accepts(request.vars):
>
>         #check whether the form had errors
>         if form.errors:
>             response.flash = 'Form has errors'
>             return dict(form=form)
>         else:
>
> db.address.insert(user_id=form.vars.id,address=form.vars.address)
>             session.flash = "User Added"
>             redirect(URL('admin', 'test_add_user'))
>
>     #return the view
>     return dict(form=form)
>
> Now all I have to do is remove the first submit button.
>
> On Jan 21, 2:30 pm, Lennon  wrote:
>
> > I have two reasons for not wanting to use SQLFORM factory.  First, I
> > can't figure out or find how to use SQLFORM factory as an update/
> > delete form when combining multiple table (although I'd love to see
> > how if it can be done).  Second, I will be wanting to do some really
> > complicated forms in the future and would like to understand how to
> > combine SQLforms.
>
> > With the insert form code listed below, I've been able to combine the
> > two forms on one page.  They both render (with two submit buttons) and
> > the form validation works for both of them regardless of which submit
> > button I hit (which made me think I had successfully combined them).
>
> > But when the form accepts the data, it only does an insert on the
> > original form and doesn't work on the appended form.
>
> > When I run in debug mode I see that FORM.vars correctly has captured
> > all of the values for both forms.  But FORM.table and FORM.fields both
> > only have the values for the first SQLFORM.
>
> > Thanks for any help you can give me.
>
> > def test_add_user():
>
> >     form = SQLFORM(db['user'])
> >     form.insert(len(form),SQLFORM(db['address']))
>
> >     #submit data
> >     if form.accepts(request.vars):
>
> >         #check whether the form had errors
> >         if form.errors:
> >             response.flash = 'Form has errors'
> >             return dict(form=form)
> >         else:
>
> >             session.flash = "User Added"
> >             redirect(URL('admin', 'test_add_user'))
>
> >     #return the view
> >     return dict(form=form)
>
>


Re: [web2py] step-by step instructions installing web2py on a CentOS server with cPanel installed

2011-01-21 Thread Kenneth Lundström
Search the mailing lists archive with cpanel. There has been some 
discussion about deploying web2py with cpanel. But I can´t remeber the 
outcome of it.



Kenneth


I as wondering if there is step-by step instructions installing web2py
on a CentOS version 4.x server with cPanel installed.




[web2py] step-by step instructions installing web2py on a CentOS server with cPanel installed

2011-01-21 Thread stargate
I as wondering if there is step-by step instructions installing web2py
on a CentOS version 4.x server with cPanel installed.


Re: [web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread Richard Vézina
I also made this that is not pretty clean actually...

See this post :
http://groups.google.com/group/web2py/browse_frm/thread/50af0d67554c94d9/fffbdff01ac804d2?tvc=1#fffbdff01ac804d2

Richard

On Fri, Jan 21, 2011 at 4:05 PM, Richard Vézina  wrote:

> There is a jQuery recipe about that look at the recipe section of the book.
>
> Richard
>
>
> On Fri, Jan 21, 2011 at 3:48 PM, Lennon  wrote:
>
>> I solved my problem.  Since the form.vars were passing through to the
>> controller, I just simply did my own manual insert:
>>
>> def test_add_user():
>>
>>form = SQLFORM(db['user'])
>> form.append(SQLFORM(db['address']))
>>
>>#submit data
>>if form.accepts(request.vars):
>>
>>#check whether the form had errors
>>if form.errors:
>>response.flash = 'Form has errors'
>>return dict(form=form)
>>else:
>>
>> db.address.insert(user_id=form.vars.id,address=form.vars.address)
>> session.flash = "User Added"
>>redirect(URL('admin', 'test_add_user'))
>>
>>#return the view
>>return dict(form=form)
>>
>> Now all I have to do is remove the first submit button.
>>
>> On Jan 21, 2:30 pm, Lennon  wrote:
>> > I have two reasons for not wanting to use SQLFORM factory.  First, I
>> > can't figure out or find how to use SQLFORM factory as an update/
>> > delete form when combining multiple table (although I'd love to see
>> > how if it can be done).  Second, I will be wanting to do some really
>> > complicated forms in the future and would like to understand how to
>> > combine SQLforms.
>> >
>> > With the insert form code listed below, I've been able to combine the
>> > two forms on one page.  They both render (with two submit buttons) and
>> > the form validation works for both of them regardless of which submit
>> > button I hit (which made me think I had successfully combined them).
>> >
>> > But when the form accepts the data, it only does an insert on the
>> > original form and doesn't work on the appended form.
>> >
>> > When I run in debug mode I see that FORM.vars correctly has captured
>> > all of the values for both forms.  But FORM.table and FORM.fields both
>> > only have the values for the first SQLFORM.
>> >
>> > Thanks for any help you can give me.
>> >
>> > def test_add_user():
>> >
>> > form = SQLFORM(db['user'])
>> > form.insert(len(form),SQLFORM(db['address']))
>> >
>> > #submit data
>> > if form.accepts(request.vars):
>> >
>> > #check whether the form had errors
>> > if form.errors:
>> > response.flash = 'Form has errors'
>> > return dict(form=form)
>> > else:
>> >
>> > session.flash = "User Added"
>> > redirect(URL('admin', 'test_add_user'))
>> >
>> > #return the view
>> > return dict(form=form)
>>
>
>


Re: [web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread Richard Vézina
There is a jQuery recipe about that look at the recipe section of the book.

Richard

On Fri, Jan 21, 2011 at 3:48 PM, Lennon  wrote:

> I solved my problem.  Since the form.vars were passing through to the
> controller, I just simply did my own manual insert:
>
> def test_add_user():
>
>form = SQLFORM(db['user'])
> form.append(SQLFORM(db['address']))
>
>#submit data
>if form.accepts(request.vars):
>
>#check whether the form had errors
>if form.errors:
>response.flash = 'Form has errors'
>return dict(form=form)
>else:
>
> db.address.insert(user_id=form.vars.id,address=form.vars.address)
> session.flash = "User Added"
>redirect(URL('admin', 'test_add_user'))
>
>#return the view
>return dict(form=form)
>
> Now all I have to do is remove the first submit button.
>
> On Jan 21, 2:30 pm, Lennon  wrote:
> > I have two reasons for not wanting to use SQLFORM factory.  First, I
> > can't figure out or find how to use SQLFORM factory as an update/
> > delete form when combining multiple table (although I'd love to see
> > how if it can be done).  Second, I will be wanting to do some really
> > complicated forms in the future and would like to understand how to
> > combine SQLforms.
> >
> > With the insert form code listed below, I've been able to combine the
> > two forms on one page.  They both render (with two submit buttons) and
> > the form validation works for both of them regardless of which submit
> > button I hit (which made me think I had successfully combined them).
> >
> > But when the form accepts the data, it only does an insert on the
> > original form and doesn't work on the appended form.
> >
> > When I run in debug mode I see that FORM.vars correctly has captured
> > all of the values for both forms.  But FORM.table and FORM.fields both
> > only have the values for the first SQLFORM.
> >
> > Thanks for any help you can give me.
> >
> > def test_add_user():
> >
> > form = SQLFORM(db['user'])
> > form.insert(len(form),SQLFORM(db['address']))
> >
> > #submit data
> > if form.accepts(request.vars):
> >
> > #check whether the form had errors
> > if form.errors:
> > response.flash = 'Form has errors'
> > return dict(form=form)
> > else:
> >
> > session.flash = "User Added"
> > redirect(URL('admin', 'test_add_user'))
> >
> > #return the view
> > return dict(form=form)
>


[web2py] Re: Installation on GoDaddy shared server

2011-01-21 Thread blackthorne
unless you or anyone are interested in sharing an account with me...
blackthorne at ironik .org

On Jan 21, 8:23 pm, blackthorne  wrote:
> watch out becausa you don't have ssh access on godaddy. if possible it
> may be difficult.
>
> If you find a cheaper hoster for python than Webfaction, please tell
> me. have to say that I love webfaction as a service, i just want to
> save some money...
>
> best regards
>
> On Jan 21, 7:56 pm, stargate  wrote:
>
> > Thanks for the help...
>
> > On Jan 21, 2:35 pm, Kenneth Lundström 
> > wrote:
>
> > > Simplest way ishttp://web2py.com/book/default/chapter/03
>
> > >  > How do I install web2py on a GoDaddy shared server.
>
> > > No idea about GoDaddy but,
>
> > >  > Also what are the steps to install it on a regular linux server.
>
> > > It depends on alot of things, what linux, what is installed on it and so
> > > on.www.web2pyslices.comhaspagesfor different linux distros, for example:
>
> > >http://web2pyslices.com/main/slices/take_slice/110(Web2py+uWSGI +
> > > Cherokee on Ubuntu 
> > > 10.04)http://web2pyslices.com/main/slices/take_slice/98(Deployweb2pyon
> > > Fedora/CentOS/Red Hat)
>
> > > Hopefully this helps, The book athttp://web2py.com/book/isvery, very
> > > good. I recommend searching it, the Slices and mailing list archive
> > > (https://groups.google.com/group/web2py) first, if you can t anything
> > > helping forward ask on the list. You ll usually get a very fast reply.
>
> > > Kenneth
>
>


[web2py] article on django vs web2py

2011-01-21 Thread Massimo Di Pierro
http://greg.thehellings.com/2011/01/python-web2py-or-django/


[web2py] Re: Combining Forms without SQLFORM Factory

2011-01-21 Thread Lennon
I solved my problem.  Since the form.vars were passing through to the
controller, I just simply did my own manual insert:

def test_add_user():

form = SQLFORM(db['user'])
form.append(SQLFORM(db['address']))

#submit data
if form.accepts(request.vars):

#check whether the form had errors
if form.errors:
response.flash = 'Form has errors'
return dict(form=form)
else:
 
db.address.insert(user_id=form.vars.id,address=form.vars.address)
session.flash = "User Added"
redirect(URL('admin', 'test_add_user'))

#return the view
return dict(form=form)

Now all I have to do is remove the first submit button.

On Jan 21, 2:30 pm, Lennon  wrote:
> I have two reasons for not wanting to use SQLFORM factory.  First, I
> can't figure out or find how to use SQLFORM factory as an update/
> delete form when combining multiple table (although I'd love to see
> how if it can be done).  Second, I will be wanting to do some really
> complicated forms in the future and would like to understand how to
> combine SQLforms.
>
> With the insert form code listed below, I've been able to combine the
> two forms on one page.  They both render (with two submit buttons) and
> the form validation works for both of them regardless of which submit
> button I hit (which made me think I had successfully combined them).
>
> But when the form accepts the data, it only does an insert on the
> original form and doesn't work on the appended form.
>
> When I run in debug mode I see that FORM.vars correctly has captured
> all of the values for both forms.  But FORM.table and FORM.fields both
> only have the values for the first SQLFORM.
>
> Thanks for any help you can give me.
>
> def test_add_user():
>
>     form = SQLFORM(db['user'])
>     form.insert(len(form),SQLFORM(db['address']))
>
>     #submit data
>     if form.accepts(request.vars):
>
>         #check whether the form had errors
>         if form.errors:
>             response.flash = 'Form has errors'
>             return dict(form=form)
>         else:
>
>             session.flash = "User Added"
>             redirect(URL('admin', 'test_add_user'))
>
>     #return the view
>     return dict(form=form)


Re: [web2py] Website

2011-01-21 Thread Bruno Rocha
You can download any of the web2py layouts -> http://web2py.com/layouts
analyse and understand how the layouts were
created, and create your own layout plugin.

Then you will be able to include that for any web2py app you want.

I always work with layouts as plugins.

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/21 stargate 

> Lets say i have created a static page using XHTML and css.  How do I
> integrate it into web2py.  Basically i am toying to learn a new
> language coming from a PHP background.
>
> I can't find  a getting started with web2py like integrating a
> existing design and apply server side web2py database elements to it.
>
>


[web2py] Re: Website

2011-01-21 Thread b00m_chef
Integrating web2py into existing designs is where web2py really
shines.

You need to research SQLFORM, SQLFORMFACTORY, SQLFORM.element (for
CSS), and DAL. If you read about those things, you will be able to do
a lot.



On Jan 21, 7:17 am, VP  wrote:
> I'd do this:
>
> 1. create a new app called my_first_app, through the admin interface.
>
> 2. modify controller/default.py: replace index function with, def
> index(): return dict()
>
> 3. replace view/default/index.html with your static file.
>
> 4. place your css file in static/, and modify index.html to  point to
> it.
>
> On Jan 21, 8:30 am, stargate  wrote:
>
>
>
>
>
>
>
> > Lets say i have created a static page using XHTML and css.  How do I
> > integrate it into web2py.  Basically i am toying to learn a new
> > language coming from a PHP background.
>
> > I can't find  a getting started with web2py like integrating a
> > existing design and apply server side web2py database elements to it.


Re: [web2py] Combining Forms without SQLFORM Factory

2011-01-21 Thread Bruno Rocha
for referenced tables you can use this:
http://web2pyslices.com/main/slices/take_slice/102

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/21 Lennon 

> I have two reasons for not wanting to use SQLFORM factory.  First, I
> can't figure out or find how to use SQLFORM factory as an update/
> delete form when combining multiple table (although I'd love to see
> how if it can be done).  Second, I will be wanting to do some really
> complicated forms in the future and would like to understand how to
> combine SQLforms.
>
> With the insert form code listed below, I've been able to combine the
> two forms on one page.  They both render (with two submit buttons) and
> the form validation works for both of them regardless of which submit
> button I hit (which made me think I had successfully combined them).
>
> But when the form accepts the data, it only does an insert on the
> original form and doesn't work on the appended form.
>
> When I run in debug mode I see that FORM.vars correctly has captured
> all of the values for both forms.  But FORM.table and FORM.fields both
> only have the values for the first SQLFORM.
>
> Thanks for any help you can give me.
>
> def test_add_user():
>
>form = SQLFORM(db['user'])
>form.insert(len(form),SQLFORM(db['address']))
>
>#submit data
>if form.accepts(request.vars):
>
>#check whether the form had errors
>if form.errors:
>response.flash = 'Form has errors'
>return dict(form=form)
>else:
>
>session.flash = "User Added"
>redirect(URL('admin', 'test_add_user'))
>
>#return the view
>return dict(form=form)


Re: [web2py] Web2py + jquery UI Accordion

2011-01-21 Thread Bruno Rocha
In controller

def mypage():
people = db(db.people.id>0).select()
return dict(people=people)


In view



{{ for person in people: }}
{{=person.name}}
{{=person.comments}}
{{ pass }}


Include JqueryUI in the view.

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/21 Ialejandro 

> Hi there! I'm new to web2py, It is just... awesome!
>
> Well this is my question, I'd like to know how could I use the jquery
> UI accordion with web2py and fill it from a db.
>
> For example I have the model,
>
> db.define_table('people',
> Field('name','string')
> Field('comments','text'))
>
> And i like to have the accordion title = people.name
> and the accordion body = people.comments
>
> Thanks!
>


[web2py] Re: Installation on GoDaddy shared server

2011-01-21 Thread blackthorne
watch out becausa you don't have ssh access on godaddy. if possible it
may be difficult.

If you find a cheaper hoster for python than Webfaction, please tell
me. have to say that I love webfaction as a service, i just want to
save some money...

best regards

On Jan 21, 7:56 pm, stargate  wrote:
> Thanks for the help...
>
> On Jan 21, 2:35 pm, Kenneth Lundström 
> wrote:
>
> > Simplest way ishttp://web2py.com/book/default/chapter/03
>
> >  > How do I install web2py on a GoDaddy shared server.
>
> > No idea about GoDaddy but,
>
> >  > Also what are the steps to install it on a regular linux server.
>
> > It depends on alot of things, what linux, what is installed on it and so
> > on.www.web2pyslices.comhaspages for different linux distros, for example:
>
> >http://web2pyslices.com/main/slices/take_slice/110(Web2py+ uWSGI +
> > Cherokee on Ubuntu 
> > 10.04)http://web2pyslices.com/main/slices/take_slice/98(Deployweb2py on
> > Fedora/CentOS/Red Hat)
>
> > Hopefully this helps, The book athttp://web2py.com/book/isvery, very
> > good. I recommend searching it, the Slices and mailing list archive
> > (https://groups.google.com/group/web2py) first, if you can t anything
> > helping forward ask on the list. You ll usually get a very fast reply.
>
> > Kenneth
>
>


Re: [web2py] Combining Forms without SQLFORM Factory

2011-01-21 Thread Kenneth Lundström

Hello Lennon,

you mentioned the you have two submit buttons, too me it sounds like you 
have to forms on one page, not a combined form.


As I understand the only option is to use factory, if you wan´t to 
update you have to create a form with factory then fill all fields with 
db.t_table.f_field.value = something


Hopefully Massimo or somebody has an better answer.


Kenneth


I have two reasons for not wanting to use SQLFORM factory.  First, I
can't figure out or find how to use SQLFORM factory as an update/
delete form when combining multiple table (although I'd love to see
how if it can be done).  Second, I will be wanting to do some really
complicated forms in the future and would like to understand how to
combine SQLforms.

With the insert form code listed below, I've been able to combine the
two forms on one page.  They both render (with two submit buttons) and
the form validation works for both of them regardless of which submit
button I hit (which made me think I had successfully combined them).

But when the form accepts the data, it only does an insert on the
original form and doesn't work on the appended form.

When I run in debug mode I see that FORM.vars correctly has captured
all of the values for both forms.  But FORM.table and FORM.fields both
only have the values for the first SQLFORM.

Thanks for any help you can give me.

def test_add_user():

 form = SQLFORM(db['user'])
 form.insert(len(form),SQLFORM(db['address']))

 #submit data
 if form.accepts(request.vars):

 #check whether the form had errors
 if form.errors:
 response.flash = 'Form has errors'
 return dict(form=form)
 else:

 session.flash = "User Added"
 redirect(URL('admin', 'test_add_user'))

 #return the view
 return dict(form=form)




[web2py] Re: Installation on GoDaddy shared server

2011-01-21 Thread stargate
Thanks for the help...

On Jan 21, 2:35 pm, Kenneth Lundström 
wrote:
> Simplest way ishttp://web2py.com/book/default/chapter/03
>
>  > How do I install web2py on a GoDaddy shared server.
>
> No idea about GoDaddy but,
>
>  > Also what are the steps to install it on a regular linux server.
>
> It depends on alot of things, what linux, what is installed on it and so
> on.www.web2pyslices.comhas pages for different linux distros, for example:
>
> http://web2pyslices.com/main/slices/take_slice/110(Web2py + uWSGI +
> Cherokee on Ubuntu 
> 10.04)http://web2pyslices.com/main/slices/take_slice/98(Deploy web2py on
> Fedora/CentOS/Red Hat)
>
> Hopefully this helps, The book athttp://web2py.com/book/is very, very
> good. I recommend searching it, the Slices and mailing list archive
> (https://groups.google.com/group/web2py) first, if you can t anything
> helping forward ask on the list. You ll usually get a very fast reply.
>
> Kenneth


[web2py] Re: EAV Patterns

2011-01-21 Thread Arun K.Rajeevan
If I'm not wrong, It's not possible.
In short, if you decide to change some part of web2py that's fine but you 
may lose some cool stuff.

Since, SQLFORM expects a TABLE object, you can't use your SQLAlchemy objects 
here.

However, 
You may found formencode  useful (for form 
validation and processing)
There are a few others but I can't recall them right now.





Re: [web2py] Installation on GoDaddy shared server

2011-01-21 Thread Kenneth Lundström

Simplest way is http://web2py.com/book/default/chapter/03

> How do I install web2py on a GoDaddy shared server.

No idea about GoDaddy but,

> Also what are the steps to install it on a regular linux server.

It depends on alot of things, what linux, what is installed on it and so 
on. www.web2pyslices.com has pages for different linux distros, for example:


http://web2pyslices.com/main/slices/take_slice/110 (Web2py + uWSGI + 
Cherokee on Ubuntu 10.04)
http://web2pyslices.com/main/slices/take_slice/98 (Deploy web2py on 
Fedora/CentOS/Red Hat)


Hopefully this helps, The book at http://web2py.com/book/ is very, very 
good. I recommend searching it, the Slices and mailing list archive 
(https://groups.google.com/group/web2py) first, if you can´t anything 
helping forward ask on the list. You´ll usually get a very fast reply.



Kenneth



[web2py] Combining Forms without SQLFORM Factory

2011-01-21 Thread Lennon
I have two reasons for not wanting to use SQLFORM factory.  First, I
can't figure out or find how to use SQLFORM factory as an update/
delete form when combining multiple table (although I'd love to see
how if it can be done).  Second, I will be wanting to do some really
complicated forms in the future and would like to understand how to
combine SQLforms.

With the insert form code listed below, I've been able to combine the
two forms on one page.  They both render (with two submit buttons) and
the form validation works for both of them regardless of which submit
button I hit (which made me think I had successfully combined them).

But when the form accepts the data, it only does an insert on the
original form and doesn't work on the appended form.

When I run in debug mode I see that FORM.vars correctly has captured
all of the values for both forms.  But FORM.table and FORM.fields both
only have the values for the first SQLFORM.

Thanks for any help you can give me.

def test_add_user():

form = SQLFORM(db['user'])
form.insert(len(form),SQLFORM(db['address']))

#submit data
if form.accepts(request.vars):

#check whether the form had errors
if form.errors:
response.flash = 'Form has errors'
return dict(form=form)
else:

session.flash = "User Added"
redirect(URL('admin', 'test_add_user'))

#return the view
return dict(form=form)


[web2py] Web2py + jquery UI Accordion

2011-01-21 Thread Ialejandro
Hi there! I'm new to web2py, It is just... awesome!

Well this is my question, I'd like to know how could I use the jquery
UI accordion with web2py and fill it from a db.

For example I have the model,

db.define_table('people',
 Field('name','string')
 Field('comments','text'))

And i like to have the accordion title = people.name
and the accordion body = people.comments

Thanks!


[web2py] How do I do the following select with DAL?

2011-01-21 Thread vortex
SELECT code FROM tags WHERE code NOT IN (SELECT code FROM tags JOIN
items ON tags.id=items.of_tag);


Re: [web2py] Re: pyQT & web2py

2011-01-21 Thread Jason Brower
It sounds like you could start the QT interface from web2py if you 
wanted. :P  But I think the best think would be to have two programs, 
the Interface (Web, QT, Mobile app (nokia supports qt) etc...) and then 
an application that communicates with that for the automation stuff. It 
would have an interface that would be universally accessable from a 
network. (I use amp in twisted, but you may xml or something) and your 
interfaces would read that.  You could have web2py do that serving of 
that data and that would simply things a bit.

Best Regards,
Jason Brower

On 01/21/2011 08:58 PM, Richard Vézina wrote:

Peter's principles

I should reread it...

Richard

On Fri, Jan 21, 2011 at 1:53 PM, mart @gmail.com > wrote:


Hey,

Its in-house (mostly all python) automation framework for
builds&releases, and other process specific tasks (and acts a the
interface between test and releas automation). Its all up and running
as it is, and is doing a great job. So, I;m doing some feature
development now that the foundation is up and running. The  way I made
layout the code structure means there is no separation beween blueLite
(the automation) and web2py.. one can work on its own independently
from the other if needed (but made to work together). I can launch
web2py (the web app0 and serve applications, and those applications
that act as front end to blueLite make reference to the blueLite
modules s well.

So, it came as a surprise a little while when different team had asked
to use the framework, but the ask mad lit of sense to. Since the whole
thing is basically "dump to ds and run", new uses are coming up. Teams
use it for continues build/integration in their sandboxes, dev folks
use it on there desktop or laptop, and this a support fully, because
they try to match as close as possible the actual production
environment, and that often starts with the tooling. Some of the folks
that want to make use of it and that are not that technical, find that
having to launch a webApp + browser intimidated (even though its
not)... so, pyQT can quell that "fear" of os the unknown for them. its
the same thing really, but... the idea of having the ability to verify
dev/build data on someone's desktop is quite appealing to them. The
setup os the same, but the server part becomes invisible... almost
like giving someone a placebo... as long as they believe it ;)  So, s
mentioned, when we will be able to dump a fully deployable web2py (as
in dump and deploy, one click), things should start to get
interesting :)

so it ends up like this:

they use a browser (that doesn't look like a browser - actually a
browser that doesn't enable browsing), and they are happy... the only
requirement is that they install python, which they can download
internally n=on the corporate network, with a nice page with very
simple instruction, to the letter (which always makes me giggle,
because some are so focused on the litte detail that don;t make much
of a difference ;)).

You ever hear of the Peter principle? this is it, at its best! :)

Mart :)

On Jan 21, 1:23 pm, Jason Brower mailto:encomp...@gmail.com>> wrote:
> What product are you making.  It really depends on the product
you are
> making as how you plan on making a gui that uses web2py tools.
> I personally have made a web2py server that calls a wine program
that
> has a qt user interface and and a specially modified twisted server.
> What is that, like 5 different programs?!) Each run seporatly
but may
> need to pull data from each other at times.  It is certainly
possible,
> it's one of the reasons I chose web2py, because it was written in
> python, and python can do just about anything. :P
> Best Regards,
> Jason Brower
>
> On 01/20/2011 10:08 PM, mart wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > has anyone considered using pyQT within their apps? and if
yes, any
> > comments on its use?
>
> > Thanks,
> > Mart :)




<>

Re: [web2py] Re: pyQT & web2py

2011-01-21 Thread Richard Vézina
Peter's principles [?]

I should reread it...

Richard

On Fri, Jan 21, 2011 at 1:53 PM, mart  wrote:

> Hey,
>
> Its in-house (mostly all python) automation framework for
> builds&releases, and other process specific tasks (and acts a the
> interface between test and releas automation). Its all up and running
> as it is, and is doing a great job. So, I;m doing some feature
> development now that the foundation is up and running. The  way I made
> layout the code structure means there is no separation beween blueLite
> (the automation) and web2py.. one can work on its own independently
> from the other if needed (but made to work together). I can launch
> web2py (the web app0 and serve applications, and those applications
> that act as front end to blueLite make reference to the blueLite
> modules s well.
>
> So, it came as a surprise a little while when different team had asked
> to use the framework, but the ask mad lit of sense to. Since the whole
> thing is basically "dump to ds and run", new uses are coming up. Teams
> use it for continues build/integration in their sandboxes, dev folks
> use it on there desktop or laptop, and this a support fully, because
> they try to match as close as possible the actual production
> environment, and that often starts with the tooling. Some of the folks
> that want to make use of it and that are not that technical, find that
> having to launch a webApp + browser intimidated (even though its
> not)... so, pyQT can quell that "fear" of os the unknown for them. its
> the same thing really, but... the idea of having the ability to verify
> dev/build data on someone's desktop is quite appealing to them. The
> setup os the same, but the server part becomes invisible... almost
> like giving someone a placebo... as long as they believe it ;)  So, s
> mentioned, when we will be able to dump a fully deployable web2py (as
> in dump and deploy, one click), things should start to get
> interesting :)
>
> so it ends up like this:
>
> they use a browser (that doesn't look like a browser - actually a
> browser that doesn't enable browsing), and they are happy... the only
> requirement is that they install python, which they can download
> internally n=on the corporate network, with a nice page with very
> simple instruction, to the letter (which always makes me giggle,
> because some are so focused on the litte detail that don;t make much
> of a difference ;)).
>
> You ever hear of the Peter principle? this is it, at its best! :)
>
> Mart :)
>
> On Jan 21, 1:23 pm, Jason Brower  wrote:
> > What product are you making.  It really depends on the product you are
> > making as how you plan on making a gui that uses web2py tools.
> > I personally have made a web2py server that calls a wine program that
> > has a qt user interface and and a specially modified twisted server.
> > What is that, like 5 different programs?!) Each run seporatly but may
> > need to pull data from each other at times.  It is certainly possible,
> > it's one of the reasons I chose web2py, because it was written in
> > python, and python can do just about anything. :P
> > Best Regards,
> > Jason Brower
> >
> > On 01/20/2011 10:08 PM, mart wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > has anyone considered using pyQT within their apps? and if yes, any
> > > comments on its use?
> >
> > > Thanks,
> > > Mart :)
>
<<330.gif>>

[web2py] Re: pyQT & web2py

2011-01-21 Thread mart
sorry, for the bad spelling... i usually dont re-read anything I type,
because then have to correct spelling, but this time I shoulda...

On Jan 21, 1:53 pm, mart  wrote:
> Hey,
>
> Its in-house (mostly all python) automation framework for
> builds&releases, and other process specific tasks (and acts a the
> interface between test and releas automation). Its all up and running
> as it is, and is doing a great job. So, I;m doing some feature
> development now that the foundation is up and running. The  way I made
> layout the code structure means there is no separation beween blueLite
> (the automation) and web2py.. one can work on its own independently
> from the other if needed (but made to work together). I can launch
> web2py (the web app0 and serve applications, and those applications
> that act as front end to blueLite make reference to the blueLite
> modules s well.
>
> So, it came as a surprise a little while when different team had asked
> to use the framework, but the ask mad lit of sense to. Since the whole
> thing is basically "dump to ds and run", new uses are coming up. Teams
> use it for continues build/integration in their sandboxes, dev folks
> use it on there desktop or laptop, and this a support fully, because
> they try to match as close as possible the actual production
> environment, and that often starts with the tooling. Some of the folks
> that want to make use of it and that are not that technical, find that
> having to launch a webApp + browser intimidated (even though its
> not)... so, pyQT can quell that "fear" of os the unknown for them. its
> the same thing really, but... the idea of having the ability to verify
> dev/build data on someone's desktop is quite appealing to them. The
> setup os the same, but the server part becomes invisible... almost
> like giving someone a placebo... as long as they believe it ;)  So, s
> mentioned, when we will be able to dump a fully deployable web2py (as
> in dump and deploy, one click), things should start to get
> interesting :)
>
> so it ends up like this:
>
> they use a browser (that doesn't look like a browser - actually a
> browser that doesn't enable browsing), and they are happy... the only
> requirement is that they install python, which they can download
> internally n=on the corporate network, with a nice page with very
> simple instruction, to the letter (which always makes me giggle,
> because some are so focused on the litte detail that don;t make much
> of a difference ;)).
>
> You ever hear of the Peter principle? this is it, at its best! :)
>
> Mart :)
>
> On Jan 21, 1:23 pm, Jason Brower  wrote:
>
>
>
>
>
>
>
> > What product are you making.  It really depends on the product you are
> > making as how you plan on making a gui that uses web2py tools.
> > I personally have made a web2py server that calls a wine program that
> > has a qt user interface and and a specially modified twisted server.
> > What is that, like 5 different programs?!) Each run seporatly but may
> > need to pull data from each other at times.  It is certainly possible,
> > it's one of the reasons I chose web2py, because it was written in
> > python, and python can do just about anything. :P
> > Best Regards,
> > Jason Brower
>
> > On 01/20/2011 10:08 PM, mart wrote:
>
> > > Hi,
>
> > > has anyone considered using pyQT within their apps? and if yes, any
> > > comments on its use?
>
> > > Thanks,
> > > Mart :)


[web2py] Re: pyQT & web2py

2011-01-21 Thread mart
Hey,

Its in-house (mostly all python) automation framework for
builds&releases, and other process specific tasks (and acts a the
interface between test and releas automation). Its all up and running
as it is, and is doing a great job. So, I;m doing some feature
development now that the foundation is up and running. The  way I made
layout the code structure means there is no separation beween blueLite
(the automation) and web2py.. one can work on its own independently
from the other if needed (but made to work together). I can launch
web2py (the web app0 and serve applications, and those applications
that act as front end to blueLite make reference to the blueLite
modules s well.

So, it came as a surprise a little while when different team had asked
to use the framework, but the ask mad lit of sense to. Since the whole
thing is basically "dump to ds and run", new uses are coming up. Teams
use it for continues build/integration in their sandboxes, dev folks
use it on there desktop or laptop, and this a support fully, because
they try to match as close as possible the actual production
environment, and that often starts with the tooling. Some of the folks
that want to make use of it and that are not that technical, find that
having to launch a webApp + browser intimidated (even though its
not)... so, pyQT can quell that "fear" of os the unknown for them. its
the same thing really, but... the idea of having the ability to verify
dev/build data on someone's desktop is quite appealing to them. The
setup os the same, but the server part becomes invisible... almost
like giving someone a placebo... as long as they believe it ;)  So, s
mentioned, when we will be able to dump a fully deployable web2py (as
in dump and deploy, one click), things should start to get
interesting :)

so it ends up like this:

they use a browser (that doesn't look like a browser - actually a
browser that doesn't enable browsing), and they are happy... the only
requirement is that they install python, which they can download
internally n=on the corporate network, with a nice page with very
simple instruction, to the letter (which always makes me giggle,
because some are so focused on the litte detail that don;t make much
of a difference ;)).

You ever hear of the Peter principle? this is it, at its best! :)

Mart :)

On Jan 21, 1:23 pm, Jason Brower  wrote:
> What product are you making.  It really depends on the product you are
> making as how you plan on making a gui that uses web2py tools.
> I personally have made a web2py server that calls a wine program that
> has a qt user interface and and a specially modified twisted server.
> What is that, like 5 different programs?!) Each run seporatly but may
> need to pull data from each other at times.  It is certainly possible,
> it's one of the reasons I chose web2py, because it was written in
> python, and python can do just about anything. :P
> Best Regards,
> Jason Brower
>
> On 01/20/2011 10:08 PM, mart wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > has anyone considered using pyQT within their apps? and if yes, any
> > comments on its use?
>
> > Thanks,
> > Mart :)


[web2py] Installation on GoDaddy shared server

2011-01-21 Thread stargate
How do I install web2py on a GoDaddy shared server.  Also what are the
steps to install it on a regular linux server.


Re: [web2py] Re: Represent not working in details on Powertable

2011-01-21 Thread Bruno Rocha
2011/1/21 web2py noob 

> bruno, as you say above is wrong. the workaround is:
>
> db.define_table('tablename',
>Field('fieldname',db.othertable, represent=lambda f:
> db.othertable[f].fieldname)
> )
>
> best regards.


 This is what I have working here:

db.define_table('father',
   Field('name'),
   format='%(name)s' # this format is not working on SQLTABLE as
reported by many users.
   )

db.define_table('son',
   Field('name'),
   Field('father_id',db.father,represent=lambda r:r.name), #this is
the workaround
   format='%(name)s'
  )

That is what I got in *SQLTABLE*

 my_sqltable :
  son.id son.name son.padre 1 Mike John

without that workaround we got:

 my_sqltable :
  son.id son.name son.padre 1 Mike 1


with format='%(name)s' it is rendering as:
 my_sqltable :
  son.id son.name son.padre 1 Mike None


Re: [web2py] Re: web2pyslices migration

2011-01-21 Thread contatogilson...@gmail.com
This idea is better:)
_
*Gilson Filho*
*Web Developer
Blog:* blog.gilsondev.com
*Twitter:* twitter.com/gilsonfilho



2011/1/21 Bruno Rocha 

> 2011/1/21 contatogilson...@gmail.com 
>
>> What do you think of having a wiki on the framework and its libraries in
>> web2pyslices?
>
>
> I don't know if a wiki is needed, in web2pyslices we are planning to have a
> follow system, so people will be able to follow slices, and people will be
> able to fork slices, Slices can be anything (it is like a post), but it is a
> post specifically categorized and with exclusive features for each category.
>
> We can add the functionality to make a slice public, so anyone can edit a
> slice (option-able by the creator of the slice)
>
> Slices will be connected itself with other slices (slices follows slices),
> so we finish having a tree of related stuff.
>
> Imagine the workflow:
>
> Enter web2pyslices
> Search keyword 'form'
> results shows :
> 5 last people who recently have 'form' on his actions
> 5 latest recipes/tutorials tagged and with 'form' on content
> 5 lates plugins related to form
> 5 latest slices that follows any other slice related to 'form'
> plus:
> 5 results from web2py source with the 'form' keyword'
> 5 latest google groups threads related to form
> and so...
>
> The idea is ONE PLACE for web2py related stuff.
>
>
>
>


Re: [web2py] pyQT & web2py

2011-01-21 Thread Jason Brower
What product are you making.  It really depends on the product you are 
making as how you plan on making a gui that uses web2py tools.
I personally have made a web2py server that calls a wine program that 
has a qt user interface and and a specially modified twisted server. 
What is that, like 5 different programs?!) Each run seporatly but may 
need to pull data from each other at times.  It is certainly possible, 
it's one of the reasons I chose web2py, because it was written in 
python, and python can do just about anything. :P

Best Regards,
Jason Brower

On 01/20/2011 10:08 PM, mart wrote:

Hi,

has anyone considered using pyQT within their apps? and if yes, any
comments on its use?

Thanks,
Mart :)




[web2py] Re: using shell with GAE on local development server

2011-01-21 Thread Jacob Gur

>>> sys.path.append("/usr/local/google_appengine")
>>> sys.path.append("/usr/local/google_appengine/lib/yaml/lib")
>>> sys.path.append("/usr/local/google_appengine/lib/fancy_urllib")
>>> sys.path.append("/usr/local/google_appengine/google/appengine/ext")
>>> from google.appengine.ext import db
>>> db = DAL('gae')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/jacobgur/Documents/workspace/web2py/src/gluon/dal.py",
line 3357, in __init__
raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
error
RuntimeError: Failure to connect, tried 5 times:
global name 'gae' is not defined

Which ones?

On Jan 21, 12:51 pm, Massimo Di Pierro 
wrote:
> The google modules are not in your path.
>
> On Jan 21, 10:36 am, Jacob Gur  wrote:
>
>
>
>
>
>
>
> > I want to run a Python shell in my GAE local development server
> > environment. As I understand, the best way to do this is to run:
> >   python web2py.py -S 
>
> > (Please correct me if I doing something wrong here)
>
> > Next, I run in the shell the following commands:
> >   from gluon.dal import DAL
> >   from gluon.shell import exec_environment
> >   from gluon.tools import Auth
> >   db = DAL('gae')
>
> > I get the following error back:
>
> > Traceback (most recent call last):
> >   File "", line 1, in 
> >   File "/Users/jacobgur/Documents/workspace/web2py/src/gluon/dal.py",
> > line 3357, in __init__
> >     raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
> > error
> > RuntimeError: Failure to connect, tried 5 times:
> > global name 'gae' is not defined
>
> > What am I doing wrong?
>
> > As a side note, is there an easy way to using the GAE interactive
> > console, or is there a html-based shell available?
>
> > Thanks


Re: [web2py] Re: web2pyslices migration

2011-01-21 Thread Bruno Rocha
2011/1/21 contatogilson...@gmail.com 

> What do you think of having a wiki on the framework and its libraries in
> web2pyslices?


I don't know if a wiki is needed, in web2pyslices we are planning to have a
follow system, so people will be able to follow slices, and people will be
able to fork slices, Slices can be anything (it is like a post), but it is a
post specifically categorized and with exclusive features for each category.

We can add the functionality to make a slice public, so anyone can edit a
slice (option-able by the creator of the slice)

Slices will be connected itself with other slices (slices follows slices),
so we finish having a tree of related stuff.

Imagine the workflow:

Enter web2pyslices
Search keyword 'form'
results shows :
5 last people who recently have 'form' on his actions
5 latest recipes/tutorials tagged and with 'form' on content
5 lates plugins related to form
5 latest slices that follows any other slice related to 'form'
plus:
5 results from web2py source with the 'form' keyword'
5 latest google groups threads related to form
and so...

The idea is ONE PLACE for web2py related stuff.


[web2py] Is built-in ACL functionality right for me?

2011-01-21 Thread Jacob Gur
I'm trying to determine if the built-in RACL (role-base access control
list) functionality using groups and permissions tables is right for
me.

My requirements are:
1) A user is an administrator of one, several, or all accounts (in
account table), with varying levels of administrative rights.
2) An account contains one or more locations (in location table)
3) A user has varying levels of rights to administer one, several, or
all locations.
4) Given a user, the application will determine all of a person's
permissions.
5) The application will, of course, enforce permissions as user tries
to read/write settings.

Using groups to represent each resource will not work, because the
table which contains the user field is not the table which defines the
role. That is, if I want to know all accounts the user can administer,
then I need to query all auth_group rows to determine all accounts,
and then join with auth_membership table to see which groups user is a
member of. That is a not a reasonable solution, so I'm left with
adding permissions to the user_ group for each resource.

But there are still numerous problems:
1) more complex query logic to retrieve user permissions in tables
separate from auth_user table
2) if a user has rights to administer all resources of one type, then
permissions need to be added to all records of that type. and each
time a new record is added or deleted, permissions need to be synced
with all users who have permissions to all records. also, if a
resource moves between locations, location-specific administrators
will need their permissions synced as well.
3) the permissions do not specify more custom restrictions on
particular fields in the table or what the user can do with those
fields.

It seems to me that I'm best of with managing a user's permission
directly in the auth_user table, by adding fields such as:
 - allowAllLocations
 - allowLocations: list:string

Does anybody have another suggestion?

thx


Re: [web2py] Re: web2pyslices migration

2011-01-21 Thread contatogilson...@gmail.com
What do you think of having a wiki on the framework and its libraries in
web2pyslices?
_
*Gilson Filho*
*Web Developer
Blog:* blog.gilsondev.com
*Twitter:* twitter.com/gilsonfilho



2011/1/20 Martin.Mulone 

> :O the rumors run fast


[web2py] Re: Adding restructuredtext support for plugin_wiki or translating to markmin

2011-01-21 Thread Massimo Di Pierro
Actually, yes, there is an easy way but I am not home and I do not
have immediate access to my files. Will post a solution asap.

On Jan 21, 10:46 am, mart  wrote:
> As I recently learned...
>
> I made a script that takes lists (or a list of lists) which gets
> converted to a Markmin table. Works great! took me a half a day to
> make sure the recursion was just right, etc...
>
> Then Massimo comes in and says "I would have simply done
> {{=rows}}" ... I would wait and see what Massimo says, I'm sure he has
> a quick answer to this well (just my gut though) :)
>
> On Jan 21, 11:30 am, Offray Vladimir Luna Cárdenas 
> wrote:
>
>
>
>
>
>
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
>
> > Hi,
>
> > El 20/01/11 19:53, Offray Vladimir Luna C rdenas escribi :
>
> > > Hi all,
>
> > > It has been a lot of fun getting my web2py server on-line. I have tried
> > > before Zope/Plone/Cynin and MoinMoin as places for collective memory and
> > > interaction, but definitively I feel more comfortable with web2py over
> > > others and now I would like to share the documentation about this or
> > > other things using, of course, web2py appliances and plugins, specially
> > > plugin_wiki.
>
> > > The problem is that my documentation is in ReStructuredText (ReST)
> > > format, so I would like to know if there is a way to convert from ReST
> > > to markmin or even better if there is a way to add several markup
> > > languages to markmin (for example I would like to explore also
> > > txt2tags[1]). Until now my search on the web is not helping me a lot,
> > > except for Pandoc, but it has no support for markmin.
>
> > > Thanks,
>
> > > Offray
>
> > > [1]http://txt2tags.org/markup.html
>
> > Seems that the best way is trying to install the web2py-wiki[1] from
> > bazaar (it doesn't have any download for a w2p file) and see how this
> > gives support to restructured text and try to compare with how
> > plugin_wiki gives support to markmin and see if they can be integrated.
> > I will keep you posted.
>
> > [1]https://launchpad.net/web2py-wiki
>
> > Cheers,
>
> > Offray
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > iQEcBAEBAgAGBQJNObS+AAoJEGiex2828ICw5ekIALbrhXpOj41xrSdHiVDMqkO3
> > r/H7Rz19wHlzKZgW0uoVXU3ecLBbbSaB404uVrrBLIddqRYqMSBHnSXJvLGN7EvX
> > zKYNE7jirkK2c5DiRFDGUPMpEBb0i1P5nrbZSEXH3IOfL7y+k0EjrA287y/KxIcg
> > YE1uIpdysM8eM+DcxL3h4ulipFWivWFU8mr1WkCIk+DUbY/ETe3Yjkxm80k8sVlG
> > thT38jB7KyJDI2IS3sPsucAkm66cn9cTs5t6ezrWDe70WVevRbadBfOY/HFD63ZP
> > JmK7mfEFkPCjt66m1Ai4PUjjIqpLeG8sSplNJ9GGqf6pI61DagoYqzbLWOsYNpI=
> > =g8a/
> > -END PGP SIGNATURE-


[web2py] Re: using shell with GAE on local development server

2011-01-21 Thread Massimo Di Pierro
The google modules are not in your path.

On Jan 21, 10:36 am, Jacob Gur  wrote:
> I want to run a Python shell in my GAE local development server
> environment. As I understand, the best way to do this is to run:
>   python web2py.py -S 
>
> (Please correct me if I doing something wrong here)
>
> Next, I run in the shell the following commands:
>   from gluon.dal import DAL
>   from gluon.shell import exec_environment
>   from gluon.tools import Auth
>   db = DAL('gae')
>
> I get the following error back:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/Users/jacobgur/Documents/workspace/web2py/src/gluon/dal.py",
> line 3357, in __init__
>     raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
> error
> RuntimeError: Failure to connect, tried 5 times:
> global name 'gae' is not defined
>
> What am I doing wrong?
>
> As a side note, is there an easy way to using the GAE interactive
> console, or is there a html-based shell available?
>
> Thanks


[web2py] Re: Represent not working in details on Powertable

2011-01-21 Thread web2py noob
bruno, as you say above is wrong. the workaround is:

db.define_table('tablename',
Field('fieldname',db.othertable, represent=lambda f:
db.othertable[f].fieldname)
)

best regards.

On Jan 21, 2:15 pm, Bruno Rocha  wrote:
> It is a problem with SQLTABLE, detail tables is pure SQLTABLE, SOme people
> identified a bug in SQLTABLE regarding references representation.
>
> It is showing the ID or sometines None for references.
>
> there is a workaround for that, using the represent direct on your model,
> try that.
>
> db.define_table('tablename',
>                         Field('fieldname',db.othertable,represent=lambda
> f:f.othertable.fieldname)
>                       )
>
> I am trying to solve that and send a patch for SQLTABLE, but I couldn't find
> a solution yet.
>
> I guess this was introduced in this 
> changesethttp://code.google.com/p/web2py/source/detail?r=71968b09fb51c3c0a612e...
>
> Anyone
> else having problems with reference fields and SQLTABLE?
>
> ---
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Hard to see the cursor in the built-in editor on Mac

2011-01-21 Thread Peter M.
On Mac I have a hard time to see where the cursor is located in the
built-in editor. It's just a very faint | (pipe character).

Are there any ways to change the cursor to something more visible?

Regards
Peter


Re: [web2py] Represent not working in details on Powertable

2011-01-21 Thread Bruno Rocha
It is a problem with SQLTABLE, detail tables is pure SQLTABLE, SOme people
identified a bug in SQLTABLE regarding references representation.

It is showing the ID or sometines None for references.

there is a workaround for that, using the represent direct on your model,
try that.

db.define_table('tablename',
Field('fieldname',db.othertable,represent=lambda
f:f.othertable.fieldname)
  )

I am trying to solve that and send a patch for SQLTABLE, but I couldn't find
a solution yet.

I guess this was introduced in this changeset
http://code.google.com/p/web2py/source/detail?r=71968b09fb51c3c0a612ec4f1421a84955887f96

Anyone
else having problems with reference fields and SQLTABLE?


---
Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Another question about Powertable

2011-01-21 Thread Bruno Rocha
In this link http://datatables.net/usage/options you can find the
datatables.net options, and that options are defined in
powerTable.dtfeatures[]

Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Another question about Powertable

2011-01-21 Thread Bruno Rocha
It is a client sort, but you can disable or configure it.

*bSort*
powerTable.dtfeatures['bSort'] = True #set to False for no client sort when
you want to use orderby on DAL

*aaSorting*
If sorting is enabled, it will perform a first pass sort on initialisation.
You can define which column(s) the sort is performed upon, and the sorting
direction, with this variable. The aaSorting array should contain an array
for each column to be sorted initially containing the column's index and a
direction string ('asc' or 'desc').

powerTable.dtfeatures['aaSorting'] = [ [2,'asc'] , [3,'desc'] ]


*aaSortingFixed*
is basically identical to the aaSorting parameter, but cannot be overridden
by user interaction with the table. What this means is that you could have a
column (visible or hidden) which the sorting will always be forced on first
- any sorting after that (from the user) will then be performed as required.
This can be useful for grouping rows together.

powerTable.dtfeatures['aaSortingFixed'] = [ [0,'asc'] ]


---
So sorry, I need to fix a lot of issues and make a better documentation for
powerTable plugin.

---
Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: Adding restructuredtext support for plugin_wiki or translating to markmin

2011-01-21 Thread mart
As I recently learned...

I made a script that takes lists (or a list of lists) which gets
converted to a Markmin table. Works great! took me a half a day to
make sure the recursion was just right, etc...

Then Massimo comes in and says "I would have simply done
{{=rows}}" ... I would wait and see what Massimo says, I'm sure he has
a quick answer to this well (just my gut though) :)

On Jan 21, 11:30 am, Offray Vladimir Luna Cárdenas 
wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> El 20/01/11 19:53, Offray Vladimir Luna C rdenas escribi :
>
>
>
>
>
>
>
>
>
> > Hi all,
>
> > It has been a lot of fun getting my web2py server on-line. I have tried
> > before Zope/Plone/Cynin and MoinMoin as places for collective memory and
> > interaction, but definitively I feel more comfortable with web2py over
> > others and now I would like to share the documentation about this or
> > other things using, of course, web2py appliances and plugins, specially
> > plugin_wiki.
>
> > The problem is that my documentation is in ReStructuredText (ReST)
> > format, so I would like to know if there is a way to convert from ReST
> > to markmin or even better if there is a way to add several markup
> > languages to markmin (for example I would like to explore also
> > txt2tags[1]). Until now my search on the web is not helping me a lot,
> > except for Pandoc, but it has no support for markmin.
>
> > Thanks,
>
> > Offray
>
> > [1]http://txt2tags.org/markup.html
>
> Seems that the best way is trying to install the web2py-wiki[1] from
> bazaar (it doesn't have any download for a w2p file) and see how this
> gives support to restructured text and try to compare with how
> plugin_wiki gives support to markmin and see if they can be integrated.
> I will keep you posted.
>
> [1]https://launchpad.net/web2py-wiki
>
> Cheers,
>
> Offray
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQEcBAEBAgAGBQJNObS+AAoJEGiex2828ICw5ekIALbrhXpOj41xrSdHiVDMqkO3
> r/H7Rz19wHlzKZgW0uoVXU3ecLBbbSaB404uVrrBLIddqRYqMSBHnSXJvLGN7EvX
> zKYNE7jirkK2c5DiRFDGUPMpEBb0i1P5nrbZSEXH3IOfL7y+k0EjrA287y/KxIcg
> YE1uIpdysM8eM+DcxL3h4ulipFWivWFU8mr1WkCIk+DUbY/ETe3Yjkxm80k8sVlG
> thT38jB7KyJDI2IS3sPsucAkm66cn9cTs5t6ezrWDe70WVevRbadBfOY/HFD63ZP
> JmK7mfEFkPCjt66m1Ai4PUjjIqpLeG8sSplNJ9GGqf6pI61DagoYqzbLWOsYNpI=
> =g8a/
> -END PGP SIGNATURE-


[web2py] using shell with GAE on local development server

2011-01-21 Thread Jacob Gur
I want to run a Python shell in my GAE local development server
environment. As I understand, the best way to do this is to run:
  python web2py.py -S 

(Please correct me if I doing something wrong here)

Next, I run in the shell the following commands:
  from gluon.dal import DAL
  from gluon.shell import exec_environment
  from gluon.tools import Auth
  db = DAL('gae')

I get the following error back:

Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/jacobgur/Documents/workspace/web2py/src/gluon/dal.py",
line 3357, in __init__
raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
error
RuntimeError: Failure to connect, tried 5 times:
global name 'gae' is not defined

What am I doing wrong?

As a side note, is there an easy way to using the GAE interactive
console, or is there a html-based shell available?

Thanks


Re: [web2py] Adding restructuredtext support for plugin_wiki or translating to markmin

2011-01-21 Thread Offray Vladimir Luna Cárdenas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

El 20/01/11 19:53, Offray Vladimir Luna Cárdenas escribió:
> Hi all,
> 
> It has been a lot of fun getting my web2py server on-line. I have tried
> before Zope/Plone/Cynin and MoinMoin as places for collective memory and
> interaction, but definitively I feel more comfortable with web2py over
> others and now I would like to share the documentation about this or
> other things using, of course, web2py appliances and plugins, specially
> plugin_wiki.
> 
> The problem is that my documentation is in ReStructuredText (ReST)
> format, so I would like to know if there is a way to convert from ReST
> to markmin or even better if there is a way to add several markup
> languages to markmin (for example I would like to explore also
> txt2tags[1]). Until now my search on the web is not helping me a lot,
> except for Pandoc, but it has no support for markmin.
> 
> Thanks,
> 
> Offray
> 
> [1] http://txt2tags.org/markup.html

Seems that the best way is trying to install the web2py-wiki[1] from
bazaar (it doesn't have any download for a w2p file) and see how this
gives support to restructured text and try to compare with how
plugin_wiki gives support to markmin and see if they can be integrated.
I will keep you posted.

[1] https://launchpad.net/web2py-wiki

Cheers,

Offray
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNObS+AAoJEGiex2828ICw5ekIALbrhXpOj41xrSdHiVDMqkO3
r/H7Rz19wHlzKZgW0uoVXU3ecLBbbSaB404uVrrBLIddqRYqMSBHnSXJvLGN7EvX
zKYNE7jirkK2c5DiRFDGUPMpEBb0i1P5nrbZSEXH3IOfL7y+k0EjrA287y/KxIcg
YE1uIpdysM8eM+DcxL3h4ulipFWivWFU8mr1WkCIk+DUbY/ETe3Yjkxm80k8sVlG
thT38jB7KyJDI2IS3sPsucAkm66cn9cTs5t6ezrWDe70WVevRbadBfOY/HFD63ZP
JmK7mfEFkPCjt66m1Ai4PUjjIqpLeG8sSplNJ9GGqf6pI61DagoYqzbLWOsYNpI=
=g8a/
-END PGP SIGNATURE-


[web2py] Re: pyQT & web2py

2011-01-21 Thread mart
So, there is lots of fun to had with web2py with pyQT. It just depends
on the end goal.

I embed web2py within an automation framework, which despite this and
a few other pieces, turns out to be pretty light on its feet (not a
huge footprint for users to download). So, doing this, web2py comes in
VERY handy both in and outside of the web context. the automation (aka
'blueLite') uses DAL to handle the data layer, completely. Since
blueLite is almost all python, it makes use of many features of
web2py, even outside of a browser. Also, since each instance of
blueLite has web2py within its folder structure, anyone making use of
blueLite, can also make use of web2py, the full webApp server. The
built in applications that come baked in, make good use of the
blueLite modules as well. once, I get the one-button-click deployement
working, well... imagine having a local web2py server sitting on
developers desktops. Distributed development efforts, with the right
applications, will gain a lot from a collaboration perspective.

This is what I tried this morning, with minimal effort. I can create a
pyQT application with different widgets in the mainWindow to handle
different scenarios. For example, I can have an interface to blueLite,
which by it self is headless, and I can manipulate and execute
different features of blueLite and provide data to them through this
UI. I can also, have a webView widget (which is just a browser
window). With this, I can have a dropdown menu (or anything really)
and have it start up and point to the local web2py server, or have
point to a remote server simply by choosing it in the drop-down menu.
By doing so, this becomes an easy-to-put-together desktop application
which makes use of a browser widget, but isn't a browser, because
users can't enter a URL. It will only navigate the web2py applications
(this is intentional, they can use a full browser to browse the net.

As Blackthorn points out, this would make a great DB viewer for users
who need to retrive data from either the local or remote DB. Querying
DBs (or what ever the action is) with buttons that execute sql queries
isn't a hard thing (thanks to Massimo's work), because I don't have to
use QT's built-in DB and TAble libraries, I can simply use the DAL as
I do with blueLite.

My plan is to start with this and see what comes of it. A good and
easy way would be to have that desktop app (bundled with blueLite and
web2py) and have it work in to ways. 1) with blueLite directly as a
desktop app (which already comes with web2py so I can use that to) and
2) still as a desktop app but through a webView widget, so I can
access web2py, the webAppserver. I can see where plugin_wiki would be
a great place to start since the work involved is just adding those
pages to the wiki and have them to whatever is needed, then have the
pyQT app point to those pages that display very well within this non-
browser browser application.

Again, minimal effort, great looking front that does indeed work well
with web2py.

Why not simply use pyjamas? Because I want to use web2py. web2py is a
full framework, pyjamas is not. I could use pyjamas with the app, but
then I would use it with web2py, and have pyQT use web2py to get to
pyjamas... (no real or immediate benefit there). So, in fact, web2py
will now be used in 3 separate environments. As the back end to a
headless automation framework, 2) as the great webApp sevrer it is and
3) as a bundled up backend service to a desktop desktop application.

Thanks,
Mart :)





On Jan 20, 10:27 pm, blackthorne  wrote:
> well, I think he didn't made it clear but I see many ways:
>
> - create a component for web2py that instead of generating the html/
> css/js source you use to see it in a website, it would generate the
> GUI application (controllers+view) as well as linking it to a shared
> model. This is a lot of work but would be awesome...
>
> - create an independent app that communicate with web2py just like you
> mentioned.
>
> - bind a Qt interface to the same hooks currently used by the web
> interface that allows you to do pretty much everything web2py
> supports. One idea would be to put the admin application with a native
> look and extend, in example, monitoring properties (graphs, stats,
> plots). Qt is good for that.
>
> - web 6.0 - my idea (not so web2py specific, but appliable)
>
> best regards
>
> On Jan 21, 12:03 am, Stefaan Himpe  wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > It's not clear to me how you would combine PyQt (or PySide) with web2py
> > in the same application, it doesn't seem to make much sense to me.
>
> > Provided you could actually make this work, a PyQt UI embedded in a
> > web2py application would only be visible on the server (e.g. some google
> > data center), not on the client (user of the web application).
>
> > Of course I could have misunderstood: you could make a PyQt UI that
> > requests services from a web2py web application using xmlrpc.
> > In that case both applications are compl

Re: [web2py] Another question about Powertable

2011-01-21 Thread Kenneth Lundström
No luck, I tried that earlier but now that I look at the order it´s not 
ordered by ID, but something else that I can´t see.



Kenneth

Have you tried returning your rows using an SQL order by clause to see 
if that worked...


Just a suggestion; I never used powertable.



On 1/21/11 10:29 AM, Kenneth Lundström wrote:

Hi again Bruno,

another stupid question about powertable. How do I select in what 
order the rows are shown. For do moment they are shown in ID order, 
I´d like to select anoter column.



Kenneth








Re: [web2py] Another question about Powertable

2011-01-21 Thread David J.
Have you tried returning your rows using an SQL order by clause to see 
if that worked...


Just a suggestion; I never used powertable.



On 1/21/11 10:29 AM, Kenneth Lundström wrote:

Hi again Bruno,

another stupid question about powertable. How do I select in what 
order the rows are shown. For do moment they are shown in ID order, 
I´d like to select anoter column.



Kenneth






[web2py] Another question about Powertable

2011-01-21 Thread Kenneth Lundström

Hi again Bruno,

another stupid question about powertable. How do I select in what order 
the rows are shown. For do moment they are shown in ID order, I´d like 
to select anoter column.



Kenneth



[web2py] Re: Website

2011-01-21 Thread VP
I'd do this:

1. create a new app called my_first_app, through the admin interface.

2. modify controller/default.py: replace index function with, def
index(): return dict()

3. replace view/default/index.html with your static file.

4. place your css file in static/, and modify index.html to  point to
it.




On Jan 21, 8:30 am, stargate  wrote:
> Lets say i have created a static page using XHTML and css.  How do I
> integrate it into web2py.  Basically i am toying to learn a new
> language coming from a PHP background.
>
> I can't find  a getting started with web2py like integrating a
> existing design and apply server side web2py database elements to it.


[web2py] Represent not working in details on Powertable

2011-01-21 Thread Kenneth Lundström

Hello Bruno,

I´m implementing powertables and can´t get it to show a reference field 
correctly.


In my models:
Field('f_customer', type='reference t_customer',
label=T('Customer'), represent = lambda id: 
db.t_customer(id).f_internal_name),


But when opening the Details it shows the ID.

It works great on the main row.


Kenneth


Re: [web2py] Re: "python web2py.py" stops any any comman

2011-01-21 Thread Kuba Kucharski
>and nothing more!
>There is no prompt and I cann't input anything - seems it hangs.

it works perfectly, if you want to use the same console after starting
the server you can start web2py in background:

python web2py.py -i 127.0.0.1 -p 8001 &

and than run

python web2py.py -S app -N

for python web2py shell






On Fri, Jan 21, 2011 at 2:21 PM, Massimo Di Pierro
 wrote:
> python web2py.py starts the web server. It runs as long as the web
> server runs. Use
>
>   python web2py.py -h
>
> for help. Use
>
>   python web2py.py -S app -N
>
> for a shell
>
> On Jan 21, 12:52 am, Martin Weissenboeck  wrote:
>> Hi,
>>
>> I have started web2py with the following command
>>
>> python web2py.py ...
>>
>> and I get:
>>
>> web2py Enterprise Web Framework
>> 
>> use "kill -SIGTERM 14688" to shudown the web2py server
>>
>> and nothing more!
>> There is no prompt and I cann't input anything - seems it hangs.
>>
>> Anyhow web2py works: I can access the server using the ip-address and port
>> 8000
>>
>> What shall I do?
>>
>> Kind regards, Martin


[web2py] Re: sqlite:memory

2011-01-21 Thread Massimo Di Pierro
DAL('sqlite:memoery') is not designed for what you have in mind. It
only lives for the time one http request. It is more of a tool for
writing tests.

On Jan 21, 8:19 am, leone  wrote:
> Hi,
> have you test 'sqlite:memory' with new DAL?
> Using db = DAL('sqlite:memory:')  (is the syntax correct?)
> I can insert a new row, but I can't retrieve it when I select the next
> request.
> It seems the db is too much volatile...
> Thanks.
> leone


[web2py] Re: db list of blobs?

2011-01-21 Thread Massimo Di Pierro
Now understand. No there is no list:blob, only list:string,
list:integer, list:reference. The reason is that list:blob would be a
problem to implement on relational databases. It would run on unknown
space limitations. Moreover this would require a new class of
widgets.

On Jan 21, 6:59 am, Jacob Gur  wrote:
> Sure. The following example field are not supported by web2py:
>    Field('myBlobs', 'list:blob'),
>    Field('myDates', 'list:date')
>
> A workaround is to do the following:
>    db.define_table('blobTable', Field('myBlob', 'blob'))
>    db.define_table('myTable, Field('myBlobs', 'list:reference
> blobTable'))
>
> It would be great to support list of any type directly as in first two
> examples. GAE supports this with its ListProperty(item_type). You can
> make it work with other database systems by using text field,
> serializing each element of the list into a string and separating with
> pipe character. That is what web2py does for list of integers and list
> of references.
>
> Thanks.
>
> On Jan 20, 11:54 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > I am not sure I fully understand. Can you please provide an example?
>
> > On Jan 20, 6:52 am,JacobGur wrote:
>
> > > Hi-
>
> > > Is there a way to do list of blobs in db? Looks like only options are
> > > list of strings, numbers and references. GAE supports list of
> > > anything, but it looks like web2py has not implemented a way to
> > > serialize all types into a string to store in the other databases it
> > > supports.
>
> > > Obviously, I can create a table to store one blob per row and then use
> > > list of references to achieve same effect, but I'm hoping there is a
> > > simpler way.
>
> > > Thanks.


[web2py] Website

2011-01-21 Thread stargate
Lets say i have created a static page using XHTML and css.  How do I
integrate it into web2py.  Basically i am toying to learn a new
language coming from a PHP background.

I can't find  a getting started with web2py like integrating a
existing design and apply server side web2py database elements to it.



[web2py] sqlite:memory

2011-01-21 Thread leone
Hi,
have you test 'sqlite:memory' with new DAL?
Using db = DAL('sqlite:memory:')  (is the syntax correct?)
I can insert a new row, but I can't retrieve it when I select the next
request.
It seems the db is too much volatile...
Thanks.
leone


[web2py] Re: db list of blobs?

2011-01-21 Thread Jacob Gur
Sure. The following example field are not supported by web2py:
   Field('myBlobs', 'list:blob'),
   Field('myDates', 'list:date')

A workaround is to do the following:
   db.define_table('blobTable', Field('myBlob', 'blob'))
   db.define_table('myTable, Field('myBlobs', 'list:reference
blobTable'))

It would be great to support list of any type directly as in first two
examples. GAE supports this with its ListProperty(item_type). You can
make it work with other database systems by using text field,
serializing each element of the list into a string and separating with
pipe character. That is what web2py does for list of integers and list
of references.

Thanks.

On Jan 20, 11:54 am, Massimo Di Pierro 
wrote:
> I am not sure I fully understand. Can you please provide an example?
>
> On Jan 20, 6:52 am,JacobGur wrote:
>
>
>
>
>
>
>
> > Hi-
>
> > Is there a way to do list of blobs in db? Looks like only options are
> > list of strings, numbers and references. GAE supports list of
> > anything, but it looks like web2py has not implemented a way to
> > serialize all types into a string to store in the other databases it
> > supports.
>
> > Obviously, I can create a table to store one blob per row and then use
> > list of references to achieve same effect, but I'm hoping there is a
> > simpler way.
>
> > Thanks.


[web2py] Re: "python web2py.py" stops any any comman

2011-01-21 Thread Massimo Di Pierro
python web2py.py starts the web server. It runs as long as the web
server runs. Use

   python web2py.py -h

for help. Use

   python web2py.py -S app -N

for a shell

On Jan 21, 12:52 am, Martin Weissenboeck  wrote:
> Hi,
>
> I have started web2py with the following command
>
> python web2py.py ...
>
> and I get:
>
> web2py Enterprise Web Framework
> 
> use "kill -SIGTERM 14688" to shudown the web2py server
>
> and nothing more!
> There is no prompt and I cann't input anything - seems it hangs.
>
> Anyhow web2py works: I can access the server using the ip-address and port
> 8000
>
> What shall I do?
>
> Kind regards, Martin


Re: [web2py] auto login when you come from localhost

2011-01-21 Thread Bruno Rocha
Nice,
this could be useful for admin too.
it is annoying to login for admin in localhost sometimes.

Bruno Rocha
http://about.me/rochacbruno/bio


2011/1/21 selecta 

> http://www.web2pyslices.com/main/slices/take_slice/118
>
> if you have an application that has access control it can be annoying
> to log in every time even though you are on localhost. This small
> snippet will automatically log you in as the first user when you come
> from localhost
>
>
> put the following in your db.py model (or any other)
> import os.path
> if not auth.is_logged_in() and db(db.auth_user.id>0).count() and not
> os.path.exists(os.path.join(request.folder, 'LOCK')) and
> (request.env.remote_addr in '127.0.0.1 localhost'.split()):
>from gluon.storage import Storage
>user = db(db.auth_user.id==1).select().first()
>auth.user = Storage(auth.settings.table_user._filter_fields(user,
> id=True))
>auth.environment.session.auth = Storage(user=user,
> last_visit=request.now,
>
> expiration=auth.settings.expiration)
>response.flash = 'You were automatically logged in as %s %s.
> To prevent this create the file %s'%(user.first_name, user.last_name,
> os.path.join(request.folder, 'LOCK'))
>
> You will be automatically logged in as the first user if you call your
> web2py app from localhost or 127.0.0.1 you can prevent this behavior
> by creating a file called LOCK in your application root directory


[web2py] auto login when you come from localhost

2011-01-21 Thread selecta
http://www.web2pyslices.com/main/slices/take_slice/118

if you have an application that has access control it can be annoying
to log in every time even though you are on localhost. This small
snippet will automatically log you in as the first user when you come
from localhost


put the following in your db.py model (or any other)
import os.path
if not auth.is_logged_in() and db(db.auth_user.id>0).count() and not
os.path.exists(os.path.join(request.folder, 'LOCK')) and
(request.env.remote_addr in '127.0.0.1 localhost'.split()):
from gluon.storage import Storage
user = db(db.auth_user.id==1).select().first()
auth.user = Storage(auth.settings.table_user._filter_fields(user,
id=True))
auth.environment.session.auth = Storage(user=user,
last_visit=request.now,
 
expiration=auth.settings.expiration)
response.flash = 'You were automatically logged in as %s %s.
To prevent this create the file %s'%(user.first_name, user.last_name,
os.path.join(request.folder, 'LOCK'))

You will be automatically logged in as the first user if you call your
web2py app from localhost or 127.0.0.1 you can prevent this behavior
by creating a file called LOCK in your application root directory


[web2py] Re: index called twice

2011-01-21 Thread zemon
Massimo,

Thank you for the quick reply. That's good info and I will keep it in
mind.

My view does not load any images from my own server. The only 
tag references an absolute URL on another host.

This morning, I am wondering if the second reference is caused by the
barcode scanner on the phone, loading the page once in order to decide
whether to call the browser... which loads the page a second time.

-- Art Z.

On Jan 20, 9:36 pm, Massimo Di Pierro 
wrote:
> Look in the view for an incorrect link like
>
> 
>
> if it is a relavive url it would actually call /app/default/index/xxx
> and index is called twice.
>
> On Jan 20, 8:44 pm, Art Zemon  wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I have a simple function in a controller and it seems to be getting
> > called twice. Any ideas why, and what to do about it?
>
> >     def index():
> >          try:
> >              rows = db(  (db.gtsign.auth_user_id==request.vars['c']) \
> >     & (db.gtsign.id==request.vars['s']) \
> >     & (db.gtsign.auth_user_id==db.auth_user.id)).select()
> >              auth_user=rows.first().auth_user
> >              gtsign=rows.first().gtsign
> >              pattern = re.compile(r'[^\d]')
> >              phoneDigits = pattern.sub('', auth_user.telephone)
>
> >              use_count = gtsign.use_count + 1
> >              db.gtsign[gtsign.id] = dict(use_count=use_count)
>
> >              return dict(gtsign=gtsign, auth_user=auth_user,
> >     phoneDigits=phoneDigits)
> >          except Exception, err:
> >              redirect(URL('invalid'))
>
> > The symptom is that gtsign.use_count is going up by 2 instead of by 1
> > every time the page is loaded from a mobile phone. I see this in the
> > Apache log file:
>
> >     97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] "GET
> >     //gotosigns/?c=1&s=19 HTTP/1.1" 200 1500 "-" "Mozilla/5.0 (Linux; U;
> >     Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
> >     AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"
>
> >     97.87.95.138 - - [20/Jan/2011:20:20:40 -0600] "HEAD
> >     //gotosigns/?c=1&s=19 HTTP/1.1" 200 590 "-" "Mozilla/5.0 (Linux; U;
> >     Android 2.1-update1; en-us; SPH-D700 Build/ECLAIR)
> >     AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17"
>
> > I am running web2py Version 1.91.6 (2011-01-03 17:55:14) on Linux and
> > Apache with mod_wsgi.
>
> > Thanks,
> >      -- Art Z.


[web2py] xinha as plugin_wiki editor?

2011-01-21 Thread Michele Comitini
http://xinha.webfactional.com/

Seems a nice editor

mic