[web2py] Re: Interesting new SQLite/JSON based database

2011-08-11 Thread GoldenTiger

On Aug 12, 12:16 am, Massimo Di Pierro 
wrote:
> I would me more interested in a DAL adapter can pass queries to
> another DAL instance.

mmm... Massimo, What is on your mind?
Can you expose a simple example?

Maybe I have something to say to this respect...

This summer  I am working on an idea that makes me lose any sleep.
(I started with it as a part from a distribuited CRM that  I am about
finish. It's for a public organization in my city)
I have been working with web2py to get a database in the cloud, using
(but not limited to) google spreadsheets, and sync with local sqlite
database.

I had planned to post about it on developer groups, to talk about this
idea.

By now all proofs works really well.

:D


[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Miguel
Looks great!


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread pbreit
Are you referring to Web2py's new scheduler?

Since many of us are already set up to use SQLite or MySQL/Postgres, could 
those be used in place of Redis?


[web2py] Re: celery integration?

2011-08-11 Thread pbreit
Maybe sending an email instead of DB insert? Is async DB insert common?

[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Rahul
Something I've been waiting for a long time. I liked SPE but needed
something more to support modern wxpython and more stuff. Your project
looks superb. Waiting for first final release. Thanks

Rahul D.

On Aug 12, 6:22 am, Nicolas Palumbo  wrote:
> Mariano, how can I code if don't use a Mercurial repo?
> Can ipoint it to the folder?
>
>
>
>
>
>
>
> On Fri, Aug 12, 2011 at 12:43 AM, Mariano Reingart  wrote:
> > Please check the latest version with the following recent bug-fixes:
>
> >  * Support for external browser (if no webkit/ie available, ie. MAC OS X)
> >  * Support for older wxpython versions (psp toolbar problem, ie.
> > debian wx 2.8.10)
>
> >http://rad2py.googlecode.com/files/rad2py-0.06-web2py-bugfix.zip
>
> > Also, now ide2py will build a basic web2py enviroment, available in
> > the editor for calltip and autocompletion, with the following objects:
>
> >  * request, response, session
> >  * db, auth, crud, service
> >  * HTML helpers, T, etc.
>
> > So, if you write SQLFORM and press the . , it will show the docstring
> > and parameters of that function.
>
> > Hope it works,
>
> > Best regards,
>
> > Mariano Reingart
> >http://www.sistemasagiles.com.ar
> >http://reingart.blogspot.com
>
> > On Thu, Aug 11, 2011 at 7:49 PM, pbreit  wrote:
> >> I got an error on MacOS Lion:
> >> ide2py $ python main.py
> >> 2011-08-11 15:46:30.647 Python[1091:1107] CFURLCreateWithString was passed
> >> this invalid URL string:
> >> '/System/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path
> >> instead of an URL string). The URL created will not work with most file URL
> >> functions. CFURLCreateWithFileSystemPath or
> >> CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
> >> Traceback (most recent call last):
> >>   File "main.py", line 777, in 
> >>     app = MainApp(redirect=False)
> >>   File
> >> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
> >> line 7981, in __init__
> >>     self._BootstrapApp()
> >>   File
> >> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
> >> line 7555, in _BootstrapApp
> >>     return _core_.PyApp__BootstrapApp(*args, **kwargs)
> >>   File "main.py", line 761, in OnInit
> >>     self.aui_frame = PyAUIFrame(None)
> >>   File "main.py", line 273, in __init__
> >>     self.browser = self.CreateBrowserCtrl()
> >>   File "main.py", line 613, in CreateBrowserCtrl
> >>     return SimpleBrowserPanel(self)
> >>   File "/Users/pbreit/rad2py/ide2py/browser.py", line 113, in __init__
> >>     self.browser = BrowserPanel(self)
> >> NameError: global name 'BrowserPanel' is not defined


[web2py] Re: celery integration?

2011-08-11 Thread TheSweetlink
Hello Massimo,

I do not have any code I can share at the moment for this solution as
I am using it in my current project but I will be very happy to make a
detailed example tomorrow to share with the community.  Do you have
any particular focus in mind?  Async insert into db?  What level of
detail should I provide?  Absolute novice or an assumption of web2py
knowledge?

-David


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread TheSweetlink
Long time lurker here.  First, thank you all for this incredible
product and community.  I have learned a great deal in a very short
order of time thanks to web2py and this mailing list.

I may have the opportunity to finally contribute back meaningfully.

Regarding background message/task queuing I have had great success
with a very simple combination that has many extra side benefits.  All
dependencies (BSON, redis-py, hotqueue) are available via pip for easy
installation.  Some pros and cons listed below.

The short version:
Serialize your task/message into a dict, list of dicts, whatever via
BSON (Binary JSON = FAST),
push it to a queue kept in Redis,
background worker pulls from queue and processes it/inserts into db/
whatever you like.

Not only messages but I have successfully tested this as a queue for
tasks as well.  Use a k,v pair in a dict describing your {'action':
'data'}.  It's easy to get creative with it.

Cons:
- More dependencies if you don't already run Redis.
- Time to familiarize yourself with Redis.  (15 - 20 minutes maybe)
- No scheduling built-in but uwsgi decorators can provide cron
capabilities for those running uwsgi.  I haven't played with them yet
but intend to over the next month or two.

Benefits:
- Still fewer dependencies than celery.  Redis becomes the task/
message queue as well as the back end storage and web2py workers
process them.
- Multiple dbs in Redis can be organized into different queues.
- Flexible - Can be adapted to your project fairly easily.
- Also can act as a cache.  Redis has some really useful data types
which you can use to do a lot of your processing in memory.
- Has a pub/sub system which can also be incorporated into your
queue.  Perhaps as a central logging server.
- All data in Redis is kept in memory but persisted to disk = blazing
fast performance with durability.
- Possible simplified application architecture if you use Redis for
your task queue, async message/db insert queue, pub/sub system

I will be happy to create a slice detailing the process with some
abstract examples if anyone has interest in my solution.

Thanks again for all your work.  I intend to contribute back to web2py
as much as I can and all open source because I have learned and built
so much with it.

-David Bloom


[web2py] Re: copying upload type field from one table to another

2011-08-11 Thread annet
Hi Nik,

I solved a similar problem like this:

The relevant bits in the old table:

db.define_table('logofile',
Field('filename',writable=False,readable=False),
 
Field('file',type='upload',default='',notnull=True,autodelete=True),
migrate='logofile.table')


The function:

def copy_logofiles():
rows=db().select(db.logofile.ALL,orderby=db.logofile.bedrijf_id)
for row in rows:
try:
 
db.new_logofile.insert(filename=row.filename,file=row.file)
except Exception, e:
print e
return 0


In both tables, logofile and new_logofile the logofiles in the uploads
folder are available.


I hope this helps you solve the problem.


Kind regards,

Annet.


[web2py] Filtering tags in crud form dropdowns

2011-08-11 Thread noelrv
I have issues implementing a filtered list of tags in a crud form
dropdown.

In the models below, each book belongs to a category and has one or
more tags. Each category has a specified set of tags by defining
tag.categories as a list:reference.

The crud form dropdown shows a filtered tag list if I explicitly
specify a value for "contains":
 categorytags = db(db.tag.categories.contains(6))
but not, if I use:
 categorytags = db(db.tag.categories.contains(db.book.category))

db.define_table('category',
Field('name'), format='%(name)s')

db.define_table('tag',
Field('name'),
Field('categories','list:reference category'), format='%(name)s')

db.define_table('book',
Field('title'),
Field('category',db.category),
Field('tags','list:reference tag'))
categorytags = db(db.tag.categories.contains(db.book.category))
db.book.tags.requires=IS_IN_DB(categorytags,'tag.id',db.tag._format,multiple=True)



[web2py] PowerGrid and reference fields

2011-08-11 Thread niknok
When I list a table with a reference field, it shows up as an index key.
I was expecting  it to show up as usual, with the default record
representation of the referenced table. 

It does show up correctly inside a modal window, after hitting an action
button (i.e. Details), though.

I tried setting a .representation for the said field, but that didn't
seem to change anything.

Also, I wish Bruno would consider adding an option for
plugin_PowerGrid.CallBack to return only readable fields.

/r
Nik





[web2py] copying upload type field from one table to another

2011-08-11 Thread niknok
When I try to copy an upload field, the link to the file gets broken in
the new table.  What's the correct way of copying this field type?

For example, I do it like this:

db.new_table.photo[1] = db.old_table[9]


but in new_table, I get a broken link to the file in the upload folder.

/r
Nik


[web2py] field labels in crud search

2011-08-11 Thread niknok
I noticed while using crud search results that web2py doesn't use labels
defined in tables as headers.  Of course, headers can be defined in crud
but wouldn't it be better if by default it uses the labels already
defined with the table instead of field names?


[web2py] Re: Where to put the .htaccess file

2011-08-11 Thread Yannick
I found the solution:

I put the ".htaccess" file in the "/home/www-data" directory and then
I remove the "/$1" in the URL link inside the command... here is the
command inside the ".htaccess" file.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mywebsite.com
RewriteRule (.*) http://www.mywebsite.com [R=301,L]

Cheers,
Yannick P.

On Aug 11, 12:08 pm, Yannick  wrote:
> hi mate,
> I put the .htaccess file in "/home/www-data/" directory in the same
> directory as web2py dir. Now it seems to work. When i type the URL the
> WWW is added in front of it like i wanted BUT the new issue is the
> following:
>
> when i type mywebsite.com it gets redirect 
> towww.mywebsite.com/web2py/wsgihandler.py/
>
> I wonder and don't understand why it goes to "/web2py/
> wsgihandler.py/" ??
>
> Please help it you know
> Yannick P.


Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Nicolas Palumbo
Mariano, how can I code if don't use a Mercurial repo?
Can ipoint it to the folder?


On Fri, Aug 12, 2011 at 12:43 AM, Mariano Reingart  wrote:
> Please check the latest version with the following recent bug-fixes:
>
>  * Support for external browser (if no webkit/ie available, ie. MAC OS X)
>  * Support for older wxpython versions (psp toolbar problem, ie.
> debian wx 2.8.10)
>
> http://rad2py.googlecode.com/files/rad2py-0.06-web2py-bugfix.zip
>
> Also, now ide2py will build a basic web2py enviroment, available in
> the editor for calltip and autocompletion, with the following objects:
>
>  * request, response, session
>  * db, auth, crud, service
>  * HTML helpers, T, etc.
>
> So, if you write SQLFORM and press the . , it will show the docstring
> and parameters of that function.
>
> Hope it works,
>
> Best regards,
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
>
> On Thu, Aug 11, 2011 at 7:49 PM, pbreit  wrote:
>> I got an error on MacOS Lion:
>> ide2py $ python main.py
>> 2011-08-11 15:46:30.647 Python[1091:1107] CFURLCreateWithString was passed
>> this invalid URL string:
>> '/System/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path
>> instead of an URL string). The URL created will not work with most file URL
>> functions. CFURLCreateWithFileSystemPath or
>> CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
>> Traceback (most recent call last):
>>   File "main.py", line 777, in 
>>     app = MainApp(redirect=False)
>>   File
>> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
>> line 7981, in __init__
>>     self._BootstrapApp()
>>   File
>> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
>> line 7555, in _BootstrapApp
>>     return _core_.PyApp__BootstrapApp(*args, **kwargs)
>>   File "main.py", line 761, in OnInit
>>     self.aui_frame = PyAUIFrame(None)
>>   File "main.py", line 273, in __init__
>>     self.browser = self.CreateBrowserCtrl()
>>   File "main.py", line 613, in CreateBrowserCtrl
>>     return SimpleBrowserPanel(self)
>>   File "/Users/pbreit/rad2py/ide2py/browser.py", line 113, in __init__
>>     self.browser = BrowserPanel(self)
>> NameError: global name 'BrowserPanel' is not defined
>


Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Mariano Reingart
Please check the latest version with the following recent bug-fixes:

 * Support for external browser (if no webkit/ie available, ie. MAC OS X)
 * Support for older wxpython versions (psp toolbar problem, ie.
debian wx 2.8.10)

http://rad2py.googlecode.com/files/rad2py-0.06-web2py-bugfix.zip

Also, now ide2py will build a basic web2py enviroment, available in
the editor for calltip and autocompletion, with the following objects:

 * request, response, session
 * db, auth, crud, service
 * HTML helpers, T, etc.

So, if you write SQLFORM and press the . , it will show the docstring
and parameters of that function.

Hope it works,

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Thu, Aug 11, 2011 at 7:49 PM, pbreit  wrote:
> I got an error on MacOS Lion:
> ide2py $ python main.py
> 2011-08-11 15:46:30.647 Python[1091:1107] CFURLCreateWithString was passed
> this invalid URL string:
> '/System/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path
> instead of an URL string). The URL created will not work with most file URL
> functions. CFURLCreateWithFileSystemPath or
> CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
> Traceback (most recent call last):
>   File "main.py", line 777, in 
>     app = MainApp(redirect=False)
>   File
> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
> line 7981, in __init__
>     self._BootstrapApp()
>   File
> "/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
> line 7555, in _BootstrapApp
>     return _core_.PyApp__BootstrapApp(*args, **kwargs)
>   File "main.py", line 761, in OnInit
>     self.aui_frame = PyAUIFrame(None)
>   File "main.py", line 273, in __init__
>     self.browser = self.CreateBrowserCtrl()
>   File "main.py", line 613, in CreateBrowserCtrl
>     return SimpleBrowserPanel(self)
>   File "/Users/pbreit/rad2py/ide2py/browser.py", line 113, in __init__
>     self.browser = BrowserPanel(self)
> NameError: global name 'BrowserPanel' is not defined


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread Massimo Di Pierro
PS. The fix also allow to schedule a one time task to run on a
specific worker which is useful in its own.

On Aug 11, 7:33 pm, Massimo Di Pierro 
wrote:
> You found a major bug. I think it is not fixed in trunk (more or less
> as you suggested). Please check it.
>
> The database locked issue should not raise, perhaps there is a sqlite
> flag.
>
> Massimo
>
> On Aug 11, 6:33 pm, Niphlod  wrote:
>
>
>
>
>
>
>
> > Really totally insane rambling.
> > Reference in task_run doesn't block worker two executing the
> > function...
>
> > So, another rambling:
> > In order to avoid it, at the cost of firing two queries on
> > task_scheduled table, wouldn't be better to "sign" the task_scheduled
> > with, say, worker_heartbeat.id and then check, after the first commit,
> > if the same record is being taken up by another worker?
>
> > Something like:
>
> > 1. worker 1 fetches task_scheduled.id=1 and updates the record with
> > worker_id=1 and status=running
> > 2. commit()
> > 3. worker 1 re-fetches task_scheduled.id=1 and checks if worker_id is
> > still == 1
> > 4. task_run record is inserted
> > 5. db.commit()
>
> > and so on...
>
> > would this kind of approach seal the deal or it's a "chicken and egg"
> > problem and we'd need to separate delicate processes "intelligently"
> > using task_scheduled.group_name and only a worker doing those ?


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread Massimo Di Pierro
You found a major bug. I think it is not fixed in trunk (more or less
as you suggested). Please check it.

The database locked issue should not raise, perhaps there is a sqlite
flag.

Massimo

On Aug 11, 6:33 pm, Niphlod  wrote:
> Really totally insane rambling.
> Reference in task_run doesn't block worker two executing the
> function...
>
> So, another rambling:
> In order to avoid it, at the cost of firing two queries on
> task_scheduled table, wouldn't be better to "sign" the task_scheduled
> with, say, worker_heartbeat.id and then check, after the first commit,
> if the same record is being taken up by another worker?
>
> Something like:
>
> 1. worker 1 fetches task_scheduled.id=1 and updates the record with
> worker_id=1 and status=running
> 2. commit()
> 3. worker 1 re-fetches task_scheduled.id=1 and checks if worker_id is
> still == 1
> 4. task_run record is inserted
> 5. db.commit()
>
> and so on...
>
> would this kind of approach seal the deal or it's a "chicken and egg"
> problem and we'd need to separate delicate processes "intelligently"
> using task_scheduled.group_name and only a worker doing those ?


[web2py] Re: RFC about issue

2011-08-11 Thread Massimo Di Pierro
My only concern is that with rounded corner buttons the E of Edit may
touch the corner, unless the buttons are taller or wider. The e of
edit does not suffer this problem.

On Aug 11, 5:56 pm, Michael Toomim  wrote:
> I agree not a big 
> deal:http://www.quora.com/Should-buttons-in-web-apps-be-capitalized
>
> On Aug 11, 3:24 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > What do people think?
>
> >http://code.google.com/p/web2py/issues/detail?id=370
>
> > I do not have a strong opinion.


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread Niphlod
Really totally insane rambling.
Reference in task_run doesn't block worker two executing the
function...

So, another rambling:
In order to avoid it, at the cost of firing two queries on
task_scheduled table, wouldn't be better to "sign" the task_scheduled
with, say, worker_heartbeat.id and then check, after the first commit,
if the same record is being taken up by another worker?

Something like:

1. worker 1 fetches task_scheduled.id=1 and updates the record with
worker_id=1 and status=running
2. commit()
3. worker 1 re-fetches task_scheduled.id=1 and checks if worker_id is
still == 1
4. task_run record is inserted
5. db.commit()

and so on...

would this kind of approach seal the deal or it's a "chicken and egg"
problem and we'd need to separate delicate processes "intelligently"
using task_scheduled.group_name and only a worker doing those ?


[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs

2011-08-11 Thread Niphlod
scheduler.py are a super-arci-mega-ultra-extra nice 400 lines of code
that I like...

right now I'm beginning to test it, and the basics are quite
understandable at a first glance.

Before doing anything advanced, I fired up 8 workers and write a
controller putting an insanely high number of small function...noticed
a little hang on next_task() and think I found the resolution, that
doesn't need a big change... line 224

return
db(query).select(orderby=db.task_scheduled.next_run_time).first()

selects all rows, serialize it and then take only the first one. with
10 records on task_scheduled table, and 8 workers polling, it
becomes a little heavy. Transforming that line in

return db(query).select(limitby=(0,1),
orderby=db.task_scheduled.next_run_time).first()

made it run (obviuosly) smoother.

I'll be happy to fully test this new scheduler because right now I'm
forced to launch a relatively long function in a controller with ajax
call really suboptimal.

Supposedly I'd like to have several tasks with no repetitions, so
several task_scheduled going to create a lot of task_run.
I need to save some data to the application database in the function
itself, so task_run isn't really needed.
I'd need to use the cleanup functions in scheduler.py, but I didn't
get how to add them using the

scheduler = Scheduler(db,dict(demo1=demo1,demo2=demo2))

syntax.

Also, I didn't get how to start scheduler.py in "standalone" mode,
specifically creating the tasks.py file ... any hint ?

PS: on line 47 of usage "id =
scheduler.db.tast_scheduler.insert()" is really "id =
scheduler.db.task_scheduled.insert()"

One question (here in Italy I'd say "non voglio rompere le uova nel
paniere", it seems that in english the correct translation is "I don't
want to to cut the ground from under ") ...
using sqlite is a mess of "operational error: Database is locked" with
many workers, so I went to test it with Postgres
One thing that blocked me from writing an async queue and the relative
worker on a database was that, in scheduler.py terms, next_task()
fired from different workers fetch the same record.
While this particular occasion is rare, for some operations (e.g.:
send out a single mail once a day to a user, or having to schedule a
function that takes a loong time to execute) is a pain in the ass.
With one worker all is going fine, obviously.
That's why redis or rabbitMQ (just to name the first two coming up on
google searches) are used to store scheduled tasks: they are designed
to pull the record off the task_scheduled istantly, assuring that the
task is effectively completed only once.
So, here's what I thought (and I'll try to reproduce as soon as
possible):

1. next_task() fetches a task_scheduled record
2. then a record is inserted into task_run
3. then task_scheduled record gets updated
4. there's a db.commit()
5. function runs
etc etc

following updates and commits are not important to this matter.
>From 1. to just before 4., if another worker pulls a task with
next_task(), the task fetched is the same.
Relational databases comes to help, that's because smart Massimo put a
reference in task_run to task_scheduled, so, for example, if two
workers fetch the same record, they are not allowed at database level
to start working, because the db.commit() on 4. works for the first
but not for the second worker.
Second worker will crash, and it'll stop working.

If this assumption is right, and this is not a total insane rambling
will it be safer to catch that exception and continue working,
fetching another record, instead of crashing ?

I came up also with different ideas for a workaround, but I'll stop
here if the upper mentioned part is actually insane :D


[web2py] Re: RFC about issue

2011-08-11 Thread Michael Toomim
I agree not a big deal:
http://www.quora.com/Should-buttons-in-web-apps-be-capitalized

On Aug 11, 3:24 am, Massimo Di Pierro 
wrote:
> What do people think?
>
> http://code.google.com/p/web2py/issues/detail?id=370
>
> I do not have a strong opinion.


[web2py] Re: Here's a helper for db.table.first() and last()

2011-08-11 Thread Massimo Di Pierro
two problems with this:
will not work on GAE (because id is not sequential) and may conflict
with a table called "first" or "last".
I really like the idea though.

perhaps _first and _last and use a auth.signature.created_on instead
of id?

On Aug 11, 5:08 pm, Michael Toomim  wrote:
> Often I'm at the shell and want to quickly pull up the most recent
> entry in a table. I wrote a couple of helpers for this.
>
> For instance, in a blog app:
>
>   db.posts.last()
>
> ...will get the most recent post.
>
> By putting this code at the bottom of db.py, it'll automatically
> create a first() and last() method for each table in your app.
>
> for table in db.tables:
>     def first(self):
>         return db(self.id>0).select(orderby=self.id,
> limitby=(0,1)).first()
>     def last(self):
>         return db(self.id>0).select(orderby=~self.id,
> limitby=(0,1)).first()
>     t = db[table]
>     t.first = types.MethodType(first, t)
>     t.last = types.MethodType(last, t)


[web2py] Re: web2py book multilanguage

2011-08-11 Thread Massimo Di Pierro
The online book already uses google translate (except for italian).

I also have a script that uses google translate to make the pdf but it
is not very good.


On Aug 11, 4:51 pm, "qasimak...@gmail.com" 
wrote:
> Or you can use google translate some how :)
>
> On Thu, Aug 11, 2011 at 7:40 PM, Massimo Di Pierro <
>
>
>
>
>
>
>
> massimo.dipie...@gmail.com> wrote:
> > True. I am hoping for a 4rd edition in one month. hold on!
>
> > Massimo
>
> > On Aug 11, 9:13 am, Mirek Zvolský  wrote:
> > > But, it's proper time to make new translations?
> > > There will be no update of the english book in short time? Because I
> > > think there are small mistakes and, more important, there is lot of
> > > new features not documented yet.
>
> > > If there will be future changes in book, should not be good to have
> > > something like Version Control, so if english version is updated,
> > > changed places could be easy find for the translation?
>
> > > And proper format for the translation? I think HTML, content of  > > class="page article">
>
> > > Mirek


[web2py] Re: Mix query and string types?

2011-08-11 Thread pbreit
I presume that I will be responsible for SQL injection protection, etc?

[web2py] Re: Mix query and string types?

2011-08-11 Thread pbreit
Cool, I'll try it out, thanks.

[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread pbreit
I got an error on MacOS Lion:

ide2py $ python main.py 
2011-08-11 15:46:30.647 Python[1091:1107] CFURLCreateWithString was passed 
this invalid URL string: 
'/System/Library/CoreServices/CommonCocoaPanels.bundle' (a file system path 
instead of an URL string). The URL created will not work with most file URL 
functions. CFURLCreateWithFileSystemPath or 
CFURLCreateWithFileSystemPathRelativeToBase should be used instead.
Traceback (most recent call last):
  File "main.py", line 777, in 
app = MainApp(redirect=False)
  File 
"/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
 
line 7981, in __init__
self._BootstrapApp()
  File 
"/usr/local/lib/wxPython-unicode-2.8.12.1/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py",
 
line 7555, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "main.py", line 761, in OnInit
self.aui_frame = PyAUIFrame(None)
  File "main.py", line 273, in __init__
self.browser = self.CreateBrowserCtrl()
  File "main.py", line 613, in CreateBrowserCtrl
return SimpleBrowserPanel(self)
  File "/Users/pbreit/rad2py/ide2py/browser.py", line 113, in __init__
self.browser = BrowserPanel(self)
NameError: global name 'BrowserPanel' is not defined


[web2py] Re: adopt an app!

2011-08-11 Thread Massimo Di Pierro
I think that is the first app that should be scrapped as crap.
I do have a better one somewhere, I will post it.

Massimo



On Aug 11, 4:22 pm, Anthony  wrote:
> On Thursday, August 11, 2011 5:01:12 PM UTC-4, pbreit wrote:
>
> > I'd like to see good, basic apps for:
>
> > + forums
>
> http://beta.pyforum.org/
>
> > + hacker news, reddit
>
> Here's a start:http://web2py.com/appliances/default/show/41
>
> Anthony


[web2py] Re: Mix query and string types?

2011-08-11 Thread Massimo Di Pierro
You can do that already but is clanky. I made a simplification in
trunk:

>>> db=DAL()
>>> db.define_table('t',Field('f'))
>>> print db(db.t)('t.f<15')._select('max(t.f)')

SELECT  max(t.f) FROM t WHERE ((t.f>0) AND (t.f<15));

you still need a first db(db.table) or db(db.table.field) to determine
which table is needed. In the query you can merge queries and string.
same for fields.



On Aug 11, 3:52 pm, pbreit  wrote:
> Would it make sense for this type of thing to be extendable in a generalized
> way?
>
> Or I'm wondering if there is or could be a reasonable way to mix Query and
> String types in a DAL query?


[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Christopher Steel
WoW!!! I am going to try on OS X!!!


[web2py] Re: RFC about issue

2011-08-11 Thread Niphlod
+1, and it's not that big deal anyway


[web2py] Re: What is the intent of task_scheduled.name?

2011-08-11 Thread Niphlod
none, also if it seems that in trunk name is not required anymore to
be unique.

On 11 Ago, 11:21, Massimo Di Pierro 
wrote:
> You are the second person to point it out. I am ok to change it. Any
> third opinion?
>
> Massimo
>
> On Aug 11, 2:14 am, G  wrote:
>
>
>
>
>
>
>
> > Hello,
> > I wonder what the intent of the task_scheduled.name field is in the
> > new scheduler.py. Specifically, why is it required that it be unique?
> > I see two disadvantages and no advantage, so I'm wondering what I'm
> > missing.
> > The first, and most important, disadvantage is that when
> > programatically submitting tasks, one must come up with unique names.
> > This isn't hard (using the time etc.) but seems pointless.
>
> > Second, in my application, the user can submit tasks to the server.
> > I'd like to give the tasks a user friendly name that is displayed when
> > the user monitors the status of the tasks. I thought the name field
> > would be ideal for this, but if the user wants to submit two of the
> > same type of task, the name would conflict unless it has something
> > appended to it to make it unique. The "something appended" detracts
> > from the user freindlyness of the field. I could solve this by adding
> > another table that refrences task_scheduled and holds the user
> > friendly name.
>
> > I'm wondering if the intent is to prevent duplicate task submission,
> > but it seems more logical to me to allow multiple task submission and
> > have the user avoid it if necessary rather than making the DB enforce
> > a rule that requires a workaround to enable multiple task submissions.
>
> > Thanks,
> > G


Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread Martín Mulone
Me no, I'm the CMS guy :).

2011/8/11 Richard Vézina 

> Martin Mulone already start a ERP project base on web2py... Don't know if
> he still working on it...
>
> Richard
>
>
> On Thu, Aug 11, 2011 at 1:00 PM, Ross Peoples wrote:
>
>> I would write an ERP for web2py, as I've kind of wanted to. My only
>> problem is I don't know how ERPs really work. If I had someone explain all
>> the pieces to me in detail and how they all work together, then I could
>> probably write the code for it.
>
>
>


-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: Interesting new SQLite/JSON based database

2011-08-11 Thread Massimo Di Pierro
I would me more interested in a DAL adapter can pass queries to
another DAL instance.

On Aug 11, 3:19 pm, Bruno Rocha  wrote:
> Interesting project, a JSON+SQLite based database with rest API.
>
> https://bitbucket.org/robertodealmeida/jsonstore
>
> May be web2py DAL can have an adapter for it, or something like this.
>
> A schema-free database for JSON documents, exposed through a REST API.
> JSONStore supports a wide range of backends (memory, Amazon S3, SQL
> databases, etc.), and searching is implemented using a flexible matching
> algorithm that has support for standard and user-defined operators.


[web2py] Here's a helper for db.table.first() and last()

2011-08-11 Thread Michael Toomim
Often I'm at the shell and want to quickly pull up the most recent
entry in a table. I wrote a couple of helpers for this.

For instance, in a blog app:

  db.posts.last()

...will get the most recent post.

By putting this code at the bottom of db.py, it'll automatically
create a first() and last() method for each table in your app.

for table in db.tables:
def first(self):
return db(self.id>0).select(orderby=self.id,
limitby=(0,1)).first()
def last(self):
return db(self.id>0).select(orderby=~self.id,
limitby=(0,1)).first()
t = db[table]
t.first = types.MethodType(first, t)
t.last = types.MethodType(last, t)


Re: [web2py] Re: web2py book multilanguage

2011-08-11 Thread Anthony
On Thursday, August 11, 2011 5:51:53 PM UTC-4, Qasim Ayyaz Khan wrote: 
>
> Or you can use google translate some how :)

 
There is this: http://www.web2py.com/plugins/default/translate
 


Re: [web2py] Re: web2py book multilanguage

2011-08-11 Thread qasimak...@gmail.com
Or you can use google translate some how :)

On Thu, Aug 11, 2011 at 7:40 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> True. I am hoping for a 4rd edition in one month. hold on!
>
> Massimo
>
> On Aug 11, 9:13 am, Mirek Zvolský  wrote:
> > But, it's proper time to make new translations?
> > There will be no update of the english book in short time? Because I
> > think there are small mistakes and, more important, there is lot of
> > new features not documented yet.
> >
> > If there will be future changes in book, should not be good to have
> > something like Version Control, so if english version is updated,
> > changed places could be easy find for the translation?
> >
> > And proper format for the translation? I think HTML, content of  > class="page article">
> >
> > Mirek
>


[web2py] Re: adopt an app!

2011-08-11 Thread Anthony
On Thursday, August 11, 2011 5:01:12 PM UTC-4, pbreit wrote: 
>
>  
> I'd like to see good, basic apps for:
>  
> + forums
>
http://beta.pyforum.org/
 

> + hacker news, reddit
>
Here's a start: http://web2py.com/appliances/default/show/41
 
Anthony


[web2py] Re: SQLFORM list bug's

2011-08-11 Thread ee...@seccuris.com
On hindsight my suggested fix to sqlhtml.py does not work. It does
return the values as a list but the values are not inserted into the
db properly.

On Aug 11, 10:27 am, Eric Enns  wrote:
> Hey,
>
> There are quite a few bugs in SQLFORM when having a field of type 'list' (so 
> 'list:string', 'list:integer'). First one being when you submit and form and 
> there are error's with other fields.
>
> def error_form():
>                 form = SQLFORM(
>                                 Field('string', 'string'),
>                                 Field('list', 'list:string'))
>
>                 if form.accepts(request.vars, session, 
> onvalidation=_force_string_error):
>                                 pass
>
>                 return dict(form=form)
>
> def _force_string_error(form):
>                 form.errors.string = "blah blah"
>
> Submitting this form with list being one entry equal to "abc" (so one box, no 
> empty box after) will cause on return "abc" being iterated and each value 
> going into its own box (so three boxes for list on the form).
>
> I do have a solution for this, it involves modifying gluon/sqlhtml.py (fixes 
> involve latest web2py download). The following code can be added after line 
> 1061:
>
> for fieldname in self.vars:
> field = self.table[fieldname]
> value = self.vars[fieldname]
> if field.type.startswith('list:') and not isinstance(field, (tuple, list)):
> self.vars[fieldname] = value and [value] or []
>
> Or in the controller we could have the following:
>
> def error_form():
>                 form = SQLFORM(
>                                 Field('string', 'string'),
>                                 Field('list', 'list:string'))
>
>                 if form.accepts(request.vars, session, 
> onvalidation=_force_string_error):
>                                 pass
>                 elif form.errors:
>                                 if not isinstance(form.vars['list'], (tuple, 
> list)):
>                                                 form.vars['list'] = 
> form.vars['list'] and [form.vars['list']] or []
>
>                 return dict(form=form)
>
> The second bug is you cannot set form.errors for a field with type list. I do 
> not have a web2py fix for this but I do the following:
>
> def error_form():
>                 form = SQLFORM(
>                                 Field('string', 'string'),
>                                 Field('list', 'list:string'))
>
>                 if form.accepts(request.vars, session, 
> onvalidation=[_force_string_error, _force_list_error]):
>                                 pass
>                 elif form.errors:
>                                 if not isinstance(form.vars['list'], (tuple, 
> list)):
>                                                 form.vars['list'] = 
> form.vars['list'] and [form.vars['list']] or []
>                                 if form.errors.haskey('list'):
>                                                 
> form.element(_id='no_table_list__row')[1].append(DIV(form.errors.list, 
> _class='error'))
>
>                 return dict(form=form)
>
> def _force_list_error(form):
>                 form.errors.list = "blah blah"
>
> Looking to see what Massimo thinks, and also what the rest of the community 
> think and/or if you have encountered this issue yourself.
>
> -Eric
>
> This communication, including any attachments, does not necessarily represent 
> official policy of Seccuris Inc.
> Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further 
> details about Seccuris Inc.'s Privacy Policy.
> If you have received this communication in error, please notify Seccuris Inc. 
> at i...@seccuris.com or at 1-866-644-8442.


[web2py] Re: adopt an app!

2011-08-11 Thread pbreit
I'm hoping to work on ecommerce/cart/storefront, probably starting from 
scratch and not using estore. But this should not discourage anyone from 
also pursuing this app as I am not sure how far I will get and when.

I'd like to see good, basic apps for:

+ blog
+ forums
+ hacker news, reddit
+ simple crm
+ issue tracking


[web2py] Re: Mix query and string types?

2011-08-11 Thread pbreit
Would it make sense for this type of thing to be extendable in a generalized 
way?

Or I'm wondering if there is or could be a reasonable way to mix Query and 
String types in a DAL query?


[web2py] Re: Interesting new SQLite/JSON based database

2011-08-11 Thread pbreit
Interesting. I just saw this recently, too:
https://github.com/mikeal/pouchdb


[web2py] Interesting new SQLite/JSON based database

2011-08-11 Thread Bruno Rocha
Interesting project, a JSON+SQLite based database with rest API.

https://bitbucket.org/robertodealmeida/jsonstore

May be web2py DAL can have an adapter for it, or something like this.

A schema-free database for JSON documents, exposed through a REST API.
JSONStore supports a wide range of backends (memory, Amazon S3, SQL
databases, etc.), and searching is implemented using a flexible matching
algorithm that has support for standard and user-defined operators.


[web2py] Re: web2py editor corrupting files

2011-08-11 Thread Massimo Di Pierro
Strange but last time I used this was probably 2yrs ago.
I looked at the code and found the possible source of the problem.
Could you please download trunk and tell me if it is now fixed.

Sorry for the problem it caused.

Massimo

On Aug 11, 1:39 pm, peter  wrote:
> I accidentally had a controller file open in two different windows,
> with different edits. When I went to save the second one, the system
> correctly recognised the problem and warned me about it. It offered to
> 'merge' the two files. I chose this option. The merged file had lost
> all the carriage returns and linefeeds. (I checked with a hex editor
> and they were completely gone.) So I clicked on 'revert' to go to the
> previous version. Same problem, so I now had no okay version. As
> python relies on indentation, this was a horrible mess to sort out.
>
> I just tried to repeat the process on a dummy py file. I was able to
> reproduce the problem exactly. It is a nasty bug as it seems to
> corrupt the backup file as well as the live file, strange..
>
> Peter


[web2py] Re: Bug in virtualfields w/ session

2011-08-11 Thread Michael Toomim
Ok, it's here http://code.google.com/p/web2py/issues/detail?id=374

Thank you for looking into this Massimo! I do not know the best way to
do this... my code is just a first reaction to making something
faster.

On Aug 11, 2:55 am, Massimo Di Pierro 
wrote:
> This is really interesting. Please give me some time to study it,
> meanwhile, so that I do not forget, please open an issue and post the
> code there.
>
> Massimo
>
> On Aug 10, 7:11 pm, MichaelToomim wrote:
>
>
>
>
>
>
>
> > Ok. The basic idea is to allow you to define helpers methods on rows,
> > sort of like the Models of rails/django.
>
> > You use it like this... I put this in models/db_methods.py:
>
> > @extra_db_methods
> > class Users():
> >    def name(self):
> >       return '%s %s' % ((self.first_name or ''),
> >                         (self.last_name or ''))
> >    def fb_name(self):
> >       p = self.person()
> >       return (p and p.name) or 'Unknown dude'
> >    def person(self):
> >       return db.people(db.people.fb_id == self.fb_id)
> >    def friends(self):
> >       return [Storage(name=f[0], id=f[1])
> >               for f in sj.loads(self.friends_cache)]
>
> > @extra_db_methods
> > class People():
> >     ... etc
>
> > These are for tables db.users and db.people. It looks up the table
> > name from the class name. For each table that you want to extend, you
> > make a class and put @extra_db_methods on top.
>
> > It's implemented with the following @extra_db_methods decorator and a
> > patch to dal.py. The decorator just traverses the class, pulls out all
> > methods, and throws them into a "methods" variable on the appropriate
> > table in dal. Then the dal's parse() routine adds these methods each
> > row object, using the python type.MethodType() routine for
> > retargetting a method from one class to another object.
>
> > The downside is extending dal with yet ANOTHER way of adding methods
> > to objects. That makes 3 apis to maintain for similar things
> > (virtualfields, computedfields, and this). And I'm not sure about the
> > names (like "extra_db_methods") for these things yet. Also I think we
> > might be able to get it even faster by being more clever with python
> > inheritance in the Row class. Right now it has roughly 10% overhead on
> > selects in my tests (uncompiled code).
>
> > At the bottom of this message is the decorator that implements the
> > same functionality using the existing virtualfields mechanism and your
> > "lazy" decorator. Its downside is a 2x to 3x overhead on selects and
> > instead of self.field you have to say self..field in the
> > method bodies.
>
> > def extra_db_methods(clss):
> >    tablename = clss.__name__.lower()
> >    if not tablename in db:
> >       raise Error('There is no `%s\' table to put virtual methods in'
> >                   % tablename)
>
> >    for k in clss.__dict__.keys():
> >       method = clss.__dict__[k]
> >       if type(method).__name__ == 'function' or type(method).__name__
> > == 'instancemethod':
> >          db[tablename].methods.update({method.__name__ : method})
>
> >    return clss
>
> > --- k/web2py/gluon/dal.py       2011-08-03 16:46:39.0 -0700
> > +++ web2py/gluon/dal.py 2011-08-10 17:04:48.344795251 -0700
> > @@ -1459,6 +1459,7 @@
> >              new_rows.append(new_row)
> >          rowsobj = Rows(db, new_rows, colnames, rawrows=rows)
> >          for tablename in virtualtables:
> > +            rowsobj.setmethods(tablename, db[tablename].methods)
> >              for item in db[tablename].virtualfields:
> >                  try:
> >                      rowsobj =
> > rowsobj.setvirtualfields(**{tablename:item})
> > @@ -4559,6 +4560,7 @@
> >          tablename = tablename
> >          self.fields = SQLCallableList()
> >          self.virtualfields = []
> > +        self.methods = {}
> >          fields = list(fields)
>
> >          if db and self._db._adapter.uploads_in_blob==True:
> > @@ -5574,6 +5576,14 @@
> >          self.compact = compact
> >          self.response = rawrows
>
> > +    def setmethods(self, tablename, methods):
> > +        if len(methods) < 0: return
> > +        for row in self.records:
> > +            if tablename not in row: break # Abort on this and all
> > rows. For efficiency.
> > +            for (k,v) in methods.items():
> > +                r = row[tablename]
> > +                r.__dict__[k] = types.MethodType(v, r)
> > +        return self
> >      def setvirtualfields(self,**keyed_virtualfields):
> >          if not keyed_virtualfields:
> >              return self
>
> > ---
> > And Here's the implementation using virtualfields:
>
> > def lazy(f):
> >    def g(self,f=f):
> >        import copy
> >        self=copy.copy(self)
> >        return lambda *a,**b: f(self,*a,**b)
> >    return g
>
> > def extra_db_methods_vf(clss):
> >    ''' This decorator clears virtualfields on the table and replaces
> >        them with the methods on this class.
> >    '''
> >    # First let's make the methods lazy
> > 

[web2py] Re: downloads

2011-08-11 Thread Anthony
What does your download function look like?

On Thursday, August 11, 2011 2:48:18 PM UTC-4, peter wrote:

> I am trying to create a download routine similar to the one in 
> default.py. However I wish to download mp3 files that have not been 
> previously uploaded, so I want to just download files I specify by 
> location. I was able to get this working. However the file that is 
> shown to the user in the 'Do you want to open or save box' comes from 
> the first argument of the /default/download call. This is too 
> restrictive, as it objects eg to a file called 'harold's bossa.mp3', 
> because the apostrophe creates problems. The apostrophe would not 
> cause prolems if the name were passed in the 'vars'. However I have 
> combed the gluon files and cannot find where the magic happens that 
> copies the first argument across to the streaming routines. I have 
> tried 'tricking' the stream routines by altering request and response, 
> but to no avail. 
>
> Can any tell me where the arg gets copied to the stream routines so 
> that I can modify it (or rather modify a clone) 
>
> Thanks 
>
> Peter 
>


[web2py] downloads

2011-08-11 Thread peter
I am trying to create a download routine similar to the one in
default.py. However I wish to download mp3 files that have not been
previously uploaded, so I want to just download files I specify by
location. I was able to get this working. However the file that is
shown to the user in the 'Do you want to open or save box' comes from
the first argument of the /default/download call. This is too
restrictive, as it objects eg to a file called 'harold's bossa.mp3',
because the apostrophe creates problems. The apostrophe would not
cause prolems if the name were passed in the 'vars'. However I have
combed the gluon files and cannot find where the magic happens that
copies the first argument across to the streaming routines. I have
tried 'tricking' the stream routines by altering request and response,
but to no avail.

Can any tell me where the arg gets copied to the stream routines so
that I can modify it (or rather modify a clone)

Thanks

Peter


[web2py] web2py editor corrupting files

2011-08-11 Thread peter
I accidentally had a controller file open in two different windows,
with different edits. When I went to save the second one, the system
correctly recognised the problem and warned me about it. It offered to
'merge' the two files. I chose this option. The merged file had lost
all the carriage returns and linefeeds. (I checked with a hex editor
and they were completely gone.) So I clicked on 'revert' to go to the
previous version. Same problem, so I now had no okay version. As
python relies on indentation, this was a horrible mess to sort out.

I just tried to repeat the process on a dummy py file. I was able to
reproduce the problem exactly. It is a nasty bug as it seems to
corrupt the backup file as well as the live file, strange..

Peter


Re: [web2py] question about DAL and many objects for the same database

2011-08-11 Thread Vasile Ermicioi
http://web2py.com/book/default/chapter/06

The DAL allows multiple connections with the same database or with different
databases, even databases of different types.


Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread Mariano Reingart
We are developing an ERP for web2py:

http://code.google.com/p/gestionlibre/source/browse/ABOUT

Indeed, Alan Etkin is mostly working on it as I must finish
rad2py/ide2py, and there is other people involved too.

In a couple of months we expect to get it running with basic
functionality, if anyone can help with translations, documentation and
code (mostly models and web2py issues), it would be great!

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Thu, Aug 11, 2011 at 2:52 PM, qasimak...@gmail.com
 wrote:
> Hi,
> I am new to web2py and would surely love to work with you guys on this.
> Regards,
> Qasim
> On Thu, Aug 11, 2011 at 10:21 PM, Ross Peoples 
> wrote:
>>
>> I guess a good place to start would be with a CRM. I would be interested
>> to know if Martin is still working on it and made any progress.
>


Re: [web2py] question about DAL and many objects for the same database

2011-08-11 Thread Vasile Ermicioi
I think no


Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread pbreit
ERP is one of the most complicated types of software and typically requires 
a massive company to support it. I doubt there's a large market for 
off-the-shelf, DIY ERP. However it might make sense to pick off one of its 
components and target it to small business, for example an app that keeps 
track of personnel.

Here's a more complete description:
http://en.wikipedia.org/wiki/Enterprise_resource_planning

Evaluation-matrix might want to use a different system, too. It's currently 
down.


Re: [web2py] ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Mariano Reingart
Yes, a debian package would be great, you are welcome ;-)

Please, if you can, fill an issue in the project site so we can manage it there,

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



2011/8/11 José Luis Redrejo Rodríguez :
> Awesome, just tell me if you need a hand to package it for Debian.
>
> Regards
>
> 2011/8/11 Mariano Reingart :
>> FYI
>>
>> I am pleased to announce of ide2py, an Integrated Development
>> Environment for python and web2py.
>> Although it is still experimental, basic functionality is working:
>>
>>  * Editor with calltips and autocomplete
>>  * Shell and Debugger (breakpoints, inspection, etc.)
>>  * Repository (hg) support (add, commit, etc.)
>>  * wxPyDiff (diff viewer)
>>  * a Browser (webkit or IE) to test webpages
>>  * a Console to redirect stdio
>>  * Source code checking/validation using pep8, pyflakes and doctests
>>
>> It is built using wxPython widget toolkit and includes a minimal
>> internal server for development, where applications can be run and
>> debugged (no need to start a third-party debugger or a separate web2py
>> server).
>>
>> Usage is similar to Visual Basic IDE (i.e. keyboard shortcuts are
>> equal when possible)
>>
>> It also has PSP -Personal Software Project- support (defect
>> management, time recording log, etc.) for quality self-improvement.
>>
>> Screenshot:
>>
>> http://rad2py.googlecode.com/hg/screenshots/ide2py-0.05-ubuntu.png
>>
>> Source code and more information:
>>
>> http://code.google.com/p/rad2py
>>
>> Quick installation:
>>
>>  * Get python 2.5+ and wxpython 2.8+
>>  * Get optionally mercurial for repo support
>>  * Clone rad2py repo
>>  * Download and unzip web2py into rad2py folder
>>  * CD to rad2py/ide2py
>>  * Execute python main.py
>>  * Have fun!
>>
>> ASAP there will be installation packages for download, sorry for the
>> inconvenience.
>>
>> Comments and help are welcome!
>>
>> Best regards
>>
>> Mariano Reingart
>> http://www.sistemasagiles.com.ar
>> http://reingart.blogspot.com
>>
>


Re: [web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Mariano Reingart
It should work on a Mac, but I don't have one to test it and make a package :-(

Anyway, it should be very easy to install, just download and execute
wxPython package for your mac and python version:

http://www.wxpython.org/download.php#stable

Then, download and uncompress zip and follow the installation guide:

http://rad2py.googlecode.com/files/rad2py-0.05-experimental.zip

http://code.google.com/p/rad2py/wiki/InstallationGuide

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Thu, Aug 11, 2011 at 12:12 PM, Ross Peoples  wrote:
> Hope there's a Mac package coming soon :) This looks really good and I'm
> looking forward to trying this out.


Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread qasimak...@gmail.com
Hi,
I am new to web2py and would surely love to work with you guys on this.

Regards,
Qasim

On Thu, Aug 11, 2011 at 10:21 PM, Ross Peoples wrote:

> I guess a good place to start would be with a CRM. I would be interested to
> know if Martin is still working on it and made any progress.


Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread Ross Peoples
I guess a good place to start would be with a CRM. I would be interested to 
know if Martin is still working on it and made any progress.

Re: [web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread Richard Vézina
Martin Mulone already start a ERP project base on web2py... Don't know if he
still working on it...

Richard

On Thu, Aug 11, 2011 at 1:00 PM, Ross Peoples wrote:

> I would write an ERP for web2py, as I've kind of wanted to. My only problem
> is I don't know how ERPs really work. If I had someone explain all the
> pieces to me in detail and how they all work together, then I could probably
> write the code for it.


[web2py] Re: http://www.evaluation-matrix.com

2011-08-11 Thread Ross Peoples
I would write an ERP for web2py, as I've kind of wanted to. My only problem 
is I don't know how ERPs really work. If I had someone explain all the 
pieces to me in detail and how they all work together, then I could probably 
write the code for it.

Re: [web2py] ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread José Luis Redrejo Rodríguez
Awesome, just tell me if you need a hand to package it for Debian.

Regards

2011/8/11 Mariano Reingart :
> FYI
>
> I am pleased to announce of ide2py, an Integrated Development
> Environment for python and web2py.
> Although it is still experimental, basic functionality is working:
>
>  * Editor with calltips and autocomplete
>  * Shell and Debugger (breakpoints, inspection, etc.)
>  * Repository (hg) support (add, commit, etc.)
>  * wxPyDiff (diff viewer)
>  * a Browser (webkit or IE) to test webpages
>  * a Console to redirect stdio
>  * Source code checking/validation using pep8, pyflakes and doctests
>
> It is built using wxPython widget toolkit and includes a minimal
> internal server for development, where applications can be run and
> debugged (no need to start a third-party debugger or a separate web2py
> server).
>
> Usage is similar to Visual Basic IDE (i.e. keyboard shortcuts are
> equal when possible)
>
> It also has PSP -Personal Software Project- support (defect
> management, time recording log, etc.) for quality self-improvement.
>
> Screenshot:
>
> http://rad2py.googlecode.com/hg/screenshots/ide2py-0.05-ubuntu.png
>
> Source code and more information:
>
> http://code.google.com/p/rad2py
>
> Quick installation:
>
>  * Get python 2.5+ and wxpython 2.8+
>  * Get optionally mercurial for repo support
>  * Clone rad2py repo
>  * Download and unzip web2py into rad2py folder
>  * CD to rad2py/ide2py
>  * Execute python main.py
>  * Have fun!
>
> ASAP there will be installation packages for download, sorry for the
> inconvenience.
>
> Comments and help are welcome!
>
> Best regards
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>


[web2py] http://www.evaluation-matrix.com

2011-08-11 Thread António Ramos
http://www.evaluation-matrix.com

is this trustable?

the winner is openerp with turbo gears inside.

If as infoworld says , web2py rocks..,, than when will we have an ERP made
with web2py?



thank you


[web2py] Re: add simple field to registration

2011-08-11 Thread vapirix
Brilliant. This is why I check these boards. =D Thank you, Marin.

On Aug 11, 10:51 am, Marin Pranjic  wrote:
> Make it True on registration form, and false in login form.
>
> If reguest.args(0) == 'register': db.auth_user.xyz.writable = true
> else: ...= false
>
> On 11 Aug 2011 17:43, "vapirix"  wrote:
>
> Sure, but then how can I have them input the key on registration if
> writable is false? =D
>
> On Aug 11, 10:41 am, Marin Pranjic  wrote:
>
>
>
>
>
>
>
> > They will not if you set writ...
> > On 11 Aug 2011 17:16, "vapirix"  wrote:
>
> > The only problem with that is that ...


Re: [web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Bruno Rocha
I am using wingIDE for debug.

But not always. Most times I only need shell and prints.

http://zerp.ly/rochacbruno
Em 11/08/2011 07:49, "Mariano Reingart"  escreveu:
> There is online shell debugger (based on PDB) approach already
> included with web2py:
>
> http://code.google.com/p/web2py/issues/detail?id=156&can=1&q=debugger
>
> It need testing and some polish, but the as it depend on threads and
> locking with a command line interface, it is not ready for the casual
> user by now, so I'm now working on ide2py, a complete integrated IDE
> for web2py, including editor, shell and debugger:
>
> http://code.google.com/p/rad2py/
>
> I hope that sooner or later it will be able to debug web2py
> applications, I have to deal some threading issues.
>
> (BTW, you should be able to use any tool to debug web2py apps, I see
> no difference with django and others)
>
> Best regards,
>
> Mariano Reingart
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>
>
> On Wed, Aug 10, 2011 at 9:46 PM, Nicolas Palumbo 
wrote:
>> y, if web2py had a debugger like using pydev. But something more
>> cleverthan having to put the whole web2py directory as a project. Then
>> it'll have the same ide integration level django has. I said
>> previously i like to edit in the web when i need something fast, but
>> is not a complete ide. I saw a javascript ide,  that works good for
>> javascript and nodejs, but nothing similar for web2py.
>> this is the link:
>> http://cloud9ide.com/
>> there is a youtube video as well.
>>


[web2py] Re: Where to put the .htaccess file

2011-08-11 Thread Yannick
hi mate,
I put the .htaccess file in "/home/www-data/" directory in the same
directory as web2py dir. Now it seems to work. When i type the URL the
WWW is added in front of it like i wanted BUT the new issue is the
following:

when i type mywebsite.com it gets redirect to 
www.mywebsite.com/web2py/wsgihandler.py/

I wonder and don't understand why it goes to "/web2py/
wsgihandler.py/" ??

Please help it you know
Yannick P.


Re: [web2py] Re: add simple field to registration

2011-08-11 Thread Marin Pranjic
Make it True on registration form, and false in login form.

If reguest.args(0) == 'register': db.auth_user.xyz.writable = true
else: ...= false

On 11 Aug 2011 17:43, "vapirix"  wrote:

Sure, but then how can I have them input the key on registration if
writable is false? =D


On Aug 11, 10:41 am, Marin Pranjic  wrote:
> They will not if you set writ...

> On 11 Aug 2011 17:16, "vapirix"  wrote:
>
> The only problem with that is that ...


[web2py] question about DAL and many objects for the same database

2011-08-11 Thread Vidul Petrov
Could it be an issue if there are many DAL objects for the same
database (the RDBMS in usage is Postgres)?


[web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Massimo Di Pierro
Did you see only the 3 summary pages or the 21 pages of with more
detailed comments about each of the framework?

You need to login and you need to click on the links. technically
there are 7 articles, each of them of about 3 pages (if you login):

http://www.infoworld.com/d/application-development/pillars-python-six-python-web-frameworks-compared-169442
http://www.infoworld.com/d/application-development/pillars-python-cubicweb-web-framework-169105
http://www.infoworld.com/d/application-development/pillars-python-django-web-framework-168643
http://www.infoworld.com/d/application-development/pillars-python-pyramid-web-framework-168661
http://www.infoworld.com/d/application-development/pillars-python-webpy-web-framework-169072
http://www.infoworld.com/d/application-development/pillars-python-web2py-web-framework-168920
http://www.infoworld.com/d/application-development/pillars-python-zope-2-web-framework-168935

I can add the author emailed in March and since then, he tells me, he
has tried all of the framework and he has been asking around a lot of
questions. He certainly asked me many questions.

Massimo

On Aug 11, 10:38 am, António Ramos  wrote:
> Yes but it seems very vague dont it?
>
> What does Capability means ?
>
> Is Capability composed of many or none sub criteria?
>
> 2011/8/11 Richard Vézina 
>
>
>
>
>
>
>
> > hurray!
> > yippee!
>
> > Congrats to everyone and Thank to Massimo... It's not the same when he is
> > away from his mailbox ;-)
>
> > Richard
>
> > On Thu, Aug 11, 2011 at 8:12 AM, Massimo Di Pierro <
> > massimo.dipie...@gmail.com> wrote:
>
> >> We made it to slashdot
>
> >>http://developers.slashdot.org/story/11/08/10/2111203/Six-Python-Web-...
>
> >> Traffic (total http requests/day):
> >> 04/Aug/2011 68450
> >> 05/Aug/2011 60450
> >> 06/Aug/2011 50180
> >> 07/Aug/2011 52327
> >> 08/Aug/2011 68275
> >> 09/Aug/2011 75787
> >> 10/Aug/2011 101568
> >> 11/Aug/2011 160868 <- new record (only 13hrs out of 24)
>
> >> Traffic (distinct users):
> >> 05/Aug/2011 1854
> >> 06/Aug/2011 1638
> >> 07/Aug/2011 1459
> >> 08/Aug/2011 1972
> >> 09/Aug/2011 2102
> >> 10/Aug/2011 2496
> >> 11/Aug/2011 3367  <- new record (only 13hrs out of 24)


[web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Vidul Petrov
Congratulations!

It was high time for such recognition :-)

On Aug 10, 2:28 pm, Martín Mulone  wrote:
> http://www.infoworld.com/d/application-development/pillars-python-six...
>
> --
>  http://martin.tecnodoc.com.ar


[web2py] Re: add simple field to registration

2011-08-11 Thread vapirix
Sure, but then how can I have them input the key on registration if
writable is false? =D

On Aug 11, 10:41 am, Marin Pranjic  wrote:
> They will not if you set writable = false.
>
> Marin
>
> On 11 Aug 2011 17:16, "vapirix"  wrote:
>
> The only problem with that is that then the clients will be able to
> edit that in their profile. =D
>
> It's ok, I'll just roll my own registration page, it's not much work.
>
> On Aug 10, 11:06 pm, pbreit  wrote:
>
>
>
>
>
>
>
> > Might be easiest to display an additi...


Re: [web2py] Re: add simple field to registration

2011-08-11 Thread Marin Pranjic
They will not if you set writable = false.

Marin

On 11 Aug 2011 17:16, "vapirix"  wrote:

The only problem with that is that then the clients will be able to
edit that in their profile. =D

It's ok, I'll just roll my own registration page, it's not much work.


On Aug 10, 11:06 pm, pbreit  wrote:
> Might be easiest to display an additi...


Re: [web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread António Ramos
Yes but it seems very vague dont it?

What does Capability means ?

Is Capability composed of many or none sub criteria?



2011/8/11 Richard Vézina 

> hurray!
> yippee!
>
> Congrats to everyone and Thank to Massimo... It's not the same when he is
> away from his mailbox ;-)
>
> Richard
>
> On Thu, Aug 11, 2011 at 8:12 AM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> We made it to slashdot
>>
>>
>> http://developers.slashdot.org/story/11/08/10/2111203/Six-Python-Web-Frameworks-Compared
>>
>> Traffic (total http requests/day):
>> 04/Aug/2011 68450
>> 05/Aug/2011 60450
>> 06/Aug/2011 50180
>> 07/Aug/2011 52327
>> 08/Aug/2011 68275
>> 09/Aug/2011 75787
>> 10/Aug/2011 101568
>> 11/Aug/2011 160868 <- new record (only 13hrs out of 24)
>>
>> Traffic (distinct users):
>> 05/Aug/2011 1854
>> 06/Aug/2011 1638
>> 07/Aug/2011 1459
>> 08/Aug/2011 1972
>> 09/Aug/2011 2102
>> 10/Aug/2011 2496
>> 11/Aug/2011 3367  <- new record (only 13hrs out of 24)
>>
>>
>


[web2py] SQLFORM list bug's

2011-08-11 Thread Eric Enns
Hey,

There are quite a few bugs in SQLFORM when having a field of type 'list' (so 
'list:string', 'list:integer'). First one being when you submit and form and 
there are error's with other fields.

def error_form():
form = SQLFORM(
Field('string', 'string'),
Field('list', 'list:string'))

if form.accepts(request.vars, session, 
onvalidation=_force_string_error):
pass

return dict(form=form)

def _force_string_error(form):
form.errors.string = "blah blah"

Submitting this form with list being one entry equal to "abc" (so one box, no 
empty box after) will cause on return "abc" being iterated and each value going 
into its own box (so three boxes for list on the form).

I do have a solution for this, it involves modifying gluon/sqlhtml.py (fixes 
involve latest web2py download). The following code can be added after line 
1061:

for fieldname in self.vars:
field = self.table[fieldname]
value = self.vars[fieldname]
if field.type.startswith('list:') and not isinstance(field, (tuple, list)):
self.vars[fieldname] = value and [value] or []

Or in the controller we could have the following:

def error_form():
form = SQLFORM(
Field('string', 'string'),
Field('list', 'list:string'))

if form.accepts(request.vars, session, 
onvalidation=_force_string_error):
pass
elif form.errors:
if not isinstance(form.vars['list'], (tuple, 
list)):
form.vars['list'] = 
form.vars['list'] and [form.vars['list']] or []

return dict(form=form)

The second bug is you cannot set form.errors for a field with type list. I do 
not have a web2py fix for this but I do the following:

def error_form():
form = SQLFORM(
Field('string', 'string'),
Field('list', 'list:string'))

if form.accepts(request.vars, session, 
onvalidation=[_force_string_error, _force_list_error]):
pass
elif form.errors:
if not isinstance(form.vars['list'], (tuple, 
list)):
form.vars['list'] = 
form.vars['list'] and [form.vars['list']] or []
if form.errors.haskey('list'):

form.element(_id='no_table_list__row')[1].append(DIV(form.errors.list, 
_class='error'))

return dict(form=form)

def _force_list_error(form):
form.errors.list = "blah blah"

Looking to see what Massimo thinks, and also what the rest of the community 
think and/or if you have encountered this issue yourself.

-Eric

This communication, including any attachments, does not necessarily represent 
official policy of Seccuris Inc.
Please see http://www.seccuris.com/Contact-PrivacyPolicy.htm  for further 
details about Seccuris Inc.'s Privacy Policy.
If you have received this communication in error, please notify Seccuris Inc. 
at i...@seccuris.com or at 1-866-644-8442.



Re: [web2py] web2py vs. django for Manipulating LDAP Records?

2011-08-11 Thread Aaron Mahler
José,

  Thanks for the quick reply and the link to the subversion. I'm exploring
some of the LDAP code now to get a sense of how they are handling it.

Thanks!
 - Aaron


2011/8/11 José Luis Redrejo Rodríguez 

> There's not a dal interface to ldap, but a auth interface.
> Some of my colleagues are developing also an in house system to manage
> the schools ldap system (and using it to learn web2py). Up to now it
> can manage unix groups , users, and some kind of network hosts , all
> this info stored in ldap.
> You can access to the web interface to subversion with the application
> at
> http://desarrollo.educarex.es/linex/projects/servidoressecundaria/repository/show/controlies
>
> All the ldap "crud" tasks are done via python functions stored in the
> modules directory of the web2py application.
>
> Hope it helps.
>
> Regards.
> José L.
>
> 2011/8/11 Aaron Mahler :
> >
> >  Hello!
> >
> >  I need to write an in-house app for managing and manipulating
> > records in our LDAP environment and am evaluating which framework
> > might be the best fit. I've been writing python code for years, worked
> > with Zope in the past, etc., so lots of python frameworks are
> > attractive in that regard. web2py looks to be the easier system to
> > plunge into and I like its overall design and community. One thing
> > attracting me to django, however, is the presence of an LDAP DAL
> > (http://opensource.bolloretelecom.eu/projects/django-ldapdb/) that, in
> > theory, will allow me to interact with LDAP much like any other
> > database.
> >
> >  Does such a DAL exist for web2py? If not, do any more experienced
> > developers here have a strong opinion on how important this would be
> > in the grand scheme of things? Basically, how would you approach such
> > a project with web2py? Obviously, any queries I do about web2py and
> > ldap are flooded with discussions about LDAP authentication (the
> > dominant issue that one might expect), but little discussion of
> > interacting with an LDAP server in a more database-like fashion (and,
> > yes, I know LDAP isn't a database, per se). I saw a few queries here
> > from the past year asking about an LDAP DAL, but there appeared to be
> > no replies. Maybe something has changed since?
> >
> > Any input would be greatly appreciated!
> >  - Aaron
> >
>



-- 
Pacific Northwest Trip: http://photos.halfpress.com/northwest
halfpress: http://www.halfpress.com
Aaron's MAME Boxes - http://www.mameblog.com

Twitter: halfpress


[web2py] Re: add simple field to registration

2011-08-11 Thread vapirix
The only problem with that is that then the clients will be able to
edit that in their profile. =D

It's ok, I'll just roll my own registration page, it's not much work.

On Aug 10, 11:06 pm, pbreit  wrote:
> Might be easiest to display an additional page before the registration page.
>
> Otherwise, one approach, I think, is to add an "extra_field" and then create
> a custom validator that verifies the access code.
>
> - auth.settings.extra_fields['auth_user'].append(Field('country'))
> allows to extend auth_* tables without need of definiting a custom
> auth_* table. Must be placed before auth.define_tables()
>
> http://web2py.com/book/default/chapter/07#Custom-Validators


[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Ross Peoples
Hope there's a Mac package coming soon :) This looks really good and I'm 
looking forward to trying this out. 

Re: [web2py] web2py vs. django for Manipulating LDAP Records?

2011-08-11 Thread José Luis Redrejo Rodríguez
There's not a dal interface to ldap, but a auth interface.
Some of my colleagues are developing also an in house system to manage
the schools ldap system (and using it to learn web2py). Up to now it
can manage unix groups , users, and some kind of network hosts , all
this info stored in ldap.
You can access to the web interface to subversion with the application
at 
http://desarrollo.educarex.es/linex/projects/servidoressecundaria/repository/show/controlies

All the ldap "crud" tasks are done via python functions stored in the
modules directory of the web2py application.

Hope it helps.

Regards.
José L.

2011/8/11 Aaron Mahler :
>
>  Hello!
>
>  I need to write an in-house app for managing and manipulating
> records in our LDAP environment and am evaluating which framework
> might be the best fit. I've been writing python code for years, worked
> with Zope in the past, etc., so lots of python frameworks are
> attractive in that regard. web2py looks to be the easier system to
> plunge into and I like its overall design and community. One thing
> attracting me to django, however, is the presence of an LDAP DAL
> (http://opensource.bolloretelecom.eu/projects/django-ldapdb/) that, in
> theory, will allow me to interact with LDAP much like any other
> database.
>
>  Does such a DAL exist for web2py? If not, do any more experienced
> developers here have a strong opinion on how important this would be
> in the grand scheme of things? Basically, how would you approach such
> a project with web2py? Obviously, any queries I do about web2py and
> ldap are flooded with discussions about LDAP authentication (the
> dominant issue that one might expect), but little discussion of
> interacting with an LDAP server in a more database-like fashion (and,
> yes, I know LDAP isn't a database, per se). I saw a few queries here
> from the past year asking about an LDAP DAL, but there appeared to be
> no replies. Maybe something has changed since?
>
> Any input would be greatly appreciated!
>  - Aaron
>


Re: [web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Richard Vézina
hurray!
yippee!

Congrats to everyone and Thank to Massimo... It's not the same when he is
away from his mailbox ;-)

Richard

On Thu, Aug 11, 2011 at 8:12 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> We made it to slashdot
>
>
> http://developers.slashdot.org/story/11/08/10/2111203/Six-Python-Web-Frameworks-Compared
>
> Traffic (total http requests/day):
> 04/Aug/2011 68450
> 05/Aug/2011 60450
> 06/Aug/2011 50180
> 07/Aug/2011 52327
> 08/Aug/2011 68275
> 09/Aug/2011 75787
> 10/Aug/2011 101568
> 11/Aug/2011 160868 <- new record (only 13hrs out of 24)
>
> Traffic (distinct users):
> 05/Aug/2011 1854
> 06/Aug/2011 1638
> 07/Aug/2011 1459
> 08/Aug/2011 1972
> 09/Aug/2011 2102
> 10/Aug/2011 2496
> 11/Aug/2011 3367  <- new record (only 13hrs out of 24)
>
>


[web2py] Re: ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Massimo Di Pierro
wow!

On Aug 11, 9:43 am, Mariano Reingart  wrote:
> FYI
>
> I am pleased to announce of ide2py, an Integrated Development
> Environment for python and web2py.
> Although it is still experimental, basic functionality is working:
>
>  * Editor with calltips and autocomplete
>  * Shell and Debugger (breakpoints, inspection, etc.)
>  * Repository (hg) support (add, commit, etc.)
>  * wxPyDiff (diff viewer)
>  * a Browser (webkit or IE) to test webpages
>  * a Console to redirect stdio
>  * Source code checking/validation using pep8, pyflakes and doctests
>
> It is built using wxPython widget toolkit and includes a minimal
> internal server for development, where applications can be run and
> debugged (no need to start a third-party debugger or a separate web2py
> server).
>
> Usage is similar to Visual Basic IDE (i.e. keyboard shortcuts are
> equal when possible)
>
> It also has PSP -Personal Software Project- support (defect
> management, time recording log, etc.) for quality self-improvement.
>
> Screenshot:
>
> http://rad2py.googlecode.com/hg/screenshots/ide2py-0.05-ubuntu.png
>
> Source code and more information:
>
> http://code.google.com/p/rad2py
>
> Quick installation:
>
>  * Get python 2.5+ and wxpython 2.8+
>  * Get optionally mercurial for repo support
>  * Clone rad2py repo
>  * Download and unzip web2py into rad2py folder
>  * CD to rad2py/ide2py
>  * Execute python main.py
>  * Have fun!
>
> ASAP there will be installation packages for download, sorry for the
> inconvenience.
>
> Comments and help are welcome!
>
> Best regards
>
> Mariano Reingarthttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com


[web2py] ANN: ide2py: editor, shell and debugger for web2py (experimental)

2011-08-11 Thread Mariano Reingart
FYI

I am pleased to announce of ide2py, an Integrated Development
Environment for python and web2py.
Although it is still experimental, basic functionality is working:

 * Editor with calltips and autocomplete
 * Shell and Debugger (breakpoints, inspection, etc.)
 * Repository (hg) support (add, commit, etc.)
 * wxPyDiff (diff viewer)
 * a Browser (webkit or IE) to test webpages
 * a Console to redirect stdio
 * Source code checking/validation using pep8, pyflakes and doctests

It is built using wxPython widget toolkit and includes a minimal
internal server for development, where applications can be run and
debugged (no need to start a third-party debugger or a separate web2py
server).

Usage is similar to Visual Basic IDE (i.e. keyboard shortcuts are
equal when possible)

It also has PSP -Personal Software Project- support (defect
management, time recording log, etc.) for quality self-improvement.

Screenshot:

http://rad2py.googlecode.com/hg/screenshots/ide2py-0.05-ubuntu.png

Source code and more information:

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

Quick installation:

 * Get python 2.5+ and wxpython 2.8+
 * Get optionally mercurial for repo support
 * Clone rad2py repo
 * Download and unzip web2py into rad2py folder
 * CD to rad2py/ide2py
 * Execute python main.py
 * Have fun!

ASAP there will be installation packages for download, sorry for the
inconvenience.

Comments and help are welcome!

Best regards

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] web2py vs. django for Manipulating LDAP Records?

2011-08-11 Thread Aaron Mahler

 Hello!

  I need to write an in-house app for managing and manipulating
records in our LDAP environment and am evaluating which framework
might be the best fit. I've been writing python code for years, worked
with Zope in the past, etc., so lots of python frameworks are
attractive in that regard. web2py looks to be the easier system to
plunge into and I like its overall design and community. One thing
attracting me to django, however, is the presence of an LDAP DAL
(http://opensource.bolloretelecom.eu/projects/django-ldapdb/) that, in
theory, will allow me to interact with LDAP much like any other
database.

  Does such a DAL exist for web2py? If not, do any more experienced
developers here have a strong opinion on how important this would be
in the grand scheme of things? Basically, how would you approach such
a project with web2py? Obviously, any queries I do about web2py and
ldap are flooded with discussions about LDAP authentication (the
dominant issue that one might expect), but little discussion of
interacting with an LDAP server in a more database-like fashion (and,
yes, I know LDAP isn't a database, per se). I saw a few queries here
from the past year asking about an LDAP DAL, but there appeared to be
no replies. Maybe something has changed since?

Any input would be greatly appreciated!
 - Aaron


[web2py] Re: web2py book multilanguage

2011-08-11 Thread Massimo Di Pierro
True. I am hoping for a 4rd edition in one month. hold on!

Massimo

On Aug 11, 9:13 am, Mirek Zvolský  wrote:
> But, it's proper time to make new translations?
> There will be no update of the english book in short time? Because I
> think there are small mistakes and, more important, there is lot of
> new features not documented yet.
>
> If there will be future changes in book, should not be good to have
> something like Version Control, so if english version is updated,
> changed places could be easy find for the translation?
>
> And proper format for the translation? I think HTML, content of  class="page article">
>
> Mirek


[web2py] Re: web2py book multilanguage

2011-08-11 Thread Mirek Zvolský
But, it's proper time to make new translations?
There will be no update of the english book in short time? Because I
think there are small mistakes and, more important, there is lot of
new features not documented yet.

If there will be future changes in book, should not be good to have
something like Version Control, so if english version is updated,
changed places could be easy find for the translation?

And proper format for the translation? I think HTML, content of 

Mirek


[web2py] Re: how do I use new simplejson?

2011-08-11 Thread Carl
I've upgraded to Web2Py 1.98.2 (by deleting my existing web2py files
rather than overwriting)

When Web2py is given this to parse in json
dict: {'m...@carlroach.com': {: False, : False, 'scores': False}}

I get an exception that lazyT isn't a string.

1.98.2 is supposed to translate lazyT into a string. What point have I
missed?



On Aug 11, 12:14 pm, Carl  wrote:
> I'm using @service.jsonrpc as a decorator to controller functions and
> setting service=Service(globals()) in db.py
>
> what needs to change to move to the new simplejson that later versions
> of Web2py uses?
> I'd like to have datetime and T objects translated into strings so
> want to move to the better approach.


[web2py] Re: web2py book multilanguage

2011-08-11 Thread DenesL

It would be nice to centralize the Spanish version from
http://www.latinuxpress.com/books/drafts/web2py/


On Aug 11, 5:23 am, Massimo Di Pierro 
wrote:
> The web2py book onlinehttp://web2py.com/bookis not multilanguage.
>
> If your browser is set to English it is in Eglish
> If your browser is set to Italian it is in Italian (traduzione di
> Giovanni Cannata)
>
> I do not have other translations but I can enable them if you have
> them. Let me know.
>
> massimo


[web2py] Re: plugin_wiki problem?

2011-08-11 Thread Massimo Di Pierro
yes.

On Aug 11, 7:45 am, Anthony  wrote:
> I wonder if it has something to do with this recent 
> fix:http://code.google.com/p/web2py/source/detail?r=27c08cc67424e945d0fa1
> Is the problem still there in trunk?
>
> Anthony
>
>
>
>
>
>
>
> On Thursday, August 11, 2011 1:57:46 AM UTC-4, mart wrote:
> > hi,
>
> > i am writing some documentation and using plugin_wiki. When i add
> > something like:
> > ``
> > 
> >  >   dist_directory="dist"
> >   buildCategory="component"
> >   release_prefix="2.9.1"
> >   name="android_291_VF_UK"
> >   device_platform="android"
> >   branchname="2.9.1"
> >   branch="branches/2.9.1"
> >   depot="dev_porting"
> >   CLIENT_DEPOT="dev_client"
> >   CLIENT_BRANCH="branches/2.9.1">``:code_html     (have also tried
> > using code_python)
>
> > I get an error saying "enter 0 to 512 characters". I downloaded the
> > latest cube2py and copied the wiki specific files to my app and am
> > still getting the same error. But I have no issues doing this in the
> > cube2py application.
>
> > Note: previously written pages are fine, this just seems to happen
> > with new pages.
>
> > Any idea?
>
> > thanks,
> > Mart :)


[web2py] Re: plugin_wiki problem?

2011-08-11 Thread Anthony
I wonder if it has something to do with this recent fix: 
http://code.google.com/p/web2py/source/detail?r=27c08cc67424e945d0fa18372b00a6dcd9a23be9.
 
Is the problem still there in trunk?
 
Anthony

On Thursday, August 11, 2011 1:57:46 AM UTC-4, mart wrote:

> hi, 
>
> i am writing some documentation and using plugin_wiki. When i add 
> something like: 
> `` 
>  
>dist_directory="dist" 
>   buildCategory="component" 
>   release_prefix="2.9.1" 
>   name="android_291_VF_UK" 
>   device_platform="android" 
>   branchname="2.9.1" 
>   branch="branches/2.9.1" 
>   depot="dev_porting" 
>   CLIENT_DEPOT="dev_client" 
>   CLIENT_BRANCH="branches/2.9.1">``:code_html (have also tried 
> using code_python) 
>
> I get an error saying "enter 0 to 512 characters". I downloaded the 
> latest cube2py and copied the wiki specific files to my app and am 
> still getting the same error. But I have no issues doing this in the 
> cube2py application. 
>
> Note: previously written pages are fine, this just seems to happen 
> with new pages. 
>
> Any idea? 
>
> thanks, 
> Mart :)



Re: [web2py] Re: RFC about issue

2011-08-11 Thread Ross Peoples
+1

[web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Massimo Di Pierro
We made it to slashdot

http://developers.slashdot.org/story/11/08/10/2111203/Six-Python-Web-Frameworks-Compared

Traffic (total http requests/day):
04/Aug/2011 68450
05/Aug/2011 60450
06/Aug/2011 50180
07/Aug/2011 52327
08/Aug/2011 68275
09/Aug/2011 75787
10/Aug/2011 101568
11/Aug/2011 160868 <- new record (only 13hrs out of 24)

Traffic (distinct users):
05/Aug/2011 1854
06/Aug/2011 1638
07/Aug/2011 1459
08/Aug/2011 1972
09/Aug/2011 2102
10/Aug/2011 2496
11/Aug/2011 3367  <- new record (only 13hrs out of 24)



Re: [web2py] Re: RFC about issue

2011-08-11 Thread Martín Mulone
+1

I'm doing this, to display  for example error messages  using css.

div.error {
text-transform:capitalize;

}

2011/8/11 Anthony 

> +1
>
> On Thursday, August 11, 2011 6:24:30 AM UTC-4, Massimo Di Pierro wrote:
>
>> What do people think?
>>
>> http://code.google.com/p/**web2py/issues/detail?id=370
>>
>> I do not have a strong opinion.
>
>


-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: RFC about issue

2011-08-11 Thread Anthony
+1

On Thursday, August 11, 2011 6:24:30 AM UTC-4, Massimo Di Pierro wrote:

> What do people think? 
>
> http://code.google.com/p/web2py/issues/detail?id=370 
>
> I do not have a strong opinion.



Re: [web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Ross Peoples
Mariano,

The IDE sounds awesome! I am really looking forward to seeing this.


[web2py] Re: Mix query and string types?

2011-08-11 Thread Massimo Di Pierro
Good point... You can subclass them. Problem is this is how they work:

Consider

db.table.field.something()

db.table.field is a Field with Extends expression

"something" is a method of Field or Expression and delegates to

self.table.field.db._adapter.SOMETHING()

which performs the action.

So adding a feature is not as easy as extending or subclassing a
class. Most actions involved two or more classes. Implementing a new
feature requires two steps:
- adding an API at the web2py layer (Field, Expression, Rows, etc).
- adding a translation for each supported adapter (they all extend
BaseAdapter).



On Aug 6, 12:41 am, pbreit  wrote:
> I'm taking a closer look at this again. Can I subclass or extend DAL or do I
> have to edit dal.py directly?
>
> I was trying to do this with executesql and one problem I ran into is that
> my virtualfields did not seem to be coming through. Is that expected?


[web2py] Re: issue RFC

2011-08-11 Thread Ross Peoples
I'd be fine with either way. Easily minifying JS and CSS would be nice too 
(even though this would be more difficult to implement), as that's the one 
thing that always gives my apps a low score when running speed test tools is 
the lack of minification.

[web2py] issue RFC

2011-08-11 Thread Massimo Di Pierro
Should this go in trunk? Perhaps in contrib or as an option for
render? Not at all?

http://code.google.com/p/web2py/issues/detail?id=369#makechanges


[web2py] Re: FYI jQuery Events Stop (Mis)Using Return False

2011-08-11 Thread Massimo Di Pierro
This has been addressed in trunk but not tested. Can you check your
{{=LOAD(...)}} forms still work with the new web2py_ajax.js in trunk.

You will need to install trunk and cp static/js/web2py_ajax.js into
your existing app and/or make a new minimalist app from scratch.


On Aug 8, 8:44 am, DenesL  wrote:
> http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/


[web2py] how do I use new simplejson?

2011-08-11 Thread Carl
I'm using @service.jsonrpc as a decorator to controller functions and
setting service=Service(globals()) in db.py

what needs to change to move to the new simplejson that later versions
of Web2py uses?
I'd like to have datetime and T objects translated into strings so
want to move to the better approach.


[web2py] Re: JQuery Mobile

2011-08-11 Thread António Ramos
I replaced "jQuery" for $ and still the page is blank!


Em 11 de agosto de 2011 11:16, António Ramos escreveu:

> Hello,
> i had troubles using jquery mobile plugin.
> It did not fit properly in my samsung galaxy.
> The buttons and text boxes are too small.
> Something is not ok
> so i bought a book about jquery mobile.
> I did not include the jquery mobile layout and  it works ok now.
>
> The problem is, i need a date picker and in the following example i i
> include the script in bold the page is blank in the browser.
> without the script it works ok except the date picker.
>
> Can anyone tell me what i´m doing wrong?
>
> This is my view (notice no include layout!)
>
>
>
> 
> 
> 
> LIMS CIRES
> 
> 
> http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css"; />
> http://code.jquery.com/jquery-1.6.2.min.js";>
> http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js";>
> http://demo.mobiscroll.com/css/jquery.scroller-1.0.2.css";
> rel="stylesheet" type="text/css" />
> 
> body {
> font-family: arial, verdana, sans-serif;
> font-size: 12px;
> }
> 
>
>
> 
> 
> *
> jQuery(document).ready(function () {
> jQuery('#StartD').scroller();
> jQuery('#EndD').scroller();
> wheels = [];
> wheels[0] = { 'Hours': {} };
> wheels[1] = { 'Minutes': {} };
> for (var i = 0; i < 60; i++) {
> if (i < 16) wheels[0]['Hours'][i] = (i < 10) ? ('0' + i) : i;
> wheels[1]['Minutes'][i] = (i < 10) ? ('0' + i) : i;
> }
> jQuery('#custom').scroller({
> width: 90,
> wheels: wheels,
> formatResult: function (d) {
> return ((d[0] - 0) + ((d[1] - 0) / 60)).toFixed(1);
> },
> parseValue: function (s) {
> var d = s.split('.');
> d[0] = d[0] - 0;
> d[1] = d[1] ? ((('0.' + d[1]) - 0) * 60) : 0;
> return d;
> }
> });
>
> });
> *
>
>
>
>
>
> 
> 
> TITLE HERE
> 
> 
>
>
>
>
>
>  method="post">
> 
> Date
> 
> 
> 
> Date
>  readonly="readonly" value="07/18/2011" />
> 
>
> 
> Ponto Colheita
> 
> {{for x in PontoC:}}
> {{=x}}
> {{pass}}
> 
> 
> 
> Produto
> 
> {{for x in Product:}}
> {{=x}}
> {{pass}}
> 
> 
> 
> Tipo
> 
> {{for x in Tipo:}}
> {{=x}}
> {{pass}}
> 
> 
>
>  data-icon="search">Pesquisar
>
> 
> 
> 
> 
> 
>
>
> thank you
>


Re: [web2py] Re: infoworld put web2py in the top of python frameworks

2011-08-11 Thread Mariano Reingart
There is online shell debugger (based on PDB) approach already
included with web2py:

http://code.google.com/p/web2py/issues/detail?id=156&can=1&q=debugger

It need testing and some polish, but the as it depend on threads and
locking with a command line interface, it is not ready for the casual
user by now, so I'm now working on ide2py, a complete integrated IDE
for web2py, including editor, shell and debugger:

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

I hope that sooner or later it will be able to debug web2py
applications, I have to deal some threading issues.

(BTW, you should be able to use any tool to debug web2py apps, I see
no difference with django and others)

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, Aug 10, 2011 at 9:46 PM, Nicolas Palumbo  wrote:
> y, if web2py had a debugger like using pydev. But something more
> cleverthan having to put the whole web2py directory as a project. Then
> it'll have the same ide integration level django has. I said
> previously i like to edit in the web when i need something fast, but
> is not a complete ide. I saw a javascript ide,  that works good for
> javascript and nodejs, but nothing similar for web2py.
> this is the link:
> http://cloud9ide.com/
> there is a youtube video as well.
>


[web2py] RFC about issue

2011-08-11 Thread Massimo Di Pierro
What do people think?

http://code.google.com/p/web2py/issues/detail?id=370

I do not have a strong opinion.


[web2py] JQuery Mobile

2011-08-11 Thread António Ramos
Hello,
i had troubles using jquery mobile plugin.
It did not fit properly in my samsung galaxy.
The buttons and text boxes are too small.
Something is not ok
so i bought a book about jquery mobile.
I did not include the jquery mobile layout and  it works ok now.

The problem is, i need a date picker and in the following example i i
include the script in bold the page is blank in the browser.
without the script it works ok except the date picker.

Can anyone tell me what i´m doing wrong?

This is my view (notice no include layout!)






LIMS CIRES


http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css"; />
http://code.jquery.com/jquery-1.6.2.min.js";>
http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js";>
http://demo.mobiscroll.com/css/jquery.scroller-1.0.2.css";
rel="stylesheet" type="text/css" />

body {
font-family: arial, verdana, sans-serif;
font-size: 12px;
}





*
jQuery(document).ready(function () {
jQuery('#StartD').scroller();
jQuery('#EndD').scroller();
wheels = [];
wheels[0] = { 'Hours': {} };
wheels[1] = { 'Minutes': {} };
for (var i = 0; i < 60; i++) {
if (i < 16) wheels[0]['Hours'][i] = (i < 10) ? ('0' + i) : i;
wheels[1]['Minutes'][i] = (i < 10) ? ('0' + i) : i;
}
jQuery('#custom').scroller({
width: 90,
wheels: wheels,
formatResult: function (d) {
return ((d[0] - 0) + ((d[1] - 0) / 60)).toFixed(1);
},
parseValue: function (s) {
var d = s.split('.');
d[0] = d[0] - 0;
d[1] = d[1] ? ((('0.' + d[1]) - 0) * 60) : 0;
return d;
}
});

});
*







TITLE HERE









Date



Date




Ponto Colheita

{{for x in PontoC:}}
{{=x}}
{{pass}}



Produto

{{for x in Product:}}
{{=x}}
{{pass}}



Tipo

{{for x in Tipo:}}
{{=x}}
{{pass}}



Pesquisar








thank you


[web2py] Re: Bug in virtualfields w/ session

2011-08-11 Thread Massimo Di Pierro
This is really interesting. Please give me some time to study it,
meanwhile, so that I do not forget, please open an issue and post the
code there.

Massimo

On Aug 10, 7:11 pm, Michael Toomim  wrote:
> Ok. The basic idea is to allow you to define helpers methods on rows,
> sort of like the Models of rails/django.
>
> You use it like this... I put this in models/db_methods.py:
>
> @extra_db_methods
> class Users():
>    def name(self):
>       return '%s %s' % ((self.first_name or ''),
>                         (self.last_name or ''))
>    def fb_name(self):
>       p = self.person()
>       return (p and p.name) or 'Unknown dude'
>    def person(self):
>       return db.people(db.people.fb_id == self.fb_id)
>    def friends(self):
>       return [Storage(name=f[0], id=f[1])
>               for f in sj.loads(self.friends_cache)]
>
> @extra_db_methods
> class People():
>     ... etc
>
> These are for tables db.users and db.people. It looks up the table
> name from the class name. For each table that you want to extend, you
> make a class and put @extra_db_methods on top.
>
> It's implemented with the following @extra_db_methods decorator and a
> patch to dal.py. The decorator just traverses the class, pulls out all
> methods, and throws them into a "methods" variable on the appropriate
> table in dal. Then the dal's parse() routine adds these methods each
> row object, using the python type.MethodType() routine for
> retargetting a method from one class to another object.
>
> The downside is extending dal with yet ANOTHER way of adding methods
> to objects. That makes 3 apis to maintain for similar things
> (virtualfields, computedfields, and this). And I'm not sure about the
> names (like "extra_db_methods") for these things yet. Also I think we
> might be able to get it even faster by being more clever with python
> inheritance in the Row class. Right now it has roughly 10% overhead on
> selects in my tests (uncompiled code).
>
> At the bottom of this message is the decorator that implements the
> same functionality using the existing virtualfields mechanism and your
> "lazy" decorator. Its downside is a 2x to 3x overhead on selects and
> instead of self.field you have to say self..field in the
> method bodies.
>
> def extra_db_methods(clss):
>    tablename = clss.__name__.lower()
>    if not tablename in db:
>       raise Error('There is no `%s\' table to put virtual methods in'
>                   % tablename)
>
>    for k in clss.__dict__.keys():
>       method = clss.__dict__[k]
>       if type(method).__name__ == 'function' or type(method).__name__
> == 'instancemethod':
>          db[tablename].methods.update({method.__name__ : method})
>
>    return clss
>
> --- k/web2py/gluon/dal.py       2011-08-03 16:46:39.0 -0700
> +++ web2py/gluon/dal.py 2011-08-10 17:04:48.344795251 -0700
> @@ -1459,6 +1459,7 @@
>              new_rows.append(new_row)
>          rowsobj = Rows(db, new_rows, colnames, rawrows=rows)
>          for tablename in virtualtables:
> +            rowsobj.setmethods(tablename, db[tablename].methods)
>              for item in db[tablename].virtualfields:
>                  try:
>                      rowsobj =
> rowsobj.setvirtualfields(**{tablename:item})
> @@ -4559,6 +4560,7 @@
>          tablename = tablename
>          self.fields = SQLCallableList()
>          self.virtualfields = []
> +        self.methods = {}
>          fields = list(fields)
>
>          if db and self._db._adapter.uploads_in_blob==True:
> @@ -5574,6 +5576,14 @@
>          self.compact = compact
>          self.response = rawrows
>
> +    def setmethods(self, tablename, methods):
> +        if len(methods) < 0: return
> +        for row in self.records:
> +            if tablename not in row: break # Abort on this and all
> rows. For efficiency.
> +            for (k,v) in methods.items():
> +                r = row[tablename]
> +                r.__dict__[k] = types.MethodType(v, r)
> +        return self
>      def setvirtualfields(self,**keyed_virtualfields):
>          if not keyed_virtualfields:
>              return self
>
> ---
> And Here's the implementation using virtualfields:
>
> def lazy(f):
>    def g(self,f=f):
>        import copy
>        self=copy.copy(self)
>        return lambda *a,**b: f(self,*a,**b)
>    return g
>
> def extra_db_methods_vf(clss):
>    ''' This decorator clears virtualfields on the table and replaces
>        them with the methods on this class.
>    '''
>    # First let's make the methods lazy
>    for k in clss.__dict__.keys():
>       if type(getattr(clss, k)).__name__ == 'instancemethod':
>          setattr(clss, k, lazy(getattr(clss, k)))
>
>    tablename = clss.__name__.lower()
>    if not tablename in db:
>       raise Error('There is no `%s\' table to put virtual methods in'
> % tablename)
>    del db[tablename].virtualfields[:] # We clear virtualfields each
> time
>    db[tablename].virtualfields.append(clss())
>    return clss
>
> You use this just like be

[web2py] Re: Error in compileapp

2011-08-11 Thread Massimo Di Pierro
You must have a view somewhere (perhaps unused) that extends
'layout.html' and you no longer have it.

On Aug 11, 1:29 am, Adi  wrote:
> I'm getting this error when I try to compile the application from the
> command line:
>
> python -c "import gluon.compileapp;
> gluon.compileapp.compile_application('applications/api')"
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "gluon/compileapp.py", line 547, in compile_application
>     compile_views(folder)
>   File "gluon/compileapp.py", line 318, in compile_views
>     data = parse_template(file, path)
>   File "gluon/template.py", line 821, in parse_template
>     return str(TemplateParser(text, context=context, path=path,
> lexers=lexers, delimiters=delimiters))
>   File "gluon/template.py", line 315, in __init__
>     self.parse(text)
>   File "gluon/template.py", line 794, in parse
>     self.extend(extend)
>   File "gluon/template.py", line 465, in extend
>     text = self._get_file_text(filename)
>   File "gluon/template.py", line 430, in _get_file_text
>     filename = eval(filename, self.context)
>   File "", line 1, in 
> NameError: name 'layout' is not defined
>
> I'm not sure, but will having extra layout files like m_layout.html
> (mobile version) be a problem?


  1   2   >