Re: [web2py] Re: Proposals for New Tagline

2011-03-21 Thread Jason (spot) Brower
Yeah... Small framework big thought. Or something similar.
On 22 Mar 2011 00:21, "Richard Vézina"  wrote:
> web2py : A small framework that allow you to think Big ;-)
>
> Richard
>
>
>
> On Mon, Mar 21, 2011 at 2:46 PM, pbreit  wrote:
>
>> In the non-enterprise world, it's the exact opposite. "Enterprise"
implies
>> expensive, unpleasant, old, hard to acquire/install/use, bloated,
Java/.net,
>> etc. I'd be surprised if many enterprises are even considering Django.


[web2py] Re: Export DB from admin?

2011-03-21 Thread pbreit
Great info, thanks!

[web2py] Re: Export DB from admin?

2011-03-21 Thread ron_m
I moved from MySQL to PostgreSQL a few months ago with a small database but 
with a significant number of many to many relations as well as one to many. 
Here is what I did:

Exported the data from MySQL using the export_to_csv_file call from the 
shell with the model activated which pushes all the data out to one CSV.

Copied the application directory under web2py/applications, removed all the 
files under databases, changed the connection string in the model.

Created the database in PostgreSQL, left the DB empty.

Ran the application which ran the model and created all the tables and 
relations but no data.

Ran the import_from_csv_file in a shell with the model activated using the 
file from the export step. Don't forget the db.commit() at the end.

The import_from_csv_file does a fantastic job of mapping the old ids to new 
ids in the foreign key relations. I didn't find any breakage in the data. 
This allows the import to not use tricks like turning off the auto increment 
keys such as what happens when using a mysqldump to a file followed by 
reading it in with mysql. Any database that has been used for a while will 
usually have holes in the id sequence of records caused by deletion of 
records. The import_from_csv_file will pack all the ids into a continuous 
sequence and then fix the foreign key references by maintaining the old to 
new id mapping. If your application depends on knowing specific ids this is 
a problem but then I would argue this is an application design issue.

I tested the application and only found one DAL statement that worked in 
MySQL that would not in PostgreSQL. By changing the group by field in the 
query to the field on the other side of the join it worked in both versions.

By copying the application temporarily you are preserving the 
application/databases directory and since you are not touching the MySQL 
database exporting to CSV there isn't much danger in losing the data.

If the database were very large I am not sure how well this would work 
because the IDs from original to new database mapping must be kept in 
memory.

For regular backups by all means use the designated utility provided by the 
database.


[web2py] Re: reddit again

2011-03-21 Thread pbreit
Massimo, sorry to say but I think your posting style invites the unwanted 
attention (av201001, too). I'm a Web2py supporter but I think they are 
right, we don't play well in the discussions. Posting a video under the 
title "Facebook clone in 11 minutes" is unnecessarily provocative. Joking 
about others hijacking the thread is passive-aggressive. As is following 
every Flask/Django/etc comment with "but I like Flask/Django/etc". And 
hijacking threads, which we clearly do, and saying we don't is really bad 
style (regardless if other people do it).

I think we could use a little grace in our interactions with the 
communities. Web2py is too good to leave such a bad impression everywhere.

I also think we overstate the benefits of not having to write much code. It 
doesn't really matter what can be written with a little code, it matters 
what can be written with a lot of code. Same with "write once, run 
anywhere". Most deploy to one  platform. These are nice features, but not 
worth getting into arguments over.


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Jonathan Lundell
On Mar 21, 2011, at 7:44 PM, Indra Gunawan wrote:
> Agree, Flask way looks more elegant (see Variable Rules). It could be nice if 
> this way also exists on Web2Py.  
> 
> On 22 March 2011 06:05, Tom Atkins  wrote:
> I was playing with Flask and I have to say its solution to routing is very 
> nice:
> 
> http://flask.pocoo.org/docs/quickstart/#routing
> 
> The use of variable names anywhere within the URL structure is very handy. 
> Anything like this possible in web2py?

Flask doesn't really allow variable names anywhere; near as I can tell they're 
a considerably restricted version of web2py's args list.



Re: [web2py] Re: web2py applications and version control systems

2011-03-21 Thread pbreit
I should have mentioned that while "hg pull" will pull down all of the most 
up-to-date files from the main repository, it will leave all the files in 
your locally directory unchanged. Nothing actually happens until you perform 
the "hg update". "hg update" by itself will then change all of the files in 
your directory to match the most current set of files. But you can also 
specify a changeset to update to. For example, "hg update R-1.94.1" or "hg 
update 8456baaddbc3" will make all the files in your "working" directory 
correspond only to that changeset.

[web2py] Re: the facebook clone video

2011-03-21 Thread Massimo Di Pierro
yes, here:

User, Link, Post = db.auth_user, db.link, db.post
me, a0, a1 = auth.user_id, request.args(0), request.args(1)
myfriends = db(Link.source==me)(Link.accepted==True)
alphabetical = User.first_name|User.last_name
def name_of(user): return '%(first_name)s %(last_name)s' % user

it is the video.

On Mar 21, 6:59 pm, pbreit  wrote:
> You have to follow the video pretty closely but you'll see that Massimo sets
> those up as short-cuts. I think they were in the model.


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Indra Gunawan
Agree, Flask way looks more elegant (see Variable Rules). It could be nice
if this way also exists on Web2Py.

On 22 March 2011 06:05, Tom Atkins  wrote:

> I was playing with Flask and I have to say its solution to routing is very
> nice:
>
> http://flask.pocoo.org/docs/quickstart/#routing
>
> The use of variable names anywhere within the URL structure is very handy.
> Anything like this possible in web2py?
>

-- 
coderbuzz


[web2py] Re: Flourish Conf 2011 (Chicago Area)

2011-03-21 Thread Massimo Di Pierro
I was planning to be there. Can you help?

Massimo

On Mar 21, 9:39 pm, "G. Clifford Williams" 
wrote:
> Anyone planning on attending Flourish Conf '11?
> Unfortunately it doesn't look like they have any Python speakers this year 
> but apparently there will be tables for both Web2Py and ChiPy
>
> Massimo, who's manning the table?
>
> http://www.flourishconf.com/2011/miniexpo


Re: [web2py] Re: web2py applications and version control systems

2011-03-21 Thread pbreit
First, you clone web2py from Google Code:
hg clone https://web2py.googlecode.com/hg/ web2py

Then, to update web2py, you go in to the "web2py" directory and issue these 
two commands:
$ hg pull
$ hg update

This will not touch "applications/yourapp".

Then, my "init" app is a second mercurial repository that is totally 
independent from the web2py repository. You have two options here: you can 
either configure the copy on your hard drive to be the main repository or 
specify some other server to be the central repository. I use Bitbucket as 
my main repository. I "hg pull" to my hard drive and I also "hg pull" to my 
Ubuntu server. I'm not sure exactly how to deploy to GAE.

As a version control newbie as well, and on a Mac, I've had good times with 
MacHG. But it's also useful to learn the command line. The tutorial I like 
is hginit.com


Re: [web2py] Re: referencing request, session from module folder

2011-03-21 Thread Jonathan Lundell
On Mar 21, 2011, at 8:41 PM, yutaka kawate wrote:
> There is no problem if run from dev_appserver.py.
> Some wrong in session file system.
> so the safe way is passing session,request as prameters.
> thank you

Yes. A module has its own namespace, so it doesn't have access to the caller's 
globals. 

> 
> woo, big earth quake again.

どこに住んでいますか?

> 
> the code is 
> 
> in db.py
> mymodules = local_import('mymodules.who')
> who = mymodules.Who(globals())
> 
> in modules.Who
> class Who(object):
> #def __init__(self,session,request): #,session,request):
> def __init__(self,environment): #,session,request):
> self.environment = environment
> request = environment['request']
> session = environment['session']
> 
> who = session.who
> if who and who.last_visit and who.last_visit\
>  + datetime.timedelta(days=0, seconds=3600)\
>  > request.now:
> self.class_mate = who.class_mate
> self.id = who.id
> self.leader = who.leader
> self.name = who.name
> self.displayname = who.displayname
> self.class_code = who.class_code
> self.last_visit = request.now
> session.who = self
> else:
> self.class_mate = None
> self.id = None
> self.leader = None
> self.name = None
> self.displayname = None
> self.class_code = None
> session.who = None
> 
> #def 
> login(self,session,request,class_mate,id,leader,name,displayname,class_code):
> def login(self,class_mate,id,leader,name,displayname,class_code):
> #self.db = db
> request = self.environment['request']
> session = self.environment['session']
> self.class_mate = class_mate
> self.id = id
> self.leader = leader
> self.name = name
> self.displayname = displayname
> self.class_code = class_code
> self.last_visit = request.now
> 
> session.who = self
> 
> def logoff(self,session):
> self.class_mate = None
> self.id = None
> self.leader = None
> self.name = None
> self.displayname = None
> self.class_code = None
> session.who = None
> 
> 2011/3/22 yutaka kawate 
> thank you 
> but
> i am very sorry, i did typing miss.
> actually, i did so.
> 
> it looks that system try to pickle response variable.
> i am trying environment['response'] = None
> 
> 2011/3/22 Floyd 
> try use self in login(...) method: 
>  def login(self,) 
> request = self.environment['request'] 
> session = self.environment['session'] 
> 
> Bye,
> Floyd
> 
> 




Re: [web2py] processes, threads and performance tuning

2011-03-21 Thread Jonathan Lundell
On Mar 21, 2011, at 8:35 PM, VP wrote:
> 
> I was trying to tweak various settings in terms of processes and
> threads.  This is what I observed.  With web2py's default setting (I
> believed 1 process 15 threads), I got about 30 requests/second for my
> app.
> 
> With 3 processes and 2 threads, I got about 90 requests/second.  This
> is 3 times more!!!  Memory usage is similar for the two settings.  Not
> much difference.
> 
> It seems that more processes is better than more threads.  Is this
> right?  Or am I doing something improper?

That sounds about right. Python can't really take advantage of multiple cores, 
so it's a good idea to have at least as many processes as cores.

[web2py] Re: referencing request, session from module folder

2011-03-21 Thread yutaka kawate
There is no problem if run from dev_appserver.py.
Some wrong in session file system.
so the safe way is passing session,request as prameters.
thank you

woo, big earth quake again.

the code is

in db.py
mymodules = local_import('mymodules.who')
who = mymodules.Who(globals())

in modules.Who
class Who(object):
#def __init__(self,session,request): #,session,request):
def __init__(self,environment): #,session,request):
self.environment = environment
request = environment['request']
session = environment['session']

who = session.who
if who and who.last_visit and who.last_visit\
 + datetime.timedelta(days=0, seconds=3600)\
 > request.now:
self.class_mate = who.class_mate
self.id = who.id
self.leader = who.leader
self.name = who.name
self.displayname = who.displayname
self.class_code = who.class_code
self.last_visit = request.now
session.who = self
else:
self.class_mate = None
self.id = None
self.leader = None
self.name = None
self.displayname = None
self.class_code = None
session.who = None

#def
login(self,session,request,class_mate,id,leader,name,displayname,class_code):
def login(self,class_mate,id,leader,name,displayname,class_code):
#self.db = db
request = self.environment['request']
session = self.environment['session']
self.class_mate = class_mate
self.id = id
self.leader = leader
self.name = name
self.displayname = displayname
self.class_code = class_code
self.last_visit = request.now

session.who = self

def logoff(self,session):
self.class_mate = None
self.id = None
self.leader = None
self.name = None
self.displayname = None
self.class_code = None
session.who = None

2011/3/22 yutaka kawate 

> thank you
> but
> i am very sorry, i did typing miss.
> actually, i did so.
>
> it looks that system try to pickle response variable.
> i am trying environment['response'] = None
>
> 2011/3/22 Floyd 
>
>> try use self in login(...) method:
>>  def login(self,)
>> request = self.environment['request']
>> session = self.environment['session']
>>
>> Bye,
>> Floyd
>>
>
>


[web2py] processes, threads and performance tuning

2011-03-21 Thread VP
I was trying to tweak various settings in terms of processes and
threads.  This is what I observed.  With web2py's default setting (I
believed 1 process 15 threads), I got about 30 requests/second for my
app.

With 3 processes and 2 threads, I got about 90 requests/second.  This
is 3 times more!!!  Memory usage is similar for the two settings.  Not
much difference.

It seems that more processes is better than more threads.  Is this
right?  Or am I doing something improper?


[web2py] Flourish Conf 2011 (Chicago Area)

2011-03-21 Thread G. Clifford Williams
Anyone planning on attending Flourish Conf '11?
Unfortunately it doesn't look like they have any Python speakers this year but 
apparently there will be tables for both Web2Py and ChiPy

Massimo, who's manning the table?

http://www.flourishconf.com/2011/miniexpo


[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-21 Thread Kevin Ivarsen
In web2py, you could import MySQLdb and make SQL queries directly, but you 
would lose out on a lot of the time-saving features that web2py offers, such 
as automatic form generation for database tables. Instead, you would 
typically use web2py's DAL (Database Abstraction Layer), which provides a 
higher-level interface to your database. For example, if you have a 
"product" table with fields "name", "price", and "quantity", you might 
define it in web2py's DAL like this:

db = DAL("mysql://user:password@host/mydatabase")

db.define_table('product',
Field('name', 'string'),
Field('price', 'double'),
Field('quantity', 'integer')
)

(Note that an "id" field is predefined for you if you don't explicitly 
define one)

And then you could do queries like:

product = db.product(123)  # get product 123, or return None if it does not 
exist
print product.name, product.price

# Update an existing product
product.update_record(price=2.50)

# Insert a new product
db.product.insert(name="Oranges", price=1.23, quanitty=50)  


If you want to take advantage of these features with an existing mysql 
database, you can use the extract_mysql_models script described above to 
read an existing mysql database and generate the corresponding DAL database 
structure.

See chapter 4 of the web2py book for more information about web2py's 
database layer:
http://web2py.com/book/default/chapter/06

Cheers,
Kevin


Re: [web2py] Re: XML manipulation

2011-03-21 Thread Richard Vézina
Yes to much idea to make them all!

R

On Mon, Mar 21, 2011 at 9:09 PM, villas  wrote:

> Hi Richard,
>
> In my case I was making the XML fit a specification given to me by
> someone else. It isn't very flexible to change it,  but I doubt that
> the specification will be changing much either.
>
> It is a pity there isn't a Zen of XML saying there should ideally be
> just one obvious way of doing something. During my hours of research I
> had so many ideas that I had to go and take an aspirin!
>
> -D
>
>
> On Mar 21, 5:25 pm, Richard Vézina 
> wrote:
> > It is not bad for start... But what happen when you change your query in
> > term of number of columns or rows? Do you have to make an other template
> > each time... Personnaly I don't like xml that much, so I don't want to
> have
> > to get back at editing my template all the time.
> >
> > Richard
> >
> > On Mon, Mar 21, 2011 at 1:19 PM, villas  wrote:
> > > Hi Richard
> >
> > > As a novice, the easiest solution I found was something like this:
> >
> > > * create wordml.xml template in views/default/ folder
> > > * prepare the xml, place variables for the data
> > > * create a wordml function in controller
> > > * manipulate your data into the variables in the controller ready to
> > > place in the template
> > > * call the function with url wordml.xls
> >
> > > This is adequate for me,  but may be too simple for your case. Mart
> > > may have something better, but 'simple' is about my limit, and I
> > > already lost almost a day studying other methods :-)
> >
> > > Good luck,  D
> >
> > > On Mar 21, 1:42 pm, Richard Vézina 
> > > wrote:
> > > > Hello Mart,
> >
> > > > I need to generate WordML out of web2py... Is there a "easier" or
> more
> > > > integrated way then use xslt transformation that is the easiest way
> that
> > > > comes to my mind?
> >
> > > > Thanks
> >
> > > > Richard
> >
> > > > On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > > > > I use lots of XML to drive automation, file system structure,
> > > > > validation, user initial input, etc, so pretty much everywhere I
> make
> > > > > use of xml. much of the data (that may be user or project specific)
> is
> > > > > submitted as XML, then use that to populate tables (which BTW - I
> > > > > found lately to be a great way to share data between module
> [something
> > > > > that looks like a properties object]). I also frequently generate
> and/
> > > > > or convert chunks of xml to dictionary objects (wrapper to make a
> > > > > dictionary behave like an object - looks like web2py's storage) so
> I
> > > > > can run through data by doing a.b.c.d (which I find very useful at
> > > > > times). These are some of the ways where I use xml on daily basis.
> >
> > > > > So my use of it in a web2py context goes more towards DAL
> stand-alone
> > > > > than in a 'over the web' context, but you're welcome to anything I
> > > > > have if interested. I have lots of code and can probably make
> samples
> > > > > depending on what you need, - I mostly stick to etree (maybe just a
> > > > > preference), because I like that I can reset .root anywhere i like
> and
> > > > > can easily group similar items).
> >
> > > > > Mart :)
> >
> > > > > On Mar 20, 3:58 pm, villas  wrote:
> > > > > > OK I found a way (it was of course easier than I thought!).
> > > > > > However, if anyone has any interesting XML resources/tips,  I
> would
> > > > > > still be interested to learn more.
> > > > > > Thanks!
> >
> >
>


[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-21 Thread fib
apologies I am a newbie
I believe that this may be what I was searching for as I have an existing 
mySQL db and am struggling getting my head into the web2py

Can I add the mysqldb module in web2py and run this code there and if so - 
how

sorry if this seems too simple


Re: [web2py] Re: XML manipulation

2011-03-21 Thread Richard Vézina
That's a brillant idea...

I check about it tomorrow.

Thanks

Richard

On Mon, Mar 21, 2011 at 5:05 PM, mart  wrote:

> Hi Richard,
>
> Yeah, I hate transforms too :( I haven't really worked with wordml,
> but... it all looks the same to me... I would definitely take the
> dictionary approach, should be fairly simple. If you like i can grap a
> web2py table, convert it to xml (that is how you are getting you
> xml?), then write a quick script to wrap code I already have that
> would probably do the job almost as is (i tend to automate pretty much
> everything work related) so i make things as reusable as possible ...,
> then you can simply drop it in a controller or in /modules (or use as
> is) and re-use any time you like. I'm sure we can get a decent wordml
> reference table on the Net somewhere. Let me know if that's what
> you're looking for and I can probably get it done tonight.
>
> Mart :)
>
> On Mar 21, 1:25 pm, Richard Vézina 
> wrote:
> > It is not bad for start... But what happen when you change your query in
> > term of number of columns or rows? Do you have to make an other template
> > each time... Personnaly I don't like xml that much, so I don't want to
> have
> > to get back at editing my template all the time.
> >
> > Richard
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Mar 21, 2011 at 1:19 PM, villas  wrote:
> > > Hi Richard
> >
> > > As a novice, the easiest solution I found was something like this:
> >
> > > * create wordml.xml template in views/default/ folder
> > > * prepare the xml, place variables for the data
> > > * create a wordml function in controller
> > > * manipulate your data into the variables in the controller ready to
> > > place in the template
> > > * call the function with url wordml.xls
> >
> > > This is adequate for me,  but may be too simple for your case. Mart
> > > may have something better, but 'simple' is about my limit, and I
> > > already lost almost a day studying other methods :-)
> >
> > > Good luck,  D
> >
> > > On Mar 21, 1:42 pm, Richard Vézina 
> > > wrote:
> > > > Hello Mart,
> >
> > > > I need to generate WordML out of web2py... Is there a "easier" or
> more
> > > > integrated way then use xslt transformation that is the easiest way
> that
> > > > comes to my mind?
> >
> > > > Thanks
> >
> > > > Richard
> >
> > > > On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > > > > I use lots of XML to drive automation, file system structure,
> > > > > validation, user initial input, etc, so pretty much everywhere I
> make
> > > > > use of xml. much of the data (that may be user or project specific)
> is
> > > > > submitted as XML, then use that to populate tables (which BTW - I
> > > > > found lately to be a great way to share data between module
> [something
> > > > > that looks like a properties object]). I also frequently generate
> and/
> > > > > or convert chunks of xml to dictionary objects (wrapper to make a
> > > > > dictionary behave like an object - looks like web2py's storage) so
> I
> > > > > can run through data by doing a.b.c.d (which I find very useful at
> > > > > times). These are some of the ways where I use xml on daily basis.
> >
> > > > > So my use of it in a web2py context goes more towards DAL
> stand-alone
> > > > > than in a 'over the web' context, but you're welcome to anything I
> > > > > have if interested. I have lots of code and can probably make
> samples
> > > > > depending on what you need, - I mostly stick to etree (maybe just a
> > > > > preference), because I like that I can reset .root anywhere i like
> and
> > > > > can easily group similar items).
> >
> > > > > Mart :)
> >
> > > > > On Mar 20, 3:58 pm, villas  wrote:
> > > > > > OK I found a way (it was of course easier than I thought!).
> > > > > > However, if anyone has any interesting XML resources/tips,  I
> would
> > > > > > still be interested to learn more.
> > > > > > Thanks!
>


[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-21 Thread fib
apologies I am a newbie
I believe that this may be what I was searching for as I have an existing 
mySQL db and am struggling getting my head into the web2py

Can I add the mysqldb module in web2py and run this code there and if so - 
how

sorry if this seems too simple


[web2py] Re: referencing request, session from module folder

2011-03-21 Thread Floyd
try use self in login(...) method: 
 def login(self,) 
request = self.environment['request'] 
session = self.environment['session'] 

Bye,
Floyd


[web2py] Re: moving from Drupal to Web2py

2011-03-21 Thread villas
Hi pbreit

Take a look at Massimo's csvstudio!!

http://code.google.com/p/csvstudio/



On Mar 21, 6:42 pm, pbreit  wrote:
> How big are the tables? Is Excel a reasonable low-tech option for massaging
> CSV files?


[web2py] Re: Export DB from admin?

2011-03-21 Thread vtp2...@gmail.com
I don't know if it was because I used the old SQLite version (Debian 5), but
SQLite constantly had a database lock problem.  (You can Google this).  And
when there's a database lock problem, you'll have to restart the server
essentially.  Other than that, SQLite is very fast; a lot faster than
postgres.  I'd say if you don't have problem with SQLite locking, I would
not use postgres.

One thing I would advise is do not use "id" as the key because when you
switch database (let's say to insert entries from SQLite into a postgres
db), the ids might no longer be the same.  So if you identify entries using
id's in the old database, the entries might not be the same on the new one.


On Mon, Mar 21, 2011 at 6:58 PM, pbreit  wrote:

> I'd be curious to hear thoughts on that as well. I was contemplating what
> to do when switching from SQLite to Postgres, but I'd also like to undertand
> better what to do in production.


[web2py] Re: Export DB from admin?

2011-03-21 Thread villas
Each DB has its own methods. The integrity and consistency of
relational data is of crucial importance. I would only trust the
approved and recommended backup tool for the DB.

I normally write separate commandline scripts to do the backups which
run from cron during the night. The script also rsyncs a copy to
another server.

I keep a daily backup for an entire month naming the files db_01,
db_02 ... db_31.  Then the next month will overwrite the previous
month.  In my case backups over a month old are pretty useless.

Clearly you will have to analyse your own requirements. Those scripts
can run for years without any maintenance so its worth a little
thought to get them right.


On Mar 21, 11:58 pm, pbreit  wrote:
> I'd be curious to hear thoughts on that as well. I was contemplating what to
> do when switching from SQLite to Postgres, but I'd also like to undertand
> better what to do in production.


Re: [web2py] Re: REST the web2py way - RFC

2011-03-21 Thread Tom Atkins
this may be of interest:

http://stackoverflow.com/questions/5050481/restful-backend-framework-for-backbone-js-and-co


[web2py] Re: XML manipulation

2011-03-21 Thread villas
Hi Richard,

In my case I was making the XML fit a specification given to me by
someone else. It isn't very flexible to change it,  but I doubt that
the specification will be changing much either.

It is a pity there isn't a Zen of XML saying there should ideally be
just one obvious way of doing something. During my hours of research I
had so many ideas that I had to go and take an aspirin!

-D


On Mar 21, 5:25 pm, Richard Vézina 
wrote:
> It is not bad for start... But what happen when you change your query in
> term of number of columns or rows? Do you have to make an other template
> each time... Personnaly I don't like xml that much, so I don't want to have
> to get back at editing my template all the time.
>
> Richard
>
> On Mon, Mar 21, 2011 at 1:19 PM, villas  wrote:
> > Hi Richard
>
> > As a novice, the easiest solution I found was something like this:
>
> > * create wordml.xml template in views/default/ folder
> > * prepare the xml, place variables for the data
> > * create a wordml function in controller
> > * manipulate your data into the variables in the controller ready to
> > place in the template
> > * call the function with url wordml.xls
>
> > This is adequate for me,  but may be too simple for your case. Mart
> > may have something better, but 'simple' is about my limit, and I
> > already lost almost a day studying other methods :-)
>
> > Good luck,  D
>
> > On Mar 21, 1:42 pm, Richard Vézina 
> > wrote:
> > > Hello Mart,
>
> > > I need to generate WordML out of web2py... Is there a "easier" or more
> > > integrated way then use xslt transformation that is the easiest way that
> > > comes to my mind?
>
> > > Thanks
>
> > > Richard
>
> > > On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > > > I use lots of XML to drive automation, file system structure,
> > > > validation, user initial input, etc, so pretty much everywhere I make
> > > > use of xml. much of the data (that may be user or project specific) is
> > > > submitted as XML, then use that to populate tables (which BTW - I
> > > > found lately to be a great way to share data between module [something
> > > > that looks like a properties object]). I also frequently generate and/
> > > > or convert chunks of xml to dictionary objects (wrapper to make a
> > > > dictionary behave like an object - looks like web2py's storage) so I
> > > > can run through data by doing a.b.c.d (which I find very useful at
> > > > times). These are some of the ways where I use xml on daily basis.
>
> > > > So my use of it in a web2py context goes more towards DAL stand-alone
> > > > than in a 'over the web' context, but you're welcome to anything I
> > > > have if interested. I have lots of code and can probably make samples
> > > > depending on what you need, - I mostly stick to etree (maybe just a
> > > > preference), because I like that I can reset .root anywhere i like and
> > > > can easily group similar items).
>
> > > > Mart :)
>
> > > > On Mar 20, 3:58 pm, villas  wrote:
> > > > > OK I found a way (it was of course easier than I thought!).
> > > > > However, if anyone has any interesting XML resources/tips,  I would
> > > > > still be interested to learn more.
> > > > > Thanks!
>
>


[web2py] Re: referencing request, session from module folder

2011-03-21 Thread yutaka kawate
thank you
but
i am very sorry, i did typing miss.
actually, i did so.

it looks that system try to pickle response variable.
i am trying environment['response'] = None

2011/3/22 Floyd 

> try use self in login(...) method:
>  def login(self,)
> request = self.environment['request']
> session = self.environment['session']
>
> Bye,
> Floyd
>


[web2py] referencing request, session from module folder

2011-03-21 Thread kawate
hello ;

i put my module in application/modules folder.
i assumed that session, request is global, but referencing session and
request cause undefined name error.
currently i pass these as parameters, so far it works as i expected.

But teach me how to make global environment available to my module.

I tried,

in models/db.py
who = mymodules.Who(globals())

in mymodule

class Who(object):
def __init__(self,environment): #,session,request):
   self.environment = environment
request = environment['request']
session = environment['session']

.
  def login(..)
request = environment['request']
session = environment['session']


__init__ works OK
but when i call login, i get error as

Traceback (most recent call last):
  File "/Users/kawateyutaka/project3/web2py/gluon/main.py", line 477,
in wsgibase
session._try_store_on_disk(request, response)
  File "/Users/kawateyutaka/project3/web2py/gluon/globals.py", line
401, in _try_store_on_disk
cPickle.dump(dict(self), response.session_file)
TypeError: expected string or Unicode object, NoneType found







Re: [web2py] Re: web2py applications and version control systems

2011-03-21 Thread mattynoce
i'm a n00b when it comes to version control, so i'm wondering if i can ask 
some specific questions. i've RTFM but i'm sure there are things i'm 
missing, so feel free to let me know if my questions are too n00bish. i'm 
using GAE and i'm on a mac, using the web2py source code (not the compiled 
mac app).

first, let's say i have your web2py folder and your apps inside it. i've set 
up mercurial on the web2py folder, and it works great. however, as discussed 
above, it becomes a big problem with upgrading web2py.

so i understand that some of you symlink the files in the web2py folder and 
keep them in /myapp/private. i get that in concept.

but what happens when you actually download the new web2py source code? do 
you download it and then use hg to import it? and do you cp the .yaml files 
out of /private as soon as you import the new web2py file? and how do you 
import the new source without overwriting /myapp -- do you move /myapp 
somewhere else, import web2py and then move it back?

i'd love to hear the actual logistics or see code files if anyone has them. 
i get the concepts of how it works but am having trouble figuring out how to 
handle the nuts and bolts.

thanks,

matt


[web2py] Re: reddit again

2011-03-21 Thread Massimo Di Pierro
By the way ... you may notice that most of the comments are pro-
web2py. The negative comments can always be traced to the same small
group of users.

On Mar 21, 7:13 pm, Massimo Di Pierro 
wrote:
> This morning I posted the facebook clone video on reddit. It was
> popular. It was second for a while in /r/programming. We had 2000+
> views and many positive comments.
>
> That is when some anonymous redditors started attacking us:
>
> http://www.reddit.com/r/programming/comments/g875i/building_a_minimal...http://www.reddit.com/r/Python/comments/g8hnm/why_does_the_web2py_com...
>
> This time they are not attacking me. They are attacking the community
> by making knowingly false statements. It is disgraceful.
>
> I am not sure what to do except that this community must do a better
> job at outreaching. I just invite everybody to remain civil and
> technical in our arguments.
>
> Massimo


[web2py] reddit again

2011-03-21 Thread Massimo Di Pierro
This morning I posted the facebook clone video on reddit. It was
popular. It was second for a while in /r/programming. We had 2000+
views and many positive comments.

That is when some anonymous redditors started attacking us:

http://www.reddit.com/r/programming/comments/g875i/building_a_minimalist_facebook_clone_and/c1lpr9m
http://www.reddit.com/r/Python/comments/g8hnm/why_does_the_web2py_community_seem_like_a_cult/

This time they are not attacking me. They are attacking the community
by making knowingly false statements. It is disgraceful.

I am not sure what to do except that this community must do a better
job at outreaching. I just invite everybody to remain civil and
technical in our arguments.

Massimo



[web2py] Re: the facebook clone video

2011-03-21 Thread pbreit
You have to follow the video pretty closely but you'll see that Massimo sets 
those up as short-cuts. I think they were in the model.

[web2py] Re: Export DB from admin?

2011-03-21 Thread pbreit
I'd be curious to hear thoughts on that as well. I was contemplating what to 
do when switching from SQLite to Postgres, but I'd also like to undertand 
better what to do in production.

[web2py] Re: Proposals for New Tagline

2011-03-21 Thread pbreit
I would say it's not too different from Django and Rails. If you are 
contemplating building any type of database-driven web site/service, Web2py 
is definitely worth your consideration, especially if you are interested in 
ease-of-use.

[web2py] Re: Proposals for New Tagline

2011-03-21 Thread villas
>> And thats the question that I am not able to answer: what is the real target 
>> for Web2py?

There's only one person who initally decided the direction and the
essence of Massimo's vision is expressed in the preface to the book
and it's nice to be familiar with that.

I believe therefore web2py is about lowering barriers and giving small
developers the tools to compete with the bigger guys.

I think we should do everything we can to encourage and make it easy
for new people to try it. Those that try it will generally like it,
and in turn promote it.

* The Small Framework that allows you to think Big!
* Solid as a Rock, Easy as Py!  (ok I changed the spelling of pie for
effect)

IMO those are nice ideas!

-D


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread pbreit
Yeah, I suspect it can be done with routing. This might be a common use case 
(ex: Github, Bitbucket, Twitter) so wondering if it's worth making sure it's 
well-supported?

[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-21 Thread mart
Hey Kevin,

This is sweet! thanks for that!

Mart :)

On Mar 21, 11:53 am, ron_m  wrote:
> Looks great, thanks for the addition. I worked on this a bit when it first
> was added but since I don't use mysql any more in the application I am
> working on and have a high workload I never got any further.


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Tom Atkins
Thanks Jonathan!

What would be the mapping of, say, myapp.com/yoursitename/xyz?


yoursitename would be the first arg
I guess xyz would be the second arg - although it'd be handy if it could be
a controller or function!

Your suggestion solves my problem - I've just added:

functions=['admin', 'about', 'faq', 'accounts', 'etc']

to the dict for the app in routes.py and everything works (so far)!

As you suggest my index function in the default controller now handles the
args for /yoursitename etc just fine.

So all I need to do now is add all black-listed functions to that list of
values as I go along functional but not very elegant.

I was playing with Flask and I have to say its solution to routing is very
nice:

http://flask.pocoo.org/docs/quickstart/#routing

The use of variable names anywhere within the URL structure is very handy.
Anything like this possible in web2py?

On 21 March 2011 22:30, Jonathan Lundell  wrote:

> On Mar 21, 2011, at 2:37 PM, Tom Atkins wrote:
> > I am designing an app with a URL structure like this:
> >
> > myapp.com/yoursitename
> >
> > 'yoursitename' is effectively an argument as there could be many sites
> and users are allowed to create their own sites. But I'd like it to be 'top
> level'.
> >
> > Then within yoursitename there will be URLs like this:
> >
> > myapp.com/yoursitename/dashboard
> > myapp.com/yoursitename/users
> > myapp.com/yoursitename/settings
> >
> > I have a black-list of reserved top level words (e.g. /admin /about /faq
> /account etc) that are not allowed to be chosen.  So the site will have
> controllers to expose pages like:
> >
> > myapp.com/faq
> > myapp.com/about
> >
> > My question is what's the best / most efficient way to serve
> /yoursitename and the associated controllers?
> >
> > (I hope that makes sense!)
>
> What would be the mapping of, say, myapp.com/yoursitename/xyz? As a
> fully-expanded web2py URL? What are the app/controller/functions?
>
> If I understand your requirement correctly, the new router logic will do
> what you want. You'll need to specify a functions list in order to enable
> removal of the default function from the URL. So the expanded URL would be:
>
> myapp.com/yoursitename/users ->
> myapp.com/app/default/index/yoursitename/users, so you'd have
> request.args=['yoursitename', 'users'], and your default function would
> decide what to do with it.
>
> /admin and the like could be functions (like /app/default/admin), in which
> case you'd want to say: functions=['admin', 'about', 'faq', 'accounts',
> 'etc'] in the router control dict, or they can be controllers.


Re: [web2py] Re: Proposals for New Tagline

2011-03-21 Thread AdamF

>
> web2py : A small framework that allow you to think Big ;-)
>
> Richard
>
>
Web2py: solid as rock, easy as pie ;)

I am not a native speaker so sorry if it sounds stupid ;)

Regards
Adam 


[web2py] Re: Proposals for New Tagline

2011-03-21 Thread AdamF

>
> Hi,

 

> >That may be true -- for you.  Web2py should target the market sector 
> >that it wants and try to appeal to that sector. 
>
> And thats the question that I am not able to answer: what is the real 
target for Web2py ?

I believe it deserves separate discussion. And I think it's much more 
important that the tagline itself. 

Anyway please don't underestimate the enterprise interest in Web2py. Even if 
it's not likely that it will be selected as main environment for some large 
scale business applications it still may be used for some side projects, 
internal tools or even as a part of some bigger solution. However when I 
talk about 'enterprise' I don't even think about the corporations itself, I 
am more interested in people. Poor developers that used to work in big 
companies but decided to start up a new one... thats my point: these people 
are very often a founders of new startups. These people are responsible for 
choosing technology. This is a real target.

But thats only my point of view :) I am quite new here and I may have no 
idea whats the real future of Web2py, where the developers want to go in 
next year or two, what target are they interested in... Maybe indeed its 
only me with my mind indoctrinated by over 10 years in corporate world :)

The bottom line is that if anyone would like to discuss how to attract new 
people to Web2py the tagline is IMHO the least important thing... 
documentation, features and web-content (blogs, tutorials, examples etc) is 
the path to go I think.

Cheers
Adam


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Jonathan Lundell
On Mar 21, 2011, at 2:37 PM, Tom Atkins wrote:
> I am designing an app with a URL structure like this:
> 
> myapp.com/yoursitename
> 
> 'yoursitename' is effectively an argument as there could be many sites and 
> users are allowed to create their own sites. But I'd like it to be 'top 
> level'.
> 
> Then within yoursitename there will be URLs like this:
> 
> myapp.com/yoursitename/dashboard
> myapp.com/yoursitename/users
> myapp.com/yoursitename/settings
> 
> I have a black-list of reserved top level words (e.g. /admin /about /faq 
> /account etc) that are not allowed to be chosen.  So the site will have 
> controllers to expose pages like:
> 
> myapp.com/faq
> myapp.com/about
> 
> My question is what's the best / most efficient way to serve /yoursitename 
> and the associated controllers?
> 
> (I hope that makes sense!)

What would be the mapping of, say, myapp.com/yoursitename/xyz? As a 
fully-expanded web2py URL? What are the app/controller/functions?

If I understand your requirement correctly, the new router logic will do what 
you want. You'll need to specify a functions list in order to enable removal of 
the default function from the URL. So the expanded URL would be:

myapp.com/yoursitename/users -> myapp.com/app/default/index/yoursitename/users, 
so you'd have request.args=['yoursitename', 'users'], and your default function 
would decide what to do with it.

/admin and the like could be functions (like /app/default/admin), in which case 
you'd want to say: functions=['admin', 'about', 'faq', 'accounts', 'etc'] in 
the router control dict, or they can be controllers.

Re: [web2py] Re: Proposals for New Tagline

2011-03-21 Thread Richard Vézina
web2py : A small framework that allow you to think Big ;-)

Richard



On Mon, Mar 21, 2011 at 2:46 PM, pbreit  wrote:

> In the non-enterprise world, it's the exact opposite. "Enterprise" implies
> expensive, unpleasant, old, hard to acquire/install/use, bloated, Java/.net,
> etc. I'd be surprised if many enterprises are even considering Django.


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Tom Atkins
Thanks for the reply - I've considered the subdomain option but don't want
to use it in this case.  This article:

http://warpspire.com/posts/url-design/

was previously linked on the forum
and summarises very well the reasons I'm keen to go for a URL structure as
proposed.

On 21 March 2011 22:08, David Warnock  wrote:

> Tom,
>
>
>>
> An alternative might be to use subdomains eg
>
> yoursitename.myapp.com
> yoursitename.myapp.com/dashboard
> yoursitename.myapp.com/users
>
> I am looking at this for deployment on google app engine (and have not yet
> looked at web2py support for it). My understanding is that google app engine
> can automatically use the subdomain to restrict the view of the data so that
> if I am logged into a.myapp,com I won't be able to access the data for
> b.myapp.com
>
> Sub domains give you nice scaling options in the future such as separate
> servers for each domain.
>
> What I can't help you with (because I am a web2py newbie) is how to make
> this work within web2py.
>
> Hope this helps
>
> Dave
>
> --
> Dave Warnock: http://42.blogs.warnock.me.uk
> Cycling Blog: http://42bikes.warnock.me.uk
>
>


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread David Warnock
Tom,

I am designing an app with a URL structure like this:
>
> myapp.com/yoursitename
>
> 'yoursitename' is effectively an argument as there could be many sites and
> users are allowed to create their own sites. But I'd like it to be 'top
> level'.
>

An alternative might be to use subdomains eg

yoursitename.myapp.com
yoursitename.myapp.com/dashboard
yoursitename.myapp.com/users

I am looking at this for deployment on google app engine (and have not yet
looked at web2py support for it). My understanding is that google app engine
can automatically use the subdomain to restrict the view of the data so that
if I am logged into a.myapp,com I won't be able to access the data for
b.myapp.com

Sub domains give you nice scaling options in the future such as separate
servers for each domain.

What I can't help you with (because I am a web2py newbie) is how to make
this work within web2py.

Hope this helps

Dave

-- 
Dave Warnock: http://42.blogs.warnock.me.uk
Cycling Blog: http://42bikes.warnock.me.uk


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Tom Atkins
Just to  clarify - each 'yoursitename' is part of the same app - it could be
'youusername' or 'yourorganisation' depending on the app.  e.g. see github's
url structure:

https://github.com/isotoma/ 

isotoma is the 'username' or
'yoursitename' - it's top level but user chosen.  They also have reserved
URLs like:

https://github.com/plans

On 21 March 2011 21:51, VP  wrote:

> I think each "yoursitename" should be a different app.  I think it's
> most efficient that way.
>
>
> On Mar 21, 4:37 pm, Tom Atkins  wrote:
> > I am designing an app with a URL structure like this:
> >
> > myapp.com/yoursitename
> >
> > 'yoursitename' is effectively an argument as there could be many sites
> and
> > users are allowed to create their own sites. But I'd like it to be 'top
> > level'.
> >
> > Then within yoursitename there will be URLs like this:
> >
> > myapp.com/yoursitename/dashboard
> > myapp.com/yoursitename/users
> > myapp.com/yoursitename/settings
> >
> > I have a black-list of reserved top level words (e.g. /admin /about /faq
> > /account etc) that are not allowed to be chosen.  So the site will have
> > controllers to expose pages like:
> >
> > myapp.com/faq
> > myapp.com/about
> >
> > My question is what's the best / most efficient way to serve
> /yoursitename
> > and the associated controllers?
> >
> > (I hope that makes sense!)
>


[web2py] Re: Export DB from admin?

2011-03-21 Thread VP
Is  export_to_csv a preferred way of backup up database?


On Mar 21, 1:58 pm, Anthony  wrote:
> You can use export_to_csv_file, but I don't think you can do it from 
> admin:http://web2py.com/book/default/chapter/06#CSV-(all-tables-at-once)
>
> Anthony


[web2py] Re: new URL router use cases

2011-03-21 Thread VP
I think each "yoursitename" should be a different app.  I think it's
most efficient that way.


On Mar 21, 4:37 pm, Tom Atkins  wrote:
> I am designing an app with a URL structure like this:
>
> myapp.com/yoursitename
>
> 'yoursitename' is effectively an argument as there could be many sites and
> users are allowed to create their own sites. But I'd like it to be 'top
> level'.
>
> Then within yoursitename there will be URLs like this:
>
> myapp.com/yoursitename/dashboard
> myapp.com/yoursitename/users
> myapp.com/yoursitename/settings
>
> I have a black-list of reserved top level words (e.g. /admin /about /faq
> /account etc) that are not allowed to be chosen.  So the site will have
> controllers to expose pages like:
>
> myapp.com/faq
> myapp.com/about
>
> My question is what's the best / most efficient way to serve /yoursitename
> and the associated controllers?
>
> (I hope that makes sense!)


Re: [web2py] Re: new URL router use cases

2011-03-21 Thread Tom Atkins
I am designing an app with a URL structure like this:

myapp.com/yoursitename

'yoursitename' is effectively an argument as there could be many sites and
users are allowed to create their own sites. But I'd like it to be 'top
level'.

Then within yoursitename there will be URLs like this:

myapp.com/yoursitename/dashboard
myapp.com/yoursitename/users
myapp.com/yoursitename/settings

I have a black-list of reserved top level words (e.g. /admin /about /faq
/account etc) that are not allowed to be chosen.  So the site will have
controllers to expose pages like:

myapp.com/faq
myapp.com/about

My question is what's the best / most efficient way to serve /yoursitename
and the associated controllers?

(I hope that makes sense!)


[web2py] can web2py "internal webserver" handle serveral requests in parallel?

2011-03-21 Thread olivier
I plan to use web2py as a simple desktop app service (using the
packaged web2py for windows).
Will the web server (I don't know which server ships in the stand
alone version) handle several requests in parallel if I use ajax calls
to several controller functions?

I am wondering if this could be an easy way to launch different
webcrawls from a page - by hitting a controller function with
differents parameters - and easily scale the app by leveraging the
multiprocess/multithread aspect of the web server. Am I assuming
something wrong here?

Thanks!



[web2py] Re: jquery mobile

2011-03-21 Thread howesc
sorry if this sends you on a wild-goose chase,  i don't have an of those 
fancy i-devices myself (iphone, ipod, ipad) but i'm working on a project 
that does and those developers use http://www.charlesproxy.com/ and route 
their traffic through it to see request/response info.  So, once you are 
sure the site works for regular browsers, perhaps hook that up to your 
iphone and see what is going on.

off the cuff - does jquery mobile detect the i-devices as mobile browsers or 
full web browsers?

cfh


[web2py] Re: the facebook clone video

2011-03-21 Thread LightOfMooN
hmm.. Is it a some new syntax or just abstraction for presentation?

For example:
user = User(a0 or me) ?
friends = db(User.id==Link.source)(Link.target==me).select()

and many others


[web2py] Re: XML manipulation

2011-03-21 Thread mart
Hi Richard,

Yeah, I hate transforms too :( I haven't really worked with wordml,
but... it all looks the same to me... I would definitely take the
dictionary approach, should be fairly simple. If you like i can grap a
web2py table, convert it to xml (that is how you are getting you
xml?), then write a quick script to wrap code I already have that
would probably do the job almost as is (i tend to automate pretty much
everything work related) so i make things as reusable as possible ...,
then you can simply drop it in a controller or in /modules (or use as
is) and re-use any time you like. I'm sure we can get a decent wordml
reference table on the Net somewhere. Let me know if that's what
you're looking for and I can probably get it done tonight.

Mart :)

On Mar 21, 1:25 pm, Richard Vézina 
wrote:
> It is not bad for start... But what happen when you change your query in
> term of number of columns or rows? Do you have to make an other template
> each time... Personnaly I don't like xml that much, so I don't want to have
> to get back at editing my template all the time.
>
> Richard
>
>
>
>
>
>
>
> On Mon, Mar 21, 2011 at 1:19 PM, villas  wrote:
> > Hi Richard
>
> > As a novice, the easiest solution I found was something like this:
>
> > * create wordml.xml template in views/default/ folder
> > * prepare the xml, place variables for the data
> > * create a wordml function in controller
> > * manipulate your data into the variables in the controller ready to
> > place in the template
> > * call the function with url wordml.xls
>
> > This is adequate for me,  but may be too simple for your case. Mart
> > may have something better, but 'simple' is about my limit, and I
> > already lost almost a day studying other methods :-)
>
> > Good luck,  D
>
> > On Mar 21, 1:42 pm, Richard Vézina 
> > wrote:
> > > Hello Mart,
>
> > > I need to generate WordML out of web2py... Is there a "easier" or more
> > > integrated way then use xslt transformation that is the easiest way that
> > > comes to my mind?
>
> > > Thanks
>
> > > Richard
>
> > > On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > > > I use lots of XML to drive automation, file system structure,
> > > > validation, user initial input, etc, so pretty much everywhere I make
> > > > use of xml. much of the data (that may be user or project specific) is
> > > > submitted as XML, then use that to populate tables (which BTW - I
> > > > found lately to be a great way to share data between module [something
> > > > that looks like a properties object]). I also frequently generate and/
> > > > or convert chunks of xml to dictionary objects (wrapper to make a
> > > > dictionary behave like an object - looks like web2py's storage) so I
> > > > can run through data by doing a.b.c.d (which I find very useful at
> > > > times). These are some of the ways where I use xml on daily basis.
>
> > > > So my use of it in a web2py context goes more towards DAL stand-alone
> > > > than in a 'over the web' context, but you're welcome to anything I
> > > > have if interested. I have lots of code and can probably make samples
> > > > depending on what you need, - I mostly stick to etree (maybe just a
> > > > preference), because I like that I can reset .root anywhere i like and
> > > > can easily group similar items).
>
> > > > Mart :)
>
> > > > On Mar 20, 3:58 pm, villas  wrote:
> > > > > OK I found a way (it was of course easier than I thought!).
> > > > > However, if anyone has any interesting XML resources/tips,  I would
> > > > > still be interested to learn more.
> > > > > Thanks!


[web2py] Re: moving from Drupal to Web2py

2011-03-21 Thread VP
Thanks.  I'm wondering if this script preserves foreign key
constraints (e.g. node & comments).

I have several hundred users and about 10,000 nodes.

On Mar 21, 4:48 am, Anthony  wrote:
> Have you 
> seenhttp://code.google.com/p/web2py/source/browse/scripts/extract_mysql_m...
> ?
>
> On Monday, March 21, 2011 3:00:56 AM UTC-4, VP wrote:
> > I have a Drupal app, which is quite bloated.  I'm estimating if it's
> > cost efficient to convert this app to web2py.  Essentially, I'm most
> > interested in moving the users and nodes/comments from Drupal to
> > web2py.   As long as these are consistent, I can cook up the rest.
>
> > What would you suggest?  What would be the best ways to extract
> > information from tables of a MySQL database and place them into
> > similar-in-content, but structurally different models in web2py?
>
> > Thanks.


[web2py] Re: the facebook clone video

2011-03-21 Thread Massimo Di Pierro
Not yet sorry. But I will release it eventually.

Massimo

On Mar 21, 12:55 pm, sipiatti  wrote:
> Hi Massimo,
>
> another nice video! :) I am amazed of this reader robot
> and your sytem to use it for making such videos.
> I would like to use it to make python tutorials in a
> school for python programmig faculty -- if possible.
> Can you tell me what is it, is it open source or free to use?
>
> Thanks
> sipiatti
>
> On márc. 21, 15:19, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> >http://blip.tv/file/4912976


[web2py] Re: Export DB from admin?

2011-03-21 Thread Anthony
You can use export_to_csv_file, but I don't think you can do it from admin: 
http://web2py.com/book/default/chapter/06#CSV-(all-tables-at-once)
 
Anthony


[web2py] Export DB from admin?

2011-03-21 Thread pbreit
Can I export and import my whole DB in admin or do I need to do it 
table-by-table?

[web2py] Re: Proposals for New Tagline

2011-03-21 Thread pbreit
In the non-enterprise world, it's the exact opposite. "Enterprise" implies 
expensive, unpleasant, old, hard to acquire/install/use, bloated, Java/.net, 
etc. I'd be surprised if many enterprises are even considering Django.

[web2py] Re: moving from Drupal to Web2py

2011-03-21 Thread pbreit
How big are the tables? Is Excel a reasonable low-tech option for massaging 
CSV files?

[web2py] Re: moving from Drupal to Web2py

2011-03-21 Thread geoff golder
You would have to write your own migration.  There are pretty good
snipptets and modules around for getting data out of Drupal; but you
are going to have to create your own table structure to handle nodes
and comments.  Users should go pretty smoothly; depending on how much
'profile' information you have in your drupal site.


On Mar 21, 3:00 am, VP  wrote:
> I have a Drupal app, which is quite bloated.  I'm estimating if it's
> cost efficient to convert this app to web2py.  Essentially, I'm most
> interested in moving the users and nodes/comments from Drupal to
> web2py.   As long as these are consistent, I can cook up the rest.
>
> What would you suggest?  What would be the best ways to extract
> information from tables of a MySQL database and place them into
> similar-in-content, but structurally different models in web2py?
>
> Thanks.


[web2py] problem checkbox widgets

2011-03-21 Thread Martín Mulone
I think is not working. Anybody is using it with multiple=true?.

I make a fix.

def widget_checkbox(self, field, value, **attributes):
"""
generates a TABLE tag, including INPUT checkboxes (multiple allowed)

see also: :meth:`FormWidget.widget`
"""

from gluon.sqlhtml import OptionsWidget

# was values = re.compile('[\w\-:]+').findall(str(value))
values = not isinstance(value,(list,tuple)) and [value] or value

attr = OptionsWidget._attributes(field, {}, **attributes)

requires = field.requires
if not isinstance(requires, (list, tuple)):
requires = [requires]
if requires:
if hasattr(requires[0], 'options'):
options = requires[0].options()
else:
raise SyntaxError, 'widget cannot determine options of %s' \
% field

options = [(k, v) for k, v in options if k!='']
opts = []
cols = attributes.get('cols',1)
totals = len(options)
mods = totals%cols
rows = totals/cols
if mods:
rows += 1

for r_index in range(rows):
tds = []
for k, v in options[r_index*cols:(r_index+1)*cols]:
#print "k: %s"%k
#print "v: %s"%v
#print "values: %s"%values
if int(k) in values:
r_value = k
else:
r_value = []
#print "r_value: %s"%r_value
tds.append(TD(INPUT(_type='checkbox', _name=field.name,
 requires=attr.get('requires',None),
 hideerror=True, _value=k,
 value=r_value
 ), v))
opts.append(TR(tds))

if opts:
opts[-1][0][0]['hideerror'] = False
return TABLE(*opts, **attr)



-- 
Pablo Martín Mulone (mar...@tecnodoc.com.ar)
http://www.tecnodoc.com.ar/

My blog: http://martin.tecnodoc.com.ar
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6


[web2py] Re: the facebook clone video

2011-03-21 Thread sipiatti
Hi Massimo,

another nice video! :) I am amazed of this reader robot
and your sytem to use it for making such videos.
I would like to use it to make python tutorials in a
school for python programmig faculty -- if possible.
Can you tell me what is it, is it open source or free to use?

Thanks
sipiatti

On márc. 21, 15:19, Massimo Di Pierro 
wrote:
> http://blip.tv/file/4912976


[web2py] Re: Proposals for New Tagline

2011-03-21 Thread villas
Hi Adam,

That may be true -- for you.  Web2py should target the market sector
that it wants and try to appeal to that sector.

Should web2py target an enterprise developer who has already chosen
his software strategy and often has huge investments in existing
vertical market systems and sometimes hasn't even heard of Python
(yes, really!!)?

For each one of those,  there are a hundred if not a thousand small
developers who really need a simple, all-in-one framework to make
themselves productive.

I am in the second camp and know there are so many others like me.
Whenever I see the word 'enterprise' I end up dreaming about an
encapsulated, inheriting, object-orientated armageddon and wake up
screaming.  But that's just me :)

-D


On Mar 21, 1:23 pm, AdamF  wrote:
> Hi,
>
> I've read all the discussion about the tagline... and unfortunately I cannot
> agree with most of the votes. But maybe it's because I am coming from
> enterprise world and I have a different perspective...
>
> For me if you put enterprise in the tagline that means only a few things;
> it's a mature, production-ready, stable and high quality, proven software.
> Thats because enterprise companies avoid investing in betas or experimental
> solutions - they do prefer a stable, proven software even if it's not so
> cheap.
>
> So if you want to attract developers like me - people with enterprise
> experience - leave this word in tagline. Otherwise they will choose Django
> only because it's more popular...
>
> Personally I would think about tagline that shows 3 points: enterprise
> quality and stability, agile development, fast learning
>
> Regards
>
> Adam


Re: [web2py] Re: XML manipulation

2011-03-21 Thread Richard Vézina
It is not bad for start... But what happen when you change your query in
term of number of columns or rows? Do you have to make an other template
each time... Personnaly I don't like xml that much, so I don't want to have
to get back at editing my template all the time.

Richard

On Mon, Mar 21, 2011 at 1:19 PM, villas  wrote:

> Hi Richard
>
> As a novice, the easiest solution I found was something like this:
>
> * create wordml.xml template in views/default/ folder
> * prepare the xml, place variables for the data
> * create a wordml function in controller
> * manipulate your data into the variables in the controller ready to
> place in the template
> * call the function with url wordml.xls
>
> This is adequate for me,  but may be too simple for your case. Mart
> may have something better, but 'simple' is about my limit, and I
> already lost almost a day studying other methods :-)
>
> Good luck,  D
>
> On Mar 21, 1:42 pm, Richard Vézina 
> wrote:
> > Hello Mart,
> >
> > I need to generate WordML out of web2py... Is there a "easier" or more
> > integrated way then use xslt transformation that is the easiest way that
> > comes to my mind?
> >
> > Thanks
> >
> > Richard
> >
> > On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > > I use lots of XML to drive automation, file system structure,
> > > validation, user initial input, etc, so pretty much everywhere I make
> > > use of xml. much of the data (that may be user or project specific) is
> > > submitted as XML, then use that to populate tables (which BTW - I
> > > found lately to be a great way to share data between module [something
> > > that looks like a properties object]). I also frequently generate and/
> > > or convert chunks of xml to dictionary objects (wrapper to make a
> > > dictionary behave like an object - looks like web2py's storage) so I
> > > can run through data by doing a.b.c.d (which I find very useful at
> > > times). These are some of the ways where I use xml on daily basis.
> >
> > > So my use of it in a web2py context goes more towards DAL stand-alone
> > > than in a 'over the web' context, but you're welcome to anything I
> > > have if interested. I have lots of code and can probably make samples
> > > depending on what you need, - I mostly stick to etree (maybe just a
> > > preference), because I like that I can reset .root anywhere i like and
> > > can easily group similar items).
> >
> > > Mart :)
> >
> > > On Mar 20, 3:58 pm, villas  wrote:
> > > > OK I found a way (it was of course easier than I thought!).
> > > > However, if anyone has any interesting XML resources/tips,  I would
> > > > still be interested to learn more.
> > > > Thanks!
> >
> >
>


[web2py] Re: XML manipulation

2011-03-21 Thread villas
Hi Richard

As a novice, the easiest solution I found was something like this:

* create wordml.xml template in views/default/ folder
* prepare the xml, place variables for the data
* create a wordml function in controller
* manipulate your data into the variables in the controller ready to
place in the template
* call the function with url wordml.xls

This is adequate for me,  but may be too simple for your case. Mart
may have something better, but 'simple' is about my limit, and I
already lost almost a day studying other methods :-)

Good luck,  D

On Mar 21, 1:42 pm, Richard Vézina 
wrote:
> Hello Mart,
>
> I need to generate WordML out of web2py... Is there a "easier" or more
> integrated way then use xslt transformation that is the easiest way that
> comes to my mind?
>
> Thanks
>
> Richard
>
> On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:
> > I use lots of XML to drive automation, file system structure,
> > validation, user initial input, etc, so pretty much everywhere I make
> > use of xml. much of the data (that may be user or project specific) is
> > submitted as XML, then use that to populate tables (which BTW - I
> > found lately to be a great way to share data between module [something
> > that looks like a properties object]). I also frequently generate and/
> > or convert chunks of xml to dictionary objects (wrapper to make a
> > dictionary behave like an object - looks like web2py's storage) so I
> > can run through data by doing a.b.c.d (which I find very useful at
> > times). These are some of the ways where I use xml on daily basis.
>
> > So my use of it in a web2py context goes more towards DAL stand-alone
> > than in a 'over the web' context, but you're welcome to anything I
> > have if interested. I have lots of code and can probably make samples
> > depending on what you need, - I mostly stick to etree (maybe just a
> > preference), because I like that I can reset .root anywhere i like and
> > can easily group similar items).
>
> > Mart :)
>
> > On Mar 20, 3:58 pm, villas  wrote:
> > > OK I found a way (it was of course easier than I thought!).
> > > However, if anyone has any interesting XML resources/tips,  I would
> > > still be interested to learn more.
> > > Thanks!
>
>


Re: [web2py] Re: Proposals for New Tagline

2011-03-21 Thread Richard Vézina
And what about :

Web2py : The framework that solves the business needs

Richard

On Mon, Mar 21, 2011 at 9:36 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> That is what I always assumed.
>
> On Mar 21, 8:23 am, AdamF  wrote:
> > Hi,
> >
> > I've read all the discussion about the tagline... and unfortunately I
> cannot
> > agree with most of the votes. But maybe it's because I am coming from
> > enterprise world and I have a different perspective...
> >
> > For me if you put enterprise in the tagline that means only a few things;
> > it's a mature, production-ready, stable and high quality, proven
> software.
> > Thats because enterprise companies avoid investing in betas or
> experimental
> > solutions - they do prefer a stable, proven software even if it's not so
> > cheap.
> >
> > So if you want to attract developers like me - people with enterprise
> > experience - leave this word in tagline. Otherwise they will choose
> Django
> > only because it's more popular...
> >
> > Personally I would think about tagline that shows 3 points: enterprise
> > quality and stability, agile development, fast learning
> >
> > Regards
> >
> > Adam
>


[web2py] Re: Table already exists

2011-03-21 Thread villas
There are two aspects to this:  the actual DB tables and the web2py
mapping to the DB.  The latter are stored in the .tables files in the
database folder.

To keep the two in step,  web2py automatically migrates the DB and
updates the mapping from the models. To turn off that functionality
(for production systems),  each table's model can be set
migrate=False.

In your case, where the tables existing in the DB but the mapping is
not up to date, you may set another attribute fake_migrate=True.
Web2py will then update the mapping, but leave the DB unaffected --
which seems to be what you want.

This information is available in the DAL chapter of the book.

Regards, D

On Mar 21, 2:24 pm, LarryEitel  wrote:
> Thank you for the explanation and suggestion. My foray into web2py is
> bearing fruit!


[web2py] Re: jquery mobile

2011-03-21 Thread Anthony
What exactly is the behavior you see? When you go to 
http://yoursite.appspot.com/init/default/index, what happens?
 
What is the exact content of your index.html file? Does it extend any layout 
file (if so, what does that look like)?
 
Have you confirmed that your web2py installation is generally working on 
GAE? For example, can you successfully run the 'welcome' app (or any app)?
 

On Monday, March 21, 2011 12:55:18 PM UTC-4, ChrisM wrote:

> Thanks, i downloaded latest web2py , created new app "init" 
> And the view is Just a hello world with links to jquery and jqmobile 
> plus the 
> Css files, this html demo taken from the lists demo on the jq mobile 
> demo site and renamed to 
> Init/default/views/index.html 
> Have tried with  links to the jquery files both locally and from jq 
> website 
> As per online demo. 
> The controller is just blank 
> def index() 
>  return dict() 
> I thought it would just work as per online tutorials on jq mobile, so 
> i 
> Was concerned that its the web2py setup overriding something. 
> Chrism 
>
> On Mar 21, 3:11 pm, Anthony  wrote: 
> > Can you provide more information? What does your web2py controller and 
> view 
> > code look like?



[web2py] Re: jquery mobile

2011-03-21 Thread ChrisM
Thanks, i downloaded latest web2py , created new app "init"
And the view is Just a hello world with links to jquery and jqmobile
plus the
Css files, this html demo taken from the lists demo on the jq mobile
demo site and renamed to
Init/default/views/index.html
Have tried with  links to the jquery files both locally and from jq
website
As per online demo.
The controller is just blank
def index()
 return dict()
I thought it would just work as per online tutorials on jq mobile, so
i
Was concerned that its the web2py setup overriding something.
Chrism

On Mar 21, 3:11 pm, Anthony  wrote:
> Can you provide more information? What does your web2py controller and view
> code look like?


Re: [web2py] strange lost password behavior

2011-03-21 Thread rif


ok, the validation was because the email was not registered, with a valid email 
I get this:

Traceback (most recent call last):
  File "/Users/alex/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
  File "/Users/alex/web2py/applications/mcsa/controllers/default.py", line 160, 
in 
  File "/Users/alex/web2py/gluon/globals.py", line 124, in 
self._caller = lambda f: f()
  File "/Users/alex/web2py/applications/mcsa/controllers/default.py", line 139, 
in user
return dict(form=auth())
  File "/Users/alex/web2py/gluon/tools.py", line 1048, in __call__
return self.request_reset_password()
  File "/Users/alex/web2py/gluon/tools.py", line 2035, in request_reset_password
dict(key=reset_password_key)):
  File "/Users/alex/web2py/gluon/tools.py", line 582, in send
logger.warn('Mail.send failure:%s' % e)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 1033, in warning
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 1129, in _log
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 1139, in handle
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 1176, in callHandlers
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 662, in handle
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 770, in emit
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/logging/__init__.py",
 line 713, in handleError
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/traceback.py",
 line 124, in print_exception
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/traceback.py",
 line 13, in _print
IOError: [Errno 5] Input/output error

It is running on a mac server Python 2.6.1



Re: [web2py] strange lost password behavior

2011-03-21 Thread rif
1.94.5 the latest.




[web2py] Re: Converting legacy MySQL databases to web2py DAL

2011-03-21 Thread ron_m
Looks great, thanks for the addition. I worked on this a bit when it first 
was added but since I don't use mysql any more in the application I am 
working on and have a high workload I never got any further.


Re: [web2py] strange lost password behavior

2011-03-21 Thread Marin Pranjic
Which version of web2py are you using?

On Mon, Mar 21, 2011 at 3:56 PM, rif  wrote:

> Hi guys,
>
> Is the default lost password working for you?
>
> In my deploy I always get an Invalid email validation warning.
>


Re: [web2py] Re: setup.py to install web2py globally into the python env/virtualenv

2011-03-21 Thread Praneeth Bodduluri
Massimo,

Submitted at:
https://code.google.com/p/web2py/issues/detail?id=220

--
Praneeth
IRC: lifeeth



On Mon, Mar 21, 2011 at 9:59 AM, Massimo Di Pierro
 wrote:
> This is great! Monday and Tuesday are busy days for me but I will
> check this asap. Please open a web2py issue on google code to make
> sure this is tracked.
>
> Massimo
>
> On Mar 20, 4:34 pm, Praneeth Bodduluri  wrote:
>> Hello all,
>>
>> In an attempt to make web2py pip installable, so that I can use gluon
>> as a module in other python programs, I created a setup.py that can be
>> used to create a source dist for PyPI. Attached are the files that
>> need to be placed in the web2py root directory.
>>
>> To create the source distribution:
>>
>> python setup.py sdist
>>
>> To install from the source distribution (After running the above
>> command and using the sdist that it creates):
>>
>> python setup.py install
>>
>> After installing in your python env or virtualenv:
>>
>> To create a new web2py application directory:
>>
>> mkweb2pyenv path_to_project_dir
>>
>> To run web2py from a directory:
>>
>> runweb2py path_to_project_dir
>>
>> I hope this makes its way to web2py Trunk. A clone with the files
>> included can be found at :https://code.google.com/r/lifeeth-pip
>>
>> I made a video of running an instance for those who like to watch:
>>
>> https://www.youtube.com/watch?v=f6cFkK2ZDPY
>>
>> --
>> Praneeth
>> IRC: lifeeth
>>
>>  new_files.tar.bz2
>> 2KViewDownload


[web2py] Re: django toolbar

2011-03-21 Thread Massimo Di Pierro
The queries are not currently collected.

On Mar 21, 9:52 am, Tom Atkins  wrote:
> This looks great.  Do you mean this Django toolbar:
>
> http://rob.cogit8.org/blog/2008/Sep/19/introducing-django-debug-toolbar/
>
> If
> so I'd be very interested in "SQL queries showing the number of queries run
> during response creation and how long was spent on all queries, plus each
> query statement, and the time each statement took."
>
> I have a plugin I use with WordPress that does this and it's incredibly
> useful for spotting how to make your app faster.  Is this data currently
> collected? Any way to see it easily before the launch of the toolbar?
>
> On 20 March 2011 22:00, Massimo Di Pierro wrote:
>
>
>
>
>
>
>
> > I remember a post about porting the Django toolbar in web2py
>
> > Using trunk and running with
>
> > web2py.py -F profiler.log
>
> > all the information that the Django toolbar displays and more is in
>
> > httpserver.log
> > profiler.log (accessible via /admin/toolbar/profiler)
> > /app/appadmin/ccache
> > {{=BEAUTIFY(request)}}
> > {{=BEAUTIFY(response)}}
>
> > The info is there but lives in different places.
> > It is possible to aggregate it in one toolbar.
> > I am open to suggestion about how to do it.


[web2py] Re: jquery mobile

2011-03-21 Thread Anthony
Can you provide more information? What does your web2py controller and view 
code look like?

[web2py] strange lost password behavior

2011-03-21 Thread rif
Hi guys,

Is the default lost password working for you?

In my deploy I always get an Invalid email validation warning.


Re: [web2py] django toolbar

2011-03-21 Thread Tom Atkins
This looks great.  Do you mean this Django toolbar:

http://rob.cogit8.org/blog/2008/Sep/19/introducing-django-debug-toolbar/

If
so I'd be very interested in "SQL queries showing the number of queries run
during response creation and how long was spent on all queries, plus each
query statement, and the time each statement took."

I have a plugin I use with WordPress that does this and it's incredibly
useful for spotting how to make your app faster.  Is this data currently
collected? Any way to see it easily before the launch of the toolbar?

On 20 March 2011 22:00, Massimo Di Pierro wrote:

> I remember a post about porting the Django toolbar in web2py
>
> Using trunk and running with
>
> web2py.py -F profiler.log
>
> all the information that the Django toolbar displays and more is in
>
> httpserver.log
> profiler.log (accessible via /admin/toolbar/profiler)
> /app/appadmin/ccache
> {{=BEAUTIFY(request)}}
> {{=BEAUTIFY(response)}}
>
> The info is there but lives in different places.
> It is possible to aggregate it in one toolbar.
> I am open to suggestion about how to do it.
>
>
>


[web2py] Re: Stumped on error: The "end" tag is unmatched, please check if you have a starting "block" tag

2011-03-21 Thread Neodudeman
Thanks for your help! Was able to solve this.
Turns out that I was editing the wrong, but similar, view file.
Changing the variable from {{end = len(list)}} to {{right =
len(list)}} worked!

Thanks again.

On Mar 20, 9:45 pm, Massimo Di Pierro 
wrote:
> I think this is creating the problem: {{end = len(list)}}
>
> This is to be considered in a bug in the template parser. I think I
> have fixed it in trunk (please check it).
>
> Meanwhile if you choose to stable, you can remove the spaces
> {{end=len(list)}} and the problem should go away.
>
> Massimo
>
> On Mar 20, 8:05 pm, Neodudeman  wrote:
>
> > I searched my entire file for anything with the word 'end'
>
> > Closest things were {{end = len(list)}} and  both of which
> > I've changed, and I've still got the error.
>
> > On Mar 20, 10:22 am, Massimo Di Pierro 
> > wrote:
>
> > > Do you have something like {{end}} in your view?
>
> > > The old template parse was more forgiving when it comes to invalid
> > > templates and did not support blocks.
>
> > > On Mar 20, 9:11 am, Neodudeman  wrote:
>
> > > > Hey guys, I'm stumped on this error that I'm getting.
>
> > > > I recently upgraded from Web2py 1.79 to 1.93, and when viewing a
> > > > certain, important, relatively complicated view file, I get this
> > > > error.
>
> > > > [The "end" tag is unmatched, please check if you have a starting
> > > > "block" tag]
>
> > > > And I can't, for the life of me, figure it out. The admin panel just
> > > > returns that the Socket Timed Out, in the rocket.py.
>
> > > > Could someone point me in the right direction, or maybe shed some
> > > > light on exactly what "end" tag it's talking about?


[web2py] Re: Table already exists

2011-03-21 Thread LarryEitel
Thank you for the explanation and suggestion. My foray into web2py is
bearing fruit!


Re: [web2py] Menu based on Boolean table fields.

2011-03-21 Thread Martín Mulone
Take a look to this code.

#list slices who own
def my_slices():

user_id = session.auth.user.id
slices = db(db.slices.user_id == user_id).select(db.slices.id,
 db.slices.title)
myslices = [
(T('Add slice'), False, A(T('Add slice'), \
  _title=T("Upload a slice"), \
  _href=URL('default','upload')))

]
if slices:
for slice in slices:
myslices.append(('%s'%slice.title, False, A('%s'%slice.title, \
  _title=T("Edit a slice"), \
  _href=URL('default','edit',args=[
slice.id]


return myslices


response.menu = [
(T('My slices'), False, A(T('My slices'),_href='javascript: void(0);'),
 my_slices())
]

2011/3/21 annet 

> In db.py I defined the following table:
>
> db.define_table('cardfunction',
>
> Field('company_id',db.company,default='',notnull=True,unique=True),
>Field('home',type='boolean',default=True),
>Field('logo',type='boolean',default=False),
>Field('tagline',type='boolean',default=False),
>Field('image',type='boolean',default=False),
>Field('css',type='boolean',default=False),
>Field('customcss',type='boolean',default=False),
>Field('keywords',type='boolean',default=False),
>migrate=False)
>
> Based on this table I would like to generate a menu. In a controller I
> got the following code:
>
> if not session.id or session.id!=auth.user.bedrijf_id:
>session.id=auth.user.bedrijf_id
>
> session.row=db(db.cardfunction.bedrijf_id==session.id
> ).select(db.cardfunction.ALL)
>session.card_menu=[
> ['Home',request.function=='index',URL(r=request,f='index')],
>['Logo',request.function=='logo',URL(r=request,f='logo')],
>...
>
> ['Keywords',request.function=='keywords',URL(r=request,f='keywords')]]
>
>
> In the view I would like to generate a menu, in which, if the
> session.row.field value is true a link is being rendered and if
> session.row.field is false a  element is being rendered. What
> I had in mind:
>
> 
>  {{for _name,_active,_link in session.card_menu:}}
>{{if session.row.home:}}
>  
> href="{{=_link}}">{{=_name}}
>  
>{{else:}}
>  
>{{=_name}}
>  
>{{pass}}
>  
>  {{pass}}
> 
>
> ... doesn't work. Besides, if session.row.home: seven times, once for
> every field isn't a very elegant solution either. I hope one of you
> can provide me with a solution.
>
> Kind regards,
>
> Annet.




-- 
Pablo Martín Mulone (mar...@tecnodoc.com.ar)
http://www.tecnodoc.com.ar/

My blog: http://martin.tecnodoc.com.ar
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6


[web2py] Menu based on Boolean table fields.

2011-03-21 Thread annet
In db.py I defined the following table:

db.define_table('cardfunction',

Field('company_id',db.company,default='',notnull=True,unique=True),
Field('home',type='boolean',default=True),
Field('logo',type='boolean',default=False),
Field('tagline',type='boolean',default=False),
Field('image',type='boolean',default=False),
Field('css',type='boolean',default=False),
Field('customcss',type='boolean',default=False),
Field('keywords',type='boolean',default=False),
migrate=False)

Based on this table I would like to generate a menu. In a controller I
got the following code:

if not session.id or session.id!=auth.user.bedrijf_id:
session.id=auth.user.bedrijf_id
 
session.row=db(db.cardfunction.bedrijf_id==session.id).select(db.cardfunction.ALL)
session.card_menu=[
['Home',request.function=='index',URL(r=request,f='index')],
['Logo',request.function=='logo',URL(r=request,f='logo')],
...
 
['Keywords',request.function=='keywords',URL(r=request,f='keywords')]]


In the view I would like to generate a menu, in which, if the
session.row.field value is true a link is being rendered and if
session.row.field is false a  element is being rendered. What
I had in mind:


  {{for _name,_active,_link in session.card_menu:}}
{{if session.row.home:}}
  
{{=_name}}
  
{{else:}}
  
{{=_name}}
  
{{pass}}
 
  {{pass}}


... doesn't work. Besides, if session.row.home: seven times, once for
every field isn't a very elegant solution either. I hope one of you
can provide me with a solution.

Kind regards,

Annet.


[web2py] jquery mobile

2011-03-21 Thread ChrisM
I am looking for a basic scaffold app that uses jquery mobile , I also
use app engine to host my code.
tried modifying existing app but run into problems, web2py doesn't
serve the mobile page even with a hello world type template.
Could you step me through what i should be configuring, sorry but i
have looked in previous discussions and can't find an answer to this.
Chrism


[web2py] Re: web2py Issues

2011-03-21 Thread Neveen Adel
Thanks a lot Kevin for your time & explanation :)


On Mar 21, 3:44 pm, Kevin Ivarsen  wrote:
> One other thought - if web2py wasn't rejecting the form based on the formkey
> after redirect, I think you would actually be running into an infinite
> redirect loop here the way things are currently structured!
>
> Cheers,
> Kevin


Re: [web2py] Table already exists

2011-03-21 Thread Kenneth Lundström

On 21.3.2011 5:46, LarryEitel wrote:

Getting: InternalError: (1050, u"Table 'b' already exists")

How can I get past this? Yes, the table exists. I suppose I can turn
off migration testing.

Anyway to update logs, .table files etc to conform to existing tables?

Thank you :)
Is it so that you have a existing table and have written a suitable 
model for it?


The reason it doesn´t work is that web2py has it´s own mechanism to 
control which tables exists. It takes care of everything that comes to 
tables, creating, updating, deleting.


When you now have created the table outside web2py and web2py checks it 
own list of tables it doesn´t exist and web2py tries to create it and fails.


If you extract the data, drop the table, let web2py create the table and 
then import the data everything should work.



Kenneth



[web2py] Re: web2py Issues

2011-03-21 Thread Kevin Ivarsen
One other thought - if web2py wasn't rejecting the form based on the formkey 
after redirect, I think you would actually be running into an infinite 
redirect loop here the way things are currently structured!

Cheers,
Kevin


[web2py] Re: web2py Issues

2011-03-21 Thread Kevin Ivarsen
Why do you need to redirect back to the same view to display the error? The 
normal way of doing this is basically what you currently have: if there is 
an error in the form in the POST, immediately redisplay the form.

I think the reason this is failing is because of the formkey technique used 
by web2py. When you auto-generate a form (as with SQLFORM), a random "form 
key" is generated and inserted into the form. The same key is also saved in 
the web2py server. When the form is submitted and web2py checks it with 
form.accepts, it first verifies that the submitted formkey is one that was 
previously generated by web2py. If the key is found, it is removed from the 
list of pending formkeys. If the key is not found, the form is reset. 

The point of this is to prevent people from accidentally submitting the same 
form twice (imagine accidentally clicking the submit button twice when 
submitting a credit card purchase). But I bet you're running into a case 
where you redirect and send the form vars, but the formkey is no longer 
valid (since it has already been generated and accepted once), so the form 
is reset after the redirect.

Long story short, regenerate the form in the same request if there is an 
error - don't redirect unless there's some reason for this that I'm not 
realizing.

Cheers,
Kevin


Re: [web2py] Re: XML manipulation

2011-03-21 Thread Richard Vézina
Hello Mart,

I need to generate WordML out of web2py... Is there a "easier" or more
integrated way then use xslt transformation that is the easiest way that
comes to my mind?

Thanks

Richard

On Sun, Mar 20, 2011 at 8:20 PM, mart  wrote:

> I use lots of XML to drive automation, file system structure,
> validation, user initial input, etc, so pretty much everywhere I make
> use of xml. much of the data (that may be user or project specific) is
> submitted as XML, then use that to populate tables (which BTW - I
> found lately to be a great way to share data between module [something
> that looks like a properties object]). I also frequently generate and/
> or convert chunks of xml to dictionary objects (wrapper to make a
> dictionary behave like an object - looks like web2py's storage) so I
> can run through data by doing a.b.c.d (which I find very useful at
> times). These are some of the ways where I use xml on daily basis.
>
> So my use of it in a web2py context goes more towards DAL stand-alone
> than in a 'over the web' context, but you're welcome to anything I
> have if interested. I have lots of code and can probably make samples
> depending on what you need, - I mostly stick to etree (maybe just a
> preference), because I like that I can reset .root anywhere i like and
> can easily group similar items).
>
> Mart :)
>
>
> On Mar 20, 3:58 pm, villas  wrote:
> > OK I found a way (it was of course easier than I thought!).
> > However, if anyone has any interesting XML resources/tips,  I would
> > still be interested to learn more.
> > Thanks!
>


[web2py] Re: Proposals for New Tagline

2011-03-21 Thread Massimo Di Pierro
That is what I always assumed.

On Mar 21, 8:23 am, AdamF  wrote:
> Hi,
>
> I've read all the discussion about the tagline... and unfortunately I cannot
> agree with most of the votes. But maybe it's because I am coming from
> enterprise world and I have a different perspective...
>
> For me if you put enterprise in the tagline that means only a few things;
> it's a mature, production-ready, stable and high quality, proven software.
> Thats because enterprise companies avoid investing in betas or experimental
> solutions - they do prefer a stable, proven software even if it's not so
> cheap.
>
> So if you want to attract developers like me - people with enterprise
> experience - leave this word in tagline. Otherwise they will choose Django
> only because it's more popular...
>
> Personally I would think about tagline that shows 3 points: enterprise
> quality and stability, agile development, fast learning
>
> Regards
>
> Adam


[web2py] Table already exists

2011-03-21 Thread LarryEitel
Getting: InternalError: (1050, u"Table 'b' already exists")

How can I get past this? Yes, the table exists. I suppose I can turn
off migration testing.

Anyway to update logs, .table files etc to conform to existing tables?

Thank you :)


[web2py] Re: hierarchical authorization

2011-03-21 Thread Massimo Di Pierro
You would need something as an LDAP web service. I guess one could
create it with web2py.

On Mar 21, 1:17 am, Martin Weissenboeck  wrote:
> Is it possible to use LDAP together with the Goole App Engine?
>
> 2011/3/21 Martin Weissenboeck 
>
>
>
>
>
>
>
> > Thank you for this hint.
> > I do not have any experience with LDAP but of course it would be an
> > interesting callenge to learn more.
>
> > 2011/3/21 Joe Barnhart 
>
> >> Isn't this a perfect example of a place to use web2py with LDAP?
>
> >> -- Joe
>
> >> On Mar 20, 5:22 am, Martin Weissenboeck  wrote:
> >> > Hi everybody,
> >> > I have the following problem: I need some kind of hierarchical
> >> > authorization.
>
> >> > This is a simplified model:
> >> > Company C001...C500
> >> >    Departement D01...D15
> >> >       Group G01...G40
> >> >          Person P01...P30
>
> >> > Not every company has 15 departements, not every departement has 40
> >> groups
> >> > and so on, but the whole program should work with up 200.000 persons.
>
> >> > Now some authorizations:
>
> >> >    - Every person is allowed to change most of (but not all) of his
> >> personal
> >> >    data.
> >> >    - Some persons are allowed to change some data of the members of a
> >> >    specified group or some groups or a departement.
> >> >    - Some persons are allowed to send messages single persons or to the
> >> >    members of a group or some groups or a departement or a company.
> >> >    - Some persons are allowed to change all data of the members of a
> >> group
> >> >    or some groups or a departement or a company.
> >> >    - Some persons are allowed to do everything (including impersonate)
> >> with
> >> >    all data of the members of a whole departement or company.
> >> >    - ... and so on ...
>
> >> > One person could be identified by a string field like
> >> "C003:D03:G12:P15".
>
> >> > I think I could use the authorization and the decoration of web2py to
> >> allow
> >> > one person to modify data or to send messages.
>
> >> >    - But how could I use the authorization e.g. to modify only some
> >> data?
> >> >    - And if somebody is allowed to change some data he should only see
> >> these
> >> >    persons he is allowed to make modifications.
>
> >> > A sql-statement "where ident like 'C003:D03:G12:%" could do the job.
>
> >> >    - But would it be fast enough for 200.000 persons?
> >> >    - Is there any way to use theauthentization mechanism for this
> >> problem?
>
> >> > Regards Martin


Re: [web2py] Re: Proposals for New Tagline

2011-03-21 Thread AdamF
Hi,

I've read all the discussion about the tagline... and unfortunately I cannot 
agree with most of the votes. But maybe it's because I am coming from 
enterprise world and I have a different perspective...

For me if you put enterprise in the tagline that means only a few things; 
it's a mature, production-ready, stable and high quality, proven software. 
Thats because enterprise companies avoid investing in betas or experimental 
solutions - they do prefer a stable, proven software even if it's not so 
cheap.

So if you want to attract developers like me - people with enterprise 
experience - leave this word in tagline. Otherwise they will choose Django 
only because it's more popular... 

Personally I would think about tagline that shows 3 points: enterprise 
quality and stability, agile development, fast learning

Regards

Adam


[web2py] Re: web2py Issues

2011-03-21 Thread pbreit
This is hard to follow. Can you isolate the parts that don't work? Are you able 
to radically simplify the logic?


[web2py] Re: How to create a parallel mobile site

2011-03-21 Thread ChrisM
I'm just taking first steps in using jquery mobile, I copied and
pasted a basic html
template from the jquery site put it on a app engine demo site i have,
but it does not load up properly on an iphone. I am struggling to
pinpoint problem, do you guys think that this is web2py
configuration problem as I thought it would just work without much
hassle?
any thought on including jquery mobile with web2py installation?
any help appreciated, chrism.

On Feb 18, 3:27 am, Chris  wrote:
> That works very well. Thanks Anthony!
>
> On Feb 17, 8:16 pm, Anthony  wrote:
>
> > Maybe do something like this in a model file:
>
> > import os
> > is_mobile_client = [code testing formobileclient goes here]
> > if is_mobile_client:
> >     mobile_view = '%s.mobile.%s' % (request.function, request.extension)
> >     if os.path.exists(os.path.join(request.folder, 'views',
> > request.controller, mobile_view)):
> >         response.view = '%s/%s' % (request.controller, mobile_view)
> > For any incoming request, it checks if a '[function].mobile.[extension]'
> > view exists, and if so, it sets response.view to themobileview. I haven't
> > tested it thoroughly, but I think something like this would work.
>
> > If all of yourmobile-specific actions are restricted to a single
> > controller, then I suppose you could put this code at the top of that
> > controller instead of in a model file.
>
> > Anthony
>
> > On Monday, February 14, 2011 3:47:54 PM UTC-5, Chris wrote:
> > > Hi all,
>
> > > I'm making a site on web2py that has amobilecounterpart.
>
> > > I'd like to be able to, once I've detected that a browser ismobile,
> > > use a different set of views but share the same controller logic. I
> > > saw that in an earlier post (http://groups.google.com/group/web2py/
> > > browse_thread/thread/7277e92b03450784/9dd641c956bd6bc3?
> > > lnk=gst&q=mobile#9dd641c956bd6bc3)
> > > we covered the browser sniffing,
> > > and got that working, but how would I be able to, for example, use
> > > index.mobile.html instead of index.html if I detect the user is coming
> > > from amobiledevice?
>
> > > Thanks
> > > Chris
>
>


Re: [web2py] setup.py to install web2py globally into the python env/virtualenv

2011-03-21 Thread Martín Mulone
Thanks praneeth for the contribution, I think this is great.

2011/3/20 Praneeth Bodduluri 

> Hello all,
>
> In an attempt to make web2py pip installable, so that I can use gluon
> as a module in other python programs, I created a setup.py that can be
> used to create a source dist for PyPI. Attached are the files that
> need to be placed in the web2py root directory.
>
> To create the source distribution:
>
> python setup.py sdist
>
> To install from the source distribution (After running the above
> command and using the sdist that it creates):
>
> python setup.py install
>
> After installing in your python env or virtualenv:
>
> To create a new web2py application directory:
>
> mkweb2pyenv path_to_project_dir
>
> To run web2py from a directory:
>
> runweb2py path_to_project_dir
>
>
> I hope this makes its way to web2py Trunk. A clone with the files
> included can be found at : https://code.google.com/r/lifeeth-pip
>
> I made a video of running an instance for those who like to watch:
>
> https://www.youtube.com/watch?v=f6cFkK2ZDPY
>
> --
> Praneeth
> IRC: lifeeth
>



-- 
Pablo Martín Mulone (mar...@tecnodoc.com.ar)
http://www.tecnodoc.com.ar/

My blog: http://martin.tecnodoc.com.ar
Expert4Solution Profile:
http://www.experts4solutions.com/e4s/default/expert/6


[web2py] Re: moving from Drupal to Web2py

2011-03-21 Thread Anthony
Have you seen 
http://code.google.com/p/web2py/source/browse/scripts/extract_mysql_models.py
?

On Monday, March 21, 2011 3:00:56 AM UTC-4, VP wrote:

> I have a Drupal app, which is quite bloated.  I'm estimating if it's 
> cost efficient to convert this app to web2py.  Essentially, I'm most 
> interested in moving the users and nodes/comments from Drupal to 
> web2py.   As long as these are consistent, I can cook up the rest. 
>
> What would you suggest?  What would be the best ways to extract 
> information from tables of a MySQL database and place them into 
> similar-in-content, but structurally different models in web2py? 
>
> Thanks.



[web2py] Menu based on Boolean table fields.

2011-03-21 Thread annet
In db.py I defined the following table:

db.define_table('cardfunction',
 
Field('company_id',db.company,default='',notnull=True,unique=True),
Field('home',type='boolean',default=True),
Field('logo',type='boolean',default=False),
Field('tagline',type='boolean',default=False),
Field('image',type='boolean',default=False),
Field('css',type='boolean',default=False),
Field('customcss',type='boolean',default=False),
Field('keywords',type='boolean',default=False),
migrate=False)


Based on this table I would like to generate a menu. In a controller I
got the following code:

if not session.id or session.id!=auth.user.bedrijf_id:
session.id=auth.user.bedrijf_id
 
session.row=db(db.cardfunction.bedrijf_id==session.id).select(db.cardfunction.ALL)
session.card_menu=[
['Home',...],
['Logo',...],
...
['Keywords',...]]


In a view I got the following code to generate the menu:

{{if session.card_menu:}}
  

  {{for _name,_active,_link in session.card_menu:}}
{{if session.row.home:}}
  
{{=_name}}
  
{{else:}}
  
{{=_name}}
  
{{pass}}
 {{if session.row.logo:}}
  
{{=_name}}
  
{{else:}}
  
{{=_name}}
  
{{pass}}
.
  {{pass}}

   
{{pass}}


I wonder whether there is a more efficient way to generate the menu,
e.g. using an index instead of the field names: session.row.field_i
where i ranges from 0 to 7.


Kind regards,

Annet.


[web2py] Re: How using is it to have the redirects shown while in development...

2011-03-21 Thread Mengu
i can think of this being helpful only for logging purposes.

On Mar 21, 9:20 am, "Jason (spot) Brower"  wrote:
> Now that I am working in Django at my work, I notice that when using the
> built in server it notifies you of all the redirects.
> How useful is this and would it be useful to implement in Web2py?
> ---
> Jason Brower


[web2py] How using is it to have the redirects shown while in development...

2011-03-21 Thread Jason (spot) Brower
Now that I am working in Django at my work, I notice that when using the
built in server it notifies you of all the redirects.
How useful is this and would it be useful to implement in Web2py?
---
Jason Brower


[web2py] moving from Drupal to Web2py

2011-03-21 Thread VP
I have a Drupal app, which is quite bloated.  I'm estimating if it's
cost efficient to convert this app to web2py.  Essentially, I'm most
interested in moving the users and nodes/comments from Drupal to
web2py.   As long as these are consistent, I can cook up the rest.

What would you suggest?  What would be the best ways to extract
information from tables of a MySQL database and place them into
similar-in-content, but structurally different models in web2py?

Thanks.