[web2py] Re: large sites/application.

2010-05-13 Thread mdipierro
I assume those tables are not all referencing each other but they can
be group based on their function and the groups can be organized in a
tree where the children may refer a table in the parent group. I would
create a module for each group of tables and have a function in the
module that takes db and creates the table. In the development phase I
would import all modules in one model file in the proper order. If
this is slow, in production, move the imports into the controllers (or
the actions) that need the tables.

It may also be a good idea to do most of the settings
db.table.field.attribute=whatever in the actions that generates the
forms as opposed to the models.

Anyway 30 tables should not be a problem but make sure migrate=False
for speed and bytecde compiled the app.

Massimo

> On Thu, May 13, 2010 at 23:07, Thadeus Burgess  wrote:
> > But the problem with web2py is that what if you don't want portal
> > models to execute when they are on the public portion of the site? But
> > the public depends on the portals models and visa versa. No matter
> > which way you hash it, your going to have a massive web2py spaghetti
> > on your plate with some giant meatballs. =)
>
> > If your not a stickler for perfection and don't mind everything being
> > pulled in regardless of where they are in your site, you should be
> > fine.
>
> > Currently, it is not an appropriate solution to even put the models in
> > an external file that can be imported by each app, as the way web2py
> > works your not supposed to "import" your models... yes you can make a
> > function and pass your db object, but like I said, plate of spaghetti.
>
> What we can do (developers) to solve this problem?
>
>
>
> > --
> > Thadeus
>
> > On Thu, May 13, 2010 at 7:54 PM, Alexandre Andrade
> >  wrote:
> >> to build large app, you can:
>
> >> 1. split you tables over several models, like
> >> db.py
> >> db_000_user_management.py
> >> db_001_portal.py
> >> db_002_ecommerce.py
>
> >> and so on.
>
> >> 2. split your code and html over several controllers:
>
> >> default.py
> >> portal.py
> >> shop.py
>
> >> views/default/*.html
> >> views/portal/*.html
> >> views/shop/*.html
>
> >>  and so on.
>
> >> --
> >> Atenciosamente
>
> >> --
> >> =
> >> Alexandre Andrade
> >> Hipercenter.com
>
> >> 2010/5/13 thedangler 
>
> >>> I'm confused when to make apps. I'll be making a pretty decent size
> >>> website and it has over 30 tables. The site will have different
> >>> functionalities and for the most part i have only seen code for apps
> >>> that do two or one thing.
>
> >>> So do i make multiple apps. If so how do i know when to make a new
> >>> one. If not is there a proper way to build large applications.
>
> >>> Thank you.
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141


Re: [web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Jason Brower
Do we need any hosting? I can provide that if needed. I am using dreamhost and 
have a virtual server there.
BR,
Jason

- Original message -
> I agree.
>
> On May 13, 9:02 pm, Thadeus Burgess  wrote:
> > Massimo, we can take the ideas for plugin metadata and use it for
> > applications as well?
> >
> > Change the name from plugincentral to web2pycentral. We can start an
> > open source version of the web2pycentral and decide who can work on
> > it.
> >
> > --
> > Thadeus
> >
> > On Thu, May 13, 2010 at 2:07 PM, Jason Brower  wrote:
> > > I say we move forward with this one as it doesn't need so much work as
> > > with the plugins.  At least at first thought.  It's just additional
> > > metadata in the application.  I think some simple xml/html would do the
> > > trick.  Just what data if for someone else to think about. :D
> > > But I think it's awesome.
> > > Best Regards,
> > > Jason Brower
> >
> > > On Thu, 2010-05-13 at 09:13 -0700, mdipierro wrote:
> > > > This is a good idea.
> >
> > > > On May 13, 11:09 am, blackthorne  wrote:
> > > > > ok, this one may be interesting...
> >
> > > > > Currently, we can install web2py apps in one of 3 ways. uploading it,
> > > > > providing its url or putting the files in the applications folder
> > > > > manually. Nothing wrong with this but seems to me that with little
> > > > > effort we could take this beyond.
> > > > > Think about an integrated (web) interface that  allowed you to search
> > > > > or browser appliances and show its details when requested. This could
> > > > > happen inside the web2py framework and you could even install it by
> > > > > pressing a button (actually it just needs to use the already existing
> > > > > "download/provide url" option inside).
> > > > > I think this could improve user/developer experience but that's not
> > > > > all...
> > > > > Applications could have versions, and a changelog that could make part
> > > > > of the details of the application and an "update" option, so that
> > > > > users could keep all their apps on the edge.
> >
> > > > > Who's with me?
> >
> > > > > Thank you, best regards



[web2py] Re: Idea: Appliance remote management

2010-05-13 Thread mdipierro
I agree.

On May 13, 9:02 pm, Thadeus Burgess  wrote:
> Massimo, we can take the ideas for plugin metadata and use it for
> applications as well?
>
> Change the name from plugincentral to web2pycentral. We can start an
> open source version of the web2pycentral and decide who can work on
> it.
>
> --
> Thadeus
>
> On Thu, May 13, 2010 at 2:07 PM, Jason Brower  wrote:
> > I say we move forward with this one as it doesn't need so much work as
> > with the plugins.  At least at first thought.  It's just additional
> > metadata in the application.  I think some simple xml/html would do the
> > trick.  Just what data if for someone else to think about. :D
> > But I think it's awesome.
> > Best Regards,
> > Jason Brower
>
> > On Thu, 2010-05-13 at 09:13 -0700, mdipierro wrote:
> >> This is a good idea.
>
> >> On May 13, 11:09 am, blackthorne  wrote:
> >> > ok, this one may be interesting...
>
> >> > Currently, we can install web2py apps in one of 3 ways. uploading it,
> >> > providing its url or putting the files in the applications folder
> >> > manually. Nothing wrong with this but seems to me that with little
> >> > effort we could take this beyond.
> >> > Think about an integrated (web) interface that  allowed you to search
> >> > or browser appliances and show its details when requested. This could
> >> > happen inside the web2py framework and you could even install it by
> >> > pressing a button (actually it just needs to use the already existing
> >> > "download/provide url" option inside).
> >> > I think this could improve user/developer experience but that's not
> >> > all...
> >> > Applications could have versions, and a changelog that could make part
> >> > of the details of the application and an "update" option, so that
> >> > users could keep all their apps on the edge.
>
> >> > Who's with me?
>
> >> > Thank you, best regards


Re: [web2py] large sites/application.

2010-05-13 Thread Álvaro Justen
On Thu, May 13, 2010 at 23:07, Thadeus Burgess  wrote:
> But the problem with web2py is that what if you don't want portal
> models to execute when they are on the public portion of the site? But
> the public depends on the portals models and visa versa. No matter
> which way you hash it, your going to have a massive web2py spaghetti
> on your plate with some giant meatballs. =)
>
> If your not a stickler for perfection and don't mind everything being
> pulled in regardless of where they are in your site, you should be
> fine.
>
> Currently, it is not an appropriate solution to even put the models in
> an external file that can be imported by each app, as the way web2py
> works your not supposed to "import" your models... yes you can make a
> function and pass your db object, but like I said, plate of spaghetti.

What we can do (developers) to solve this problem?

> --
> Thadeus
>
>
>
>
>
> On Thu, May 13, 2010 at 7:54 PM, Alexandre Andrade
>  wrote:
>> to build large app, you can:
>>
>> 1. split you tables over several models, like
>> db.py
>> db_000_user_management.py
>> db_001_portal.py
>> db_002_ecommerce.py
>>
>> and so on.
>>
>> 2. split your code and html over several controllers:
>>
>> default.py
>> portal.py
>> shop.py
>>
>> views/default/*.html
>> views/portal/*.html
>> views/shop/*.html
>>
>>
>>  and so on.
>>
>> --
>> Atenciosamente
>>
>> --
>> =
>> Alexandre Andrade
>> Hipercenter.com
>>
>>
>> 2010/5/13 thedangler 
>>>
>>> I'm confused when to make apps. I'll be making a pretty decent size
>>> website and it has over 30 tables. The site will have different
>>> functionalities and for the most part i have only seen code for apps
>>> that do two or one thing.
>>>
>>> So do i make multiple apps. If so how do i know when to make a new
>>> one. If not is there a proper way to build large applications.
>>>
>>> Thank you.
>>
>>
>>
>>
>>
>



-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


Re: [web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Thadeus Burgess
Massimo, we can take the ideas for plugin metadata and use it for
applications as well?

Change the name from plugincentral to web2pycentral. We can start an
open source version of the web2pycentral and decide who can work on
it.

--
Thadeus





On Thu, May 13, 2010 at 2:07 PM, Jason Brower  wrote:
> I say we move forward with this one as it doesn't need so much work as
> with the plugins.  At least at first thought.  It's just additional
> metadata in the application.  I think some simple xml/html would do the
> trick.  Just what data if for someone else to think about. :D
> But I think it's awesome.
> Best Regards,
> Jason Brower
>
> On Thu, 2010-05-13 at 09:13 -0700, mdipierro wrote:
>> This is a good idea.
>>
>> On May 13, 11:09 am, blackthorne  wrote:
>> > ok, this one may be interesting...
>> >
>> > Currently, we can install web2py apps in one of 3 ways. uploading it,
>> > providing its url or putting the files in the applications folder
>> > manually. Nothing wrong with this but seems to me that with little
>> > effort we could take this beyond.
>> > Think about an integrated (web) interface that  allowed you to search
>> > or browser appliances and show its details when requested. This could
>> > happen inside the web2py framework and you could even install it by
>> > pressing a button (actually it just needs to use the already existing
>> > "download/provide url" option inside).
>> > I think this could improve user/developer experience but that's not
>> > all...
>> > Applications could have versions, and a changelog that could make part
>> > of the details of the application and an "update" option, so that
>> > users could keep all their apps on the edge.
>> >
>> > Who's with me?
>> >
>> > Thank you, best regards
>
>
>


Re: [web2py] large sites/application.

2010-05-13 Thread Thadeus Burgess
But the problem with web2py is that what if you don't want portal
models to execute when they are on the public portion of the site? But
the public depends on the portals models and visa versa. No matter
which way you hash it, your going to have a massive web2py spaghetti
on your plate with some giant meatballs. =)

If your not a stickler for perfection and don't mind everything being
pulled in regardless of where they are in your site, you should be
fine.

Currently, it is not an appropriate solution to even put the models in
an external file that can be imported by each app, as the way web2py
works your not supposed to "import" your models... yes you can make a
function and pass your db object, but like I said, plate of spaghetti.

--
Thadeus





On Thu, May 13, 2010 at 7:54 PM, Alexandre Andrade
 wrote:
> to build large app, you can:
>
> 1. split you tables over several models, like
> db.py
> db_000_user_management.py
> db_001_portal.py
> db_002_ecommerce.py
>
> and so on.
>
> 2. split your code and html over several controllers:
>
> default.py
> portal.py
> shop.py
>
> views/default/*.html
> views/portal/*.html
> views/shop/*.html
>
>
>  and so on.
>
> --
> Atenciosamente
>
> --
> =
> Alexandre Andrade
> Hipercenter.com
>
>
> 2010/5/13 thedangler 
>>
>> I'm confused when to make apps. I'll be making a pretty decent size
>> website and it has over 30 tables. The site will have different
>> functionalities and for the most part i have only seen code for apps
>> that do two or one thing.
>>
>> So do i make multiple apps. If so how do i know when to make a new
>> one. If not is there a proper way to build large applications.
>>
>> Thank you.
>
>
>
>
>


Re: [web2py] large sites/application.

2010-05-13 Thread Alexandre Andrade
to build large app, you can:

1. split you tables over several models, like
db.py
db_000_user_management.py
db_001_portal.py
db_002_ecommerce.py

and so on.

2. split your code and html over several controllers:

default.py
portal.py
shop.py

views/default/*.html
views/portal/*.html
views/shop/*.html


 and so on.

-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com


2010/5/13 thedangler 

> I'm confused when to make apps. I'll be making a pretty decent size
> website and it has over 30 tables. The site will have different
> functionalities and for the most part i have only seen code for apps
> that do two or one thing.
>
> So do i make multiple apps. If so how do i know when to make a new
> one. If not is there a proper way to build large applications.
>
> Thank you.
>


[web2py] Re: hello

2010-05-13 Thread Graham Dumpleton


On May 13, 8:51 pm, ciprian  wrote:
> thanks for trying to help. but i already spent two days trying to
> figure it out. i can install web2py with no problems - but i dont have
> too much experience withmod_wsgi(google doesnt help) no web2py
> tutorials and i guess this is the end. i really need to run php too on
> the same apache but i cant. So i guess this is the end!
> So message for the comunity if someone cares anyways! even if i will
> remain a web2py fan - i wont use it for my bussiness, because it lacks
> where i needed it most.
> Some might call me a noob, whatever - i just dont know how to config
> the damnmod_wsgi. i am sure there are at least 100 in this world who
> have tried this and felt the same frustration i did. So like a project
> in future - write a tutorial on how to install web2py and php both
> running on the same server. ruby on rails have like 1000 tutorials on
> subject!

If you need mod_wsgi it helps if you use the correct forum. Read:

  http://code.google.com/p/modwsgi/wiki/WhereToGetHelp

You can quite happily interleave PHP and mod_wsgi (web2py) on the same
Apache server.

How you do that is based on configurations described in:

  
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

If you are the sort however who expects tailored documentation which
satisfies your exact setup or combination of packages you will forever
never find what you want. This is because there are too many
variations and no one can documentation all of them. Thus you
generally will have no choice to learn the fundamentals of how systems
work and if you still don't understand use the correct forums to get
help when needed.

Graham

> Best Regards!
>
> On May 12, 5:16 pm, Álvaro Justen  wrote:
>
>
>
> > On Tue, May 11, 2010 at 18:39, ciprian  wrote:
> > > i used this script to install web2py:
> > >http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> > > so i have everything in www-data
> > > and everything works fine.
>
> > > now..what do i have to install to make php work on the same folder? or
> > > what do i have to config. i have a very old app writed on php so i
> > > want to be able to add on the server the demo - because i am rewriting
> > > my site from php to web2py.
>
> > What do you mean with "same folder"?
> > If you are saying about: mysite.com/somefolder get requests for web2py
> > AND PHP it'll not be possible, I think.
> > What you could do is to split the URLs, for example:
> > web2py.mysite.com will get the requests and send to web2py and
> > php.mysite.com will send to PHP.
> > You could do also:
> > mysite.com/web2py
> > and
> > mysite.com/php
> > Obviously you could use /anything you want and configure Apache to
> > direct this to web2py or PHP.
>
> > > any help would be very helpful for me!
>
> > --
> > Álvaro Justen - Turicas
> >  http://blog.justen.eng.br/
> >  21 9898-0141


[web2py] Form Checkbox how to Use efectively

2010-05-13 Thread Andrew Evans
hello I have a form I would like to use multiple check boxes to select
data to use. I am not using any sql

an example of how I am generating the check boxes

 TR(INPUT(_type="checkbox", name="browser"), "Browser"),
TR(INPUT(_type="checkbox", name="pageDepth"), "Page Depth"),

this is not the best way from what I can tell. How can I generate my
form values the best way?

also

my other problem is in verifying if the check box has been checked

first I do this in the form function

session.browser = form.vars.browser
session.pageDepth = form.vars.pageDepth

then I am trying to use has_key in my logic function but it always
returns true

if session.has_key("browser"):
myDimensions.append("browser")


Any ideas would be appreciated Cheers

:D


Andrew


[web2py] large sites/application.

2010-05-13 Thread thedangler
I'm confused when to make apps. I'll be making a pretty decent size
website and it has over 30 tables. The site will have different
functionalities and for the most part i have only seen code for apps
that do two or one thing.

So do i make multiple apps. If so how do i know when to make a new
one. If not is there a proper way to build large applications.

Thank you.


[web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Mengu
i support the idea.

On 13 Mayıs, 22:07, Jason Brower  wrote:
> I say we move forward with this one as it doesn't need so much work as
> with the plugins.  At least at first thought.  It's just additional
> metadata in the application.  I think some simple xml/html would do the
> trick.  Just what data if for someone else to think about. :D
> But I think it's awesome.
> Best Regards,
> Jason Brower
>
>
>
> On Thu, 2010-05-13 at 09:13 -0700, mdipierro wrote:
> > This is a good idea.
>
> > On May 13, 11:09 am, blackthorne  wrote:
> > > ok, this one may be interesting...
>
> > > Currently, we can install web2py apps in one of 3 ways. uploading it,
> > > providing its url or putting the files in the applications folder
> > > manually. Nothing wrong with this but seems to me that with little
> > > effort we could take this beyond.
> > > Think about an integrated (web) interface that  allowed you to search
> > > or browser appliances and show its details when requested. This could
> > > happen inside the web2py framework and you could even install it by
> > > pressing a button (actually it just needs to use the already existing
> > > "download/provide url" option inside).
> > > I think this could improve user/developer experience but that's not
> > > all...
> > > Applications could have versions, and a changelog that could make part
> > > of the details of the application and an "update" option, so that
> > > users could keep all their apps on the edge.
>
> > > Who's with me?
>
> > > Thank you, best regards


[web2py] Re: New to web development? Watch this!

2010-05-13 Thread Mengu
thanks chef, great resource.
On 14 Mayıs, 00:28, b00m_chef  wrote:
> http://academicearth.org/courses/building-dynamic-websites
>
> Watch all the videos in the series. Lots of NEED TO KNOW stuff for all
> those starting out.


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Mengu
yes,

i have also tried with sqlite3 and it didn't work. see how awesome
mysql is?

any postgresql users, does psql support this?

On 13 Mayıs, 20:37, Francisco Costa  wrote:
> Thank you Mengu
> I've converted my DB to MySQL. In SQLite didn't work.
>
> On May 13, 3:48 pm, Mengu  wrote:
>
>
>
> > yes, this is possible. i don't know other databases but possible with
> > MySQL.
>
> > db(db.space.id.belongs((result_id))).select(orderby="FIELD(id,
> > 1,6,136,2,18,119,122)")
>
> > On 13 Mayıs, 17:28, Francisco Costa  wrote:
>
> > > yes, then 2,18,119,122
>
> > > On May 13, 3:22 pm, Mengu  wrote:
>
> > > > so you want them to be ordered as first 1 then 6, then 136 etc?
>
> > > > On 13 Mayıs, 13:53, Francisco Costa  wrote:
>
> > > > > I have this query db(db.space.id.belongs(result_id)).select()
> > > > > the result id is an unsorted array of ids
> > > > > I don't want the query results to be order by id
>
> > > > > The SQL list this
> > > > > SELECT space.id, space.name FROM space WHERE space.id IN
> > > > > (1,6,136,2,18,119,122)
>
> > > > > i want the result to be in the order of the ids array


[web2py] Re: agregate login method

2010-05-13 Thread kike
I forget, I copy the file to web2py/gluon/contrib/login_methods and I
aggregate that whit
from gluon.contrib.login_methods.ldap import Ldap


[web2py] agregate login method

2010-05-13 Thread kike
Hi, I have a file called ldap whit the following code:

class Ldap(object):



def __init__(self,usuario=None, passwd=None):

self.objLDAP = None

self.dir = 'xx.xx.xx.xx'

self.ldap_host = 'xxx.xx'

self.puerto = 389

self.AD_SEARCH_DN = 'OU=xxx Domain Users,DC=xxx,DC=xx'

self.usuario = usuario

self.passwd = passwd

self.AD_SEARCH_FIELDS = ['displayname', 'mail','apart',
'mailnickname', 'title']

self.AD_LDAP_URL = 'ldap://%s:%s' % (self.dir, self.puerto)





def Conectar(self):

try:

self.objLDAP = ldap.initialize(self.AD_LDAP_URL)

if self.objLDAP:

if self.usuario and self.passwd:

autUser = self.objLDAP.simple_bind_s("%...@%s"%
(self.usuario, 'xxx.xx'), self.passwd)



if autUser:

return True

else:

return False

else:

return False

else:

return False

except error:

pass



I want agregate this file to login methods but when I wrote
auth.settings.login_methods.append(Ldap()), the web2py send me an
error.
this is the error:  'Ldap' object is not callable.
How I solve this problem??
thank for your help


Re: [web2py] Re: SSL Error on windows [SOLVED] [SOLVED]

2010-05-13 Thread Miguel Lopes
On Thu, May 13, 2010 at 9:02 PM, Timothy Farrell  wrote:

>  While Rocket supports listening on multiple sockets, web2py does not.  You
> will need to run two separate instances of web2py (one for SSL, one
> unencrypted) to do what you are asking.
>
> -tim
>
> Txs for the reply. Always nice to know the reason.
Keeping with Massimo's suggestion I added solved to the post!
LOL


>
> On 5/13/2010 1:40 PM, Miguel Lopes wrote:
>
>
>
> On Wed, May 12, 2010 at 7:45 PM, Timothy Farrell wrote:
>
>> This is the error that Jon Lundell's guys found already.  Note that it's
>> trying to connect to port 8000 as HTTP.  Connect as HTTPS and it should
>> work.
>>
>> Also try upgrading to trunk, that should issue a "400 Bad Request".
>>
>> -tim
>>
>>   Confirmed.
> Updated from trunk to 1.77.3 and if attempting to access the server in http
> (instead of https) server issues console warning like you said.
>
> Since I'm on a LAN I installed SSL as a learning experience and to access
> the admin interface anywhere on the LAN. However, now that I have web2py
> running with SSL, even the applications must be accessed via SSL. I expected
> that only the admin would require SSL. Is this also a matter of
> configuration or is there some other reason? I do have very little knowledge
> on networks and deployment in general. So I wonder what is the reason.
>
> Miguel
>
>
>


[web2py] "SSL is OFF" error message when starting the server

2010-05-13 Thread OMAR
I have web2py installed on a remote Debian server. When connecting via
my local Windows box, the admin is disabled for Web2py because of the
unsecure channel. I set up an SSH tunnel for the connection, and I've
created a private certificate authority for the SSL connection.

When starting the server (the included web2py server) I'm passing the
path to the path to the certificates via command line switches, but
get the following error message:

"WARNING:root:Python "ssl" module unavailable. SSL is OFF"


Next, on the Debian box I installed python-openssl

Where to go from here. How to turn on SSL?

I followed this helpful blog post
http://skoroneos.blogspot.com/2010/01/web2py-getting-admin-panel-to-work.html
but my results were not the same.


Thanks in advance for any help. I look forward to learning web2py and
being part of this community. I just can't seem to get started with
the admin.






[web2py] New to web development? Watch this!

2010-05-13 Thread b00m_chef
http://academicearth.org/courses/building-dynamic-websites

Watch all the videos in the series. Lots of NEED TO KNOW stuff for all
those starting out.


[web2py] Re: left outer join problem on db2

2010-05-13 Thread mdipierro
I have no objection to changing this. Can you want to submit a patch
and help with testing?

On May 13, 4:16 pm, salbefe  wrote:
> Hello,
>
> Only a question, athttp://pypi.python.org/pypi/ibm_db/there is a
> Python DBI driver for DB2. Why web2py is still using ODBC?? Will not
> be better to use this one instead of pyodbc??
>
> Thanks
>
> On 11 mayo, 16:27, mdipierro  wrote:
>
> > Thank you. will look into it.
>
> > Massimo
>
> > On May 11, 6:31 am, Alexey Nezhdanov  wrote:
>
> > > Hi.
> > > I've come across another subtle problem with web2py's DAL running over IBM
> > >DB2database.
> > >DB2requires the left table to immidiatedly preceed the 'left outer join'
> > > keyword.
> > > IOW:
> > > select * from a, b left outer join c on c.a_id=a.id
> > > is incorrect. Correct form is:
> > > select * from b, a left outer join c on c.a_id=a.id
> > > it looks moronish enough, but alas, we have to live with it.
>
> > > I have modified my local copy of web2py to satisfy this requirement.
> > > Please note that this sample can not be copypasted into web2py's sql.py as
> > > is because of full_table_name wrapper that I added to solve another 
> > > problem
> > > - schemas support. But replacing 'full_table_name(db, t)' with just 't'
> > > should work just fine.
>
> > >             join = attributes['left']
> > >             command = self._db._translator['left join']
> > >             if not isinstance(join, (tuple, list)):
> > >                 join = [join]
> > >             joint = [t._tablename for t in join if not isinstance(t,
> > >                      SQLJoin)]
> > >             joinon = [t for t in join if isinstance(t, SQLJoin)]
> > >             tables_to_merge={}
>
> > > [tables_to_merge.update(dict.fromkeys(parse_tablenames(str(t.query 
> > > for t
> > > in joinon]
> > >             joinont = [t.table._tablename for t in joinon]
> > >             [tables_to_merge.pop(t) for t in joinont if t in
> > > tables_to_merge]
> > >             important_tablenames = joint + joinont + 
> > > tables_to_merge.keys()
> > >             excluded = [t for t in tablenames if not t in
> > > important_tablenames ]
> > >             sql_t = ', '.join([full_table_name(self._db, t) for t in
> > > excluded + tables_to_merge.keys()])
> > >             if joint:
> > >                 sql_t += ' %s %s' % (command, ',
> > > '.join([full_table_name(self._db, t) for t in joint]))
> > >             for t in joinon:
> > >                 sql_t += ' %s %s' % (command, str(t))
>
> > > Regards
> > > Alexey


[web2py] Re: UTF-8 question and link

2010-05-13 Thread b00m_chef
Awesome!

Just might want to mention that MySQL doesn't do utf-8, and might
screw-up the DB if you expect your data to be utf-8. Check the info
about fixing the problem in mySQL in that link I posted in my OP.
Might be a good idea to put that in the book somewhere.



On May 13, 1:09 pm, mdipierro  wrote:
> All utf8
> On May 13, 2:15 pm, b00m_chef  wrote:
>
> > I was wondering where web2py stands on this issue? Is the framework
> > utf-8 by default or something else? Is there any documentation on how
> > to implement utf-8 in web2py if it is not the default?
>
> >http://lobstertech.com/2009/jun/07/python_unicode_tutorial/
>
> > Thx.


[web2py] Re: left outer join problem on db2

2010-05-13 Thread salbefe
Hello,

Only a question, at http://pypi.python.org/pypi/ibm_db/ there is a
Python DBI driver for DB2. Why web2py is still using ODBC?? Will not
be better to use this one instead of pyodbc??

Thanks

On 11 mayo, 16:27, mdipierro  wrote:
> Thank you. will look into it.
>
> Massimo
>
> On May 11, 6:31 am, Alexey Nezhdanov  wrote:
>
> > Hi.
> > I've come across another subtle problem with web2py's DAL running over IBM
> >DB2database.
> >DB2requires the left table to immidiatedly preceed the 'left outer join'
> > keyword.
> > IOW:
> > select * from a, b left outer join c on c.a_id=a.id
> > is incorrect. Correct form is:
> > select * from b, a left outer join c on c.a_id=a.id
> > it looks moronish enough, but alas, we have to live with it.
>
> > I have modified my local copy of web2py to satisfy this requirement.
> > Please note that this sample can not be copypasted into web2py's sql.py as
> > is because of full_table_name wrapper that I added to solve another problem
> > - schemas support. But replacing 'full_table_name(db, t)' with just 't'
> > should work just fine.
>
> >             join = attributes['left']
> >             command = self._db._translator['left join']
> >             if not isinstance(join, (tuple, list)):
> >                 join = [join]
> >             joint = [t._tablename for t in join if not isinstance(t,
> >                      SQLJoin)]
> >             joinon = [t for t in join if isinstance(t, SQLJoin)]
> >             tables_to_merge={}
>
> > [tables_to_merge.update(dict.fromkeys(parse_tablenames(str(t.query for t
> > in joinon]
> >             joinont = [t.table._tablename for t in joinon]
> >             [tables_to_merge.pop(t) for t in joinont if t in
> > tables_to_merge]
> >             important_tablenames = joint + joinont + tables_to_merge.keys()
> >             excluded = [t for t in tablenames if not t in
> > important_tablenames ]
> >             sql_t = ', '.join([full_table_name(self._db, t) for t in
> > excluded + tables_to_merge.keys()])
> >             if joint:
> >                 sql_t += ' %s %s' % (command, ',
> > '.join([full_table_name(self._db, t) for t in joint]))
> >             for t in joinon:
> >                 sql_t += ' %s %s' % (command, str(t))
>
> > Regards
> > Alexey


[web2py] Re: Problem with IS_URL

2010-05-13 Thread weheh
> My point with the book is that the information is already there, but 
> scattered and hard to find.

+1


[web2py] Re: Problem with IS_URL

2010-05-13 Thread mdipierro
Then epydoc is very useful... useful to find problems with the
docstrings!

On May 13, 3:52 pm, Jonathan Lundell  wrote:
> On May 13, 2010, at 1:47 PM, mdipierro wrote:
>
> > True but there is always epydoc
>
> >http://web2py.com/examples/static/epydoc/
> >http://web2py.com/examples/static/epydoc/web2py.gluon.validators-modu...
>
> I've always found the source easier to read than epydoc. And the summaries 
> leave a lot to be desired. Here's a current example:
>
>         IS_EMPTY_OR
> dummy class for testing IS_EMPTY_OR
>         IS_NULL_OR
> dummy class for testing IS_EMPTY_OR
>
> Now that's helpful.
>
> My point with the book is that the information is already there, but 
> scattered and hard to find.
>
>
>
> > On May 13, 3:22 pm, Jonathan Lundell  wrote:
> >> On May 13, 2010, at 1:01 PM, weheh wrote:
>
> >>> @mdp: thanks for the clarification. I like having 1 way of doing
> >>> things, which is why I dumped perl years ago. Perhaps IS_NULL_OR
> >>> should be officially deprecated?
>
> >> Is there a place for that? It'd be nice to be able to look that up. Maybe 
> >> an appendix in the book. IS_NULL_OR isn't the only one.
>
> >> Speaking of appendices in the book, in the last editing round I recall 
> >> suggesting that there should be a section that collected the various bits 
> >> & pieces of API from the rest of the book. Function signatures, list of 
> >> validators, what not.


Re: [web2py] Re: Problem with IS_URL

2010-05-13 Thread Jonathan Lundell
On May 13, 2010, at 1:47 PM, mdipierro wrote:

> True but there is always epydoc
> 
> http://web2py.com/examples/static/epydoc/
> http://web2py.com/examples/static/epydoc/web2py.gluon.validators-module.html

I've always found the source easier to read than epydoc. And the summaries 
leave a lot to be desired. Here's a current example:

IS_EMPTY_OR
dummy class for testing IS_EMPTY_OR
IS_NULL_OR
dummy class for testing IS_EMPTY_OR

Now that's helpful.

My point with the book is that the information is already there, but scattered 
and hard to find. 

> 
> On May 13, 3:22 pm, Jonathan Lundell  wrote:
>> On May 13, 2010, at 1:01 PM, weheh wrote:
>> 
>>> @mdp: thanks for the clarification. I like having 1 way of doing
>>> things, which is why I dumped perl years ago. Perhaps IS_NULL_OR
>>> should be officially deprecated?
>> 
>> Is there a place for that? It'd be nice to be able to look that up. Maybe an 
>> appendix in the book. IS_NULL_OR isn't the only one.
>> 
>> Speaking of appendices in the book, in the last editing round I recall 
>> suggesting that there should be a section that collected the various bits & 
>> pieces of API from the rest of the book. Function signatures, list of 
>> validators, what not.




[web2py] Re: Problem with IS_URL

2010-05-13 Thread mdipierro
True but there is always epydoc

http://web2py.com/examples/static/epydoc/
http://web2py.com/examples/static/epydoc/web2py.gluon.validators-module.html

On May 13, 3:22 pm, Jonathan Lundell  wrote:
> On May 13, 2010, at 1:01 PM, weheh wrote:
>
> > @mdp: thanks for the clarification. I like having 1 way of doing
> > things, which is why I dumped perl years ago. Perhaps IS_NULL_OR
> > should be officially deprecated?
>
> Is there a place for that? It'd be nice to be able to look that up. Maybe an 
> appendix in the book. IS_NULL_OR isn't the only one.
>
> Speaking of appendices in the book, in the last editing round I recall 
> suggesting that there should be a section that collected the various bits & 
> pieces of API from the rest of the book. Function signatures, list of 
> validators, what not.


[web2py] Re: Using LOAD from a controller? [SOLVED]

2010-05-13 Thread mdipierro
LOL. I have a solution. Thank for the help and change the title to
[SOLVED] so the email becomes useful.

On May 13, 3:13 pm, Keith Edmunds  wrote:
> It's always a conundrum: does one thank people for helping, and thus
> contribute an otherwise content-free mail to the list? Or should one thank
> those who helped with a personal mail, thus suggesting to everyone else
> that you are ungrateful?
>
> Iceberg, Selecta: thanks for your valuable help. I'm going to monitor the
> list more and see if I can help others.
>
> Keith


Re: [web2py] Re: Problem with IS_URL

2010-05-13 Thread Jonathan Lundell
On May 13, 2010, at 1:01 PM, weheh wrote:

> @mdp: thanks for the clarification. I like having 1 way of doing
> things, which is why I dumped perl years ago. Perhaps IS_NULL_OR
> should be officially deprecated?

Is there a place for that? It'd be nice to be able to look that up. Maybe an 
appendix in the book. IS_NULL_OR isn't the only one.

Speaking of appendices in the book, in the last editing round I recall 
suggesting that there should be a section that collected the various bits & 
pieces of API from the rest of the book. Function signatures, list of 
validators, what not.



Re: [web2py] Re: Using LOAD from a controller?

2010-05-13 Thread Keith Edmunds
It's always a conundrum: does one thank people for helping, and thus
contribute an otherwise content-free mail to the list? Or should one thank
those who helped with a personal mail, thus suggesting to everyone else
that you are ungrateful?

Iceberg, Selecta: thanks for your valuable help. I'm going to monitor the
list more and see if I can help others.

Keith


[web2py] Re: SSL Error on windows [SOLVED]

2010-05-13 Thread mdipierro
Since rocket does it, is there any way we can add support for 80+443
with one rocket and one web2py instance?

On May 13, 3:02 pm, Timothy Farrell  wrote:
> While Rocket supports listening on multiple sockets, web2py does not.  
> You will need to run two separate instances of web2py (one for SSL, one
> unencrypted) to do what you are asking.
>
> -tim
>
> On 5/13/2010 1:40 PM, Miguel Lopes wrote:
>
>
>
> > On Wed, May 12, 2010 at 7:45 PM, Timothy Farrell  > > wrote:
>
> >     This is the error that Jon Lundell's guys found already.  Note
> >     that it's trying to connect to port 8000 as HTTP.  Connect as
> >     HTTPS and it should work.
>
> >     Also try upgrading to trunk, that should issue a "400 Bad Request".
>
> >     -tim
>
> > Confirmed.
> > Updated from trunk to 1.77.3 and if attempting to access the server in
> > http (instead of https) server issues console warning like you said.
>
> > Since I'm on a LAN I installed SSL as a learning experience and to
> > access the admin interface anywhere on the LAN. However, now that I
> > have web2py running with SSL, even the applications must be accessed
> > via SSL. I expected that only the admin would require SSL. Is this
> > also a matter of configuration or is there some other reason? I do
> > have very little knowledge on networks and deployment in general. So I
> > wonder what is the reason.
>
> > Miguel


[web2py] Re: UTF-8 question and link

2010-05-13 Thread mdipierro
All utf8
On May 13, 2:15 pm, b00m_chef  wrote:
> I was wondering where web2py stands on this issue? Is the framework
> utf-8 by default or something else? Is there any documentation on how
> to implement utf-8 in web2py if it is not the default?
>
> http://lobstertech.com/2009/jun/07/python_unicode_tutorial/
>
> Thx.


Re: [web2py] Re: SSL Error on windows [SOLVED]

2010-05-13 Thread Timothy Farrell
While Rocket supports listening on multiple sockets, web2py does not.  
You will need to run two separate instances of web2py (one for SSL, one 
unencrypted) to do what you are asking.


-tim

On 5/13/2010 1:40 PM, Miguel Lopes wrote:



On Wed, May 12, 2010 at 7:45 PM, Timothy Farrell > wrote:


This is the error that Jon Lundell's guys found already.  Note
that it's trying to connect to port 8000 as HTTP.  Connect as
HTTPS and it should work.

Also try upgrading to trunk, that should issue a "400 Bad Request".

-tim

Confirmed.
Updated from trunk to 1.77.3 and if attempting to access the server in 
http (instead of https) server issues console warning like you said.


Since I'm on a LAN I installed SSL as a learning experience and to 
access the admin interface anywhere on the LAN. However, now that I 
have web2py running with SSL, even the applications must be accessed 
via SSL. I expected that only the admin would require SSL. Is this 
also a matter of configuration or is there some other reason? I do 
have very little knowledge on networks and deployment in general. So I 
wonder what is the reason.


Miguel




[web2py] Re: Problem with IS_URL

2010-05-13 Thread weheh
@mdp: thanks for the clarification. I like having 1 way of doing
things, which is why I dumped perl years ago. Perhaps IS_NULL_OR
should be officially deprecated?


[web2py] Re: Encoding using as_dict not using UTF-8?

2010-05-13 Thread b00m_chef
Note that if you are using mySQL that might be because mySQL, if not
set to use utf-8 uses a latin encoding. You have to manually tell
MySQL to use utf-8, and even then you will still have problems with
it...mySQL sux

http://lobstertech.com/2009/jun/07/python_unicode_tutorial/



On Apr 12, 6:59 pm, mdipierro  wrote:
> I have not looked into this yet. It should beutf8in both cases.
>
> On Apr 12, 8:39 pm, Tito Garrido  wrote:
>
>
>
> > Is it expected?
>
> > On Sun, Apr 11, 2010 at 11:54 AM, Tito Garrido wrote:
>
> > > I could test it on Shell, not sure why it's happening:
>
> > > In[0]:
>
> > > p=db(db.paciente.id>0).select()[1].as_dict()
>
> > > Out[0]:
> > > In[1]:
>
> > > p
>
> > > Out[1]:
>
> > > *{'bairro': 'Gra\xc3\xa7a',* 'telefone_residencial': '', 'numero': '492', 
> > > 'mae': '', 'celular': '', 'pai': '', 'data': '2009-10-20', 'id': 2, 
> > > 'telefone_comercial': '', 'nome': 'Tito \xc3\xa1 \xc3\xa9', 'emissor': 
> > > 'SSP-BA', 'cidade': 'Salvador', 'nascimento': '2009-10-20', 'rg': 
> > > '09376709', 'endereco': 'Rua 8', 'estado': 'Bahia', 'email': 
> > > 'te...@teste.com'}
>
> > > In[2]:
>
> > > p=db(db.paciente.id>0).select().json()
>
> > > Out[2]:
> > >  In[3]:
>
> > > p
>
> > > Out[3]:
>
> > > '[{"telefone_comercial": null, "data": "2009-10-20", "bairro": "", 
> > > "nascimento": "2009-10-20", "emissor": "", "cidade": "", "nome": "Tito 
> > > Garrido Ogando", "telefone_residencial": null, "numero": "", "email": 
> > > null, "rg": "", "mae": "", "celular": null, "endereco": "", "pai": "", 
> > > "estado": "", "id": 1}, {"telefone_comercial": "", "data": "2009-10-20", 
> > > *"bairro": "Gra\\u00e7a"*, "nascimento": "2009-10-20", "emissor": "SS", 
> > > "cidade": "Salvador", "nome": "Tito \\u00e1 \\u00e9", 
> > > "telefone_residencial": "", "numero": "492", "email": "te...@teste.com", 
> > > "rg": "0709", "mae": "", "celular": "", "endereco": "Rua 8", "pai": "", 
> > > "estado": "Bahia", "id": 2}, {"telefone_comercial": null, "data": 
> > > "2009-10-20", "bairro": "", "nascimento": "2009-10-20", "emissor": "", 
> > > "cidade": "", "nome": "Garrido Tito", "telefone_residencial": null, 
> > > "numero": "", "email": null, "rg": "", "mae": "", "celular": null, 
> > > "endereco": "", "pai": "", "estado": "", "id": 3}, {"telefone_comercial": 
> > > null, "data": "2010-03-01", "bairro": "", "nascimento": null, "emissor": 
> > > "", "cidade": "", "nome": "", "telefone_residencial": null, "numero": "", 
> > > "email": null, "rg": "", "mae": "", "celular": null, "endereco": "", 
> > > "pai": "", "estado": "", "id": 4}, {"telefone_comercial": null, "data": 
> > > "2010-03-02", "bairro": "G", "nascimento": null, "emissor": "SSP-BA", 
> > > "cidade": "S", "nome": "Tit", "telefone_residencial": null, "numero": 
> > > "", "email": null, "rg": "09379", "mae": "", "celular": null, "endereco": 
> > > "R", "pai": "", "estado": "B", "id": 5}]'
>
> > > I've increased the font of aUTF-8entry (it's should be "Graça")
>
> > > On Sun, Apr 11, 2010 at 11:47 AM, Tito Garrido 
> > > wrote:
>
> > >> In fact looks like it loses theUTF-8enconding when I print it or convert
> > >> it to string...
>
> > >> Is there a way to re encode it?
>
> > >> Regards,
>
> > >> tito
>
> > >> On Sun, Apr 11, 2010 at 11:35 AM, mdipierro 
> > >> wrote:
>
> > >>> Are you tell me that
>
> > >>> items=db(db.mytable.id>0).select(limitby=(0,1))
> > >>> print items[0].as_dict()
> > >>> for item in items: print item.as_dict()
>
> > >>> produce two different outputs? It cannot be.
>
> > >>> Massimo
>
> > >>> On Apr 11, 9:00 am, Tito Garrido  wrote:
> > >>> > I can get it asUTF-8if I execute:
> > >>> > test=db(db.mytable.id>0).select()[0].as_dict()
>
> > >>> > return test
>
> > >>> > Not sure why it's not encoding on the former situation.
>
> > >>> > How could I convert it manually?
>
> > >>> > Thanks!
>
> > >>> > On Sun, Apr 11, 2010 at 2:15 AM, mdipierro 
> > >>> wrote:
> > >>> > > I am not sure the issue is web2py here. It may be 1) the encoding in
> > >>> > > the db should beutf8and it is not, 2) the data has been stored
> > >>> > > incorrecly. web2py does not convert data toUTF8when extracting from
> > >>> > > DB but when inserting only.
>
> > >>> > > On Apr 10, 11:17 pm, Tito Garrido  wrote:
> > >>> > > > Hi Folks,
>
> > >>> > > > I'm not sure why but when I'm using as_dict function in a row
> > >>> element
> > >>> > > it's
> > >>> > > > not returningUTF-8characters an example:
>
> > >>> > > > db.define_table('evento',
> > >>> > > >     SQLField('dono','reference
> > >>> auth_user',writable=False,readable=False),
> > >>> > > >     SQLField('paciente', 'reference paciente', label='Paciente*'),
> > >>> > > >     SQLField('titulo', 'string', length=255
> > >>> > > ,default='',label='Assunto*'),
> > >>> > > >     SQLField('data','date',default=request.now,readable=False),
> > >>> > > >     SQLField('horario','time',readable=False),
> > >>> > > >     SQLField('duracao','integer'),
> > >>> > > >     SQLField('status', 'string', length=255 ,defau

[web2py] UTF-8 question and link

2010-05-13 Thread b00m_chef
I was wondering where web2py stands on this issue? Is the framework
utf-8 by default or something else? Is there any documentation on how
to implement utf-8 in web2py if it is not the default?

http://lobstertech.com/2009/jun/07/python_unicode_tutorial/

Thx.


Re: [web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Jason Brower
I say we move forward with this one as it doesn't need so much work as
with the plugins.  At least at first thought.  It's just additional
metadata in the application.  I think some simple xml/html would do the
trick.  Just what data if for someone else to think about. :D
But I think it's awesome.
Best Regards,
Jason Brower

On Thu, 2010-05-13 at 09:13 -0700, mdipierro wrote: 
> This is a good idea.
> 
> On May 13, 11:09 am, blackthorne  wrote:
> > ok, this one may be interesting...
> >
> > Currently, we can install web2py apps in one of 3 ways. uploading it,
> > providing its url or putting the files in the applications folder
> > manually. Nothing wrong with this but seems to me that with little
> > effort we could take this beyond.
> > Think about an integrated (web) interface that  allowed you to search
> > or browser appliances and show its details when requested. This could
> > happen inside the web2py framework and you could even install it by
> > pressing a button (actually it just needs to use the already existing
> > "download/provide url" option inside).
> > I think this could improve user/developer experience but that's not
> > all...
> > Applications could have versions, and a changelog that could make part
> > of the details of the application and an "update" option, so that
> > users could keep all their apps on the edge.
> >
> > Who's with me?
> >
> > Thank you, best regards




Re: [web2py] web2pyslices source code

2010-05-13 Thread Miguel Lopes
Thanks for sharing.
Miguel

On Thu, May 13, 2010 at 4:50 PM, mr.freeze  wrote:

> This has been updated for anyone interested:
> http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p
>
>


Re: [web2py] Re: SSL Error on windows [SOLVED]

2010-05-13 Thread Miguel Lopes
On Wed, May 12, 2010 at 7:45 PM, Timothy Farrell  wrote:

> This is the error that Jon Lundell's guys found already.  Note that it's
> trying to connect to port 8000 as HTTP.  Connect as HTTPS and it should
> work.
>
> Also try upgrading to trunk, that should issue a "400 Bad Request".
>
> -tim
>
> Confirmed.
Updated from trunk to 1.77.3 and if attempting to access the server in http
(instead of https) server issues console warning like you said.

Since I'm on a LAN I installed SSL as a learning experience and to access
the admin interface anywhere on the LAN. However, now that I have web2py
running with SSL, even the applications must be accessed via SSL. I expected
that only the admin would require SSL. Is this also a matter of
configuration or is there some other reason? I do have very little knowledge
on networks and deployment in general. So I wonder what is the reason.

Miguel


[web2py] Re: group by weeks

2010-05-13 Thread greenpoise
will try. Thanks





On May 13, 1:50 pm, Vasile Ermicioi  wrote:
> this is working
>
> db(db.orders.id > 0).select("count(1) as nr, round(id/10) as gr",
> groupby='gr')
>
> so I think you can use database datetime function to compute week and then
> grouping,
> most database have such functions


Re: [web2py] Re: group by weeks

2010-05-13 Thread Vasile Ermicioi
this is working

db(db.orders.id > 0).select("count(1) as nr, round(id/10) as gr",
groupby='gr')

so I think you can use database datetime function to compute week and then
grouping,
most database have such functions


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Francisco Costa
Thank you Mengu
I've converted my DB to MySQL. In SQLite didn't work.

On May 13, 3:48 pm, Mengu  wrote:
> yes, this is possible. i don't know other databases but possible with
> MySQL.
>
> db(db.space.id.belongs((result_id))).select(orderby="FIELD(id,
> 1,6,136,2,18,119,122)")
>
> On 13 Mayıs, 17:28, Francisco Costa  wrote:
>
> > yes, then 2,18,119,122
>
> > On May 13, 3:22 pm, Mengu  wrote:
>
> > > so you want them to be ordered as first 1 then 6, then 136 etc?
>
> > > On 13 Mayıs, 13:53, Francisco Costa  wrote:
>
> > > > I have this query db(db.space.id.belongs(result_id)).select()
> > > > the result id is an unsorted array of ids
> > > > I don't want the query results to be order by id
>
> > > > The SQL list this
> > > > SELECT space.id, space.name FROM space WHERE space.id IN
> > > > (1,6,136,2,18,119,122)
>
> > > > i want the result to be in the order of the ids array


Re: [web2py] web2pyslices source code

2010-05-13 Thread Álvaro Justen
On Thu, May 13, 2010 at 12:50, mr.freeze  wrote:
> This has been updated for anyone interested:
> http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p

Very good, thanks!

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


[web2py] Re: Idea: Appliance remote management

2010-05-13 Thread blackthorne
stage 3, do the "same" to plugins and slices.

On May 13, 5:33 pm, Jonathan Lundell  wrote:
> On May 13, 2010, at 9:26 AM, Thadeus Burgess wrote:
>
> > This is similar to how PluginCentral will be designed, if we ever get
> > that spec finalised =)
>
> It'd be reasonable to do both at the same site.
>
>
>
>
>
> > --
> > Thadeus
>
> > On Thu, May 13, 2010 at 11:14 AM, blackthorne  
> > wrote:
> >> One more thing, web2py could have a list of repositories url, with the
> >> default the one we can find on the official website but also the
> >> possibility to add other non-official ones as well as mirrors.
> >> Technically web2py could interact with each repository by a simple
> >> specification in XML-RPC or something, to list, search, download
> >> (which could also work for update) and peek.
> >> Finally, on a second stage there could even be a submit app option so
> >> you could submit apps for moderation and further release, seamlessly.
>
> >> Thanks
>
> >> On May 13, 5:09 pm, blackthorne  wrote:
> >>> ok, this one may be interesting...
>
> >>> Currently, we can install web2py apps in one of 3 ways. uploading it,
> >>> providing its url or putting the files in the applications folder
> >>> manually. Nothing wrong with this but seems to me that with little
> >>> effort we could take this beyond.
> >>> Think about an integrated (web) interface that  allowed you to search
> >>> or browser appliances and show its details when requested. This could
> >>> happen inside the web2py framework and you could even install it by
> >>> pressing a button (actually it just needs to use the already existing
> >>> "download/provide url" option inside).
> >>> I think this could improve user/developer experience but that's not
> >>> all...
> >>> Applications could have versions, and a changelog that could make part
> >>> of the details of the application and an "update" option, so that
> >>> users could keep all their apps on the edge.
>
> >>> Who's with me?
>
> >>> Thank you, best regards


Re: [web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Jonathan Lundell
On May 13, 2010, at 9:26 AM, Thadeus Burgess wrote:

> This is similar to how PluginCentral will be designed, if we ever get
> that spec finalised =)

It'd be reasonable to do both at the same site.

> 
> --
> Thadeus
> 
> 
> 
> 
> 
> On Thu, May 13, 2010 at 11:14 AM, blackthorne  wrote:
>> One more thing, web2py could have a list of repositories url, with the
>> default the one we can find on the official website but also the
>> possibility to add other non-official ones as well as mirrors.
>> Technically web2py could interact with each repository by a simple
>> specification in XML-RPC or something, to list, search, download
>> (which could also work for update) and peek.
>> Finally, on a second stage there could even be a submit app option so
>> you could submit apps for moderation and further release, seamlessly.
>> 
>> Thanks
>> 
>> On May 13, 5:09 pm, blackthorne  wrote:
>>> ok, this one may be interesting...
>>> 
>>> Currently, we can install web2py apps in one of 3 ways. uploading it,
>>> providing its url or putting the files in the applications folder
>>> manually. Nothing wrong with this but seems to me that with little
>>> effort we could take this beyond.
>>> Think about an integrated (web) interface that  allowed you to search
>>> or browser appliances and show its details when requested. This could
>>> happen inside the web2py framework and you could even install it by
>>> pressing a button (actually it just needs to use the already existing
>>> "download/provide url" option inside).
>>> I think this could improve user/developer experience but that's not
>>> all...
>>> Applications could have versions, and a changelog that could make part
>>> of the details of the application and an "update" option, so that
>>> users could keep all their apps on the edge.
>>> 
>>> Who's with me?
>>> 
>>> Thank you, best regards
>> 




Re: [web2py] Re: Idea: Appliance remote management

2010-05-13 Thread Thadeus Burgess
This is similar to how PluginCentral will be designed, if we ever get
that spec finalised =)

--
Thadeus





On Thu, May 13, 2010 at 11:14 AM, blackthorne  wrote:
> One more thing, web2py could have a list of repositories url, with the
> default the one we can find on the official website but also the
> possibility to add other non-official ones as well as mirrors.
> Technically web2py could interact with each repository by a simple
> specification in XML-RPC or something, to list, search, download
> (which could also work for update) and peek.
> Finally, on a second stage there could even be a submit app option so
> you could submit apps for moderation and further release, seamlessly.
>
> Thanks
>
> On May 13, 5:09 pm, blackthorne  wrote:
>> ok, this one may be interesting...
>>
>> Currently, we can install web2py apps in one of 3 ways. uploading it,
>> providing its url or putting the files in the applications folder
>> manually. Nothing wrong with this but seems to me that with little
>> effort we could take this beyond.
>> Think about an integrated (web) interface that  allowed you to search
>> or browser appliances and show its details when requested. This could
>> happen inside the web2py framework and you could even install it by
>> pressing a button (actually it just needs to use the already existing
>> "download/provide url" option inside).
>> I think this could improve user/developer experience but that's not
>> all...
>> Applications could have versions, and a changelog that could make part
>> of the details of the application and an "update" option, so that
>> users could keep all their apps on the edge.
>>
>> Who's with me?
>>
>> Thank you, best regards
>


Re: [web2py] web2pyslices source code

2010-05-13 Thread Thadeus Burgess
nice, thanks!
--
Thadeus





On Thu, May 13, 2010 at 10:50 AM, mr.freeze  wrote:
> This has been updated for anyone interested:
> http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p
>
>


[web2py] Re: group by weeks

2010-05-13 Thread greenpoise
I see. So there has to be some time range. Python has a calendar
module, I thought perhaps putting all the weeks on a table? Will keep
diggin. Thanks

Dan



On May 13, 12:15 pm, mdipierro  wrote:
> the dal has no weekday function but datetime.date does. That means if
> you select the records by some time range we you can maniputale them
> at the Python/web2py level. How really depends on details. You could
> also create a function that uses datetime weekday to build query
> ranges for dal.
>
> On May 13, 11:10 am, greenpoise  wrote:
>
> > Is there such thing? i need to group a result set by weeks. Sort of
> > like total sales of the week. How could I accomplish this? I really
> > dont want the user to be entering a range of dates. The weeks will
> > always start on Monday and finish on Sunday. My table takes daily
> > sales.
>
> > Thanks


[web2py] Re: Cross reference error in DAL

2010-05-13 Thread mr.freeze
I would use an intermediate table to achieve the many to many
relationship:

db.define_table('test', Field('name') )
db.define_table('test2', Field('name') )
db.define_table('test_relation',
Field('test', 'reference test2'),
Field('test2, 'reference test'))

test_and_test2 = db((db.test.id==db.test_relation.test) &
(db.test2.id==db.test_relation.test2))
for row in test_and_test2.select():
print row.test.name, row.test2.name



On May 13, 6:09 am, vihang  wrote:
> Hi,
>
> Why am I getting an error here?
>
> model.py
>
> db=SQLDB("sqlite://db.db")
>
> db.define_table('test',
>     Field('t', 'reference test2'))
>
> db.define_table('test2',
>     Field('t1', 'reference test'))
>
> Error:
>
> Traceback (most recent call last):
>   File "c:\web2py\gluon\restricted.py", line 178, in restricted
>     exec ccode in environment
>   File "c:/web2py/applications/video/models/db.py", line 6, in
> 
>     Field('t', 'reference test2'))
>   File "c:\web2py\gluon\sql.py", line 1299, in define_table
>     t._create_references()
>   File "c:\web2py\gluon\sql.py", line 1571, in _create_references
>     raise SyntaxError, 'Table: table "%s" does not exist' % referenced
> SyntaxError: Table: table "test2" does not exist
>
> Bummer !


[web2py] Re: group by weeks

2010-05-13 Thread mdipierro
the dal has no weekday function but datetime.date does. That means if
you select the records by some time range we you can maniputale them
at the Python/web2py level. How really depends on details. You could
also create a function that uses datetime weekday to build query
ranges for dal.

On May 13, 11:10 am, greenpoise  wrote:
> Is there such thing? i need to group a result set by weeks. Sort of
> like total sales of the week. How could I accomplish this? I really
> dont want the user to be entering a range of dates. The weeks will
> always start on Monday and finish on Sunday. My table takes daily
> sales.
>
> Thanks


[web2py] Re: Idea: Appliance remote management

2010-05-13 Thread blackthorne
One more thing, web2py could have a list of repositories url, with the
default the one we can find on the official website but also the
possibility to add other non-official ones as well as mirrors.
Technically web2py could interact with each repository by a simple
specification in XML-RPC or something, to list, search, download
(which could also work for update) and peek.
Finally, on a second stage there could even be a submit app option so
you could submit apps for moderation and further release, seamlessly.

Thanks

On May 13, 5:09 pm, blackthorne  wrote:
> ok, this one may be interesting...
>
> Currently, we can install web2py apps in one of 3 ways. uploading it,
> providing its url or putting the files in the applications folder
> manually. Nothing wrong with this but seems to me that with little
> effort we could take this beyond.
> Think about an integrated (web) interface that  allowed you to search
> or browser appliances and show its details when requested. This could
> happen inside the web2py framework and you could even install it by
> pressing a button (actually it just needs to use the already existing
> "download/provide url" option inside).
> I think this could improve user/developer experience but that's not
> all...
> Applications could have versions, and a changelog that could make part
> of the details of the application and an "update" option, so that
> users could keep all their apps on the edge.
>
> Who's with me?
>
> Thank you, best regards


[web2py] Re: Idea: Appliance remote management

2010-05-13 Thread mdipierro
This is a good idea.

On May 13, 11:09 am, blackthorne  wrote:
> ok, this one may be interesting...
>
> Currently, we can install web2py apps in one of 3 ways. uploading it,
> providing its url or putting the files in the applications folder
> manually. Nothing wrong with this but seems to me that with little
> effort we could take this beyond.
> Think about an integrated (web) interface that  allowed you to search
> or browser appliances and show its details when requested. This could
> happen inside the web2py framework and you could even install it by
> pressing a button (actually it just needs to use the already existing
> "download/provide url" option inside).
> I think this could improve user/developer experience but that's not
> all...
> Applications could have versions, and a changelog that could make part
> of the details of the application and an "update" option, so that
> users could keep all their apps on the edge.
>
> Who's with me?
>
> Thank you, best regards


[web2py] group by weeks

2010-05-13 Thread greenpoise
Is there such thing? i need to group a result set by weeks. Sort of
like total sales of the week. How could I accomplish this? I really
dont want the user to be entering a range of dates. The weeks will
always start on Monday and finish on Sunday. My table takes daily
sales.


Thanks







[web2py] Idea: Appliance remote management

2010-05-13 Thread blackthorne
ok, this one may be interesting...

Currently, we can install web2py apps in one of 3 ways. uploading it,
providing its url or putting the files in the applications folder
manually. Nothing wrong with this but seems to me that with little
effort we could take this beyond.
Think about an integrated (web) interface that  allowed you to search
or browser appliances and show its details when requested. This could
happen inside the web2py framework and you could even install it by
pressing a button (actually it just needs to use the already existing
"download/provide url" option inside).
I think this could improve user/developer experience but that's not
all...
Applications could have versions, and a changelog that could make part
of the details of the application and an "update" option, so that
users could keep all their apps on the edge.

Who's with me?

Thank you, best regards


[web2py] web2pyslices source code

2010-05-13 Thread mr.freeze
This has been updated for anyone interested:
http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p



Re: [web2py] Re: ORM-like DAL

2010-05-13 Thread Thadeus Burgess
Why not...

define_table('post', Field('title'), Field('content', 'text'))

class Post(object):
   @staticmethod
   def get_permalinkI(post):
  return URL(slugify(post.title))

Then just

for post in db().select(db.post.ALL):
   print Post.get_permalink(post)

--
Thadeus





On Thu, May 13, 2010 at 1:44 AM, vihang  wrote:
> Maybe we could inherit in some way, but I need to inherit a bunch.
> Hence it does not help.
>
> On May 12, 8:08 pm, Thadeus Burgess  wrote:
>> VirtualFields?
>>
>> --
>> Thadeus
>>
>> On Tue, May 11, 2010 at 11:59 PM, vihang  wrote:
>> > Some of the apps I am working currently are much more easy to build if
>> > the models can be defined as a class with methods that act on them.
>>
>> > On May 12, 5:51 am, Álvaro Justen  wrote:
>> >> On Tue, May 11, 2010 at 21:38, Richard  wrote:
>> >> > there was a discussion about this on the developers mailing list last
>> >> > week:
>> >> >http://groups.google.com/group/web2py-developers/browse_thread/thread...
>>
>> >> Yes, started by me.
>>
>> >> > On May 7, 12:50 am, vihang  wrote:
>> >> >> Hello,
>>
>> >> >> A long time back, someone (mostly probably massimo) had written a few
>> >> >> lines of code showing how DAL could be extended to be used in class,
>> >> >> and effective like ORM. I have spent a lot of time searching for this
>> >> >> on this group, but unable to find it. Any help would be appreciated.
>>
>> >> vihang, why do you want an ORM? :)
>>
>> >> >> Thanks
>> >> >> Vihang
>>
>> >> --
>> >> Álvaro Justen - Turicas
>> >>  http://blog.justen.eng.br/
>> >>  21 9898-0141
>


[web2py] Re: hello

2010-05-13 Thread Pepe
http://alexandremas.blogspot.com/2010/02/como-configurar-web2py-e-php-no-mesmo.html

On May 13, 9:40 am, mdipierro  wrote:
> Did you look at that web2py/scripts/stup-web2py-ubuntu.sh?
>
> On May 13, 5:51 am, ciprian  wrote:
>
>
>
> > thanks for trying to help. but i already spent two days trying to
> > figure it out. i can install web2py with no problems - but i dont have
> > too much experience with mod_wsgi (google doesnt help) no web2py
> > tutorials and i guess this is the end. i really need to run php too on
> > the same apache but i cant. So i guess this is the end!
> > So message for the comunity if someone cares anyways! even if i will
> > remain a web2py fan - i wont use it for my bussiness, because it lacks
> > where i needed it most.
> > Some might call me a noob, whatever - i just dont know how to config
> > the damn mod_wsgi. i am sure there are at least 100 in this world who
> > have tried this and felt the same frustration i did. So like a project
> > in future - write a tutorial on how to install web2py and php both
> > running on the same server. ruby on rails have like 1000 tutorials on
> > subject!
> > Best Regards!
>
> > On May 12, 5:16 pm, Álvaro Justen  wrote:
>
> > > On Tue, May 11, 2010 at 18:39, ciprian  wrote:
> > > > i used this script to install web2py:
> > > >http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> > > > so i have everything in www-data
> > > > and everything works fine.
>
> > > > now..what do i have to install to make php work on the same folder? or
> > > > what do i have to config. i have a very old app writed on php so i
> > > > want to be able to add on the server the demo - because i am rewriting
> > > > my site from php to web2py.
>
> > > What do you mean with "same folder"?
> > > If you are saying about: mysite.com/somefolder get requests for web2py
> > > AND PHP it'll not be possible, I think.
> > > What you could do is to split the URLs, for example:
> > > web2py.mysite.com will get the requests and send to web2py and
> > > php.mysite.com will send to PHP.
> > > You could do also:
> > > mysite.com/web2py
> > > and
> > > mysite.com/php
> > > Obviously you could use /anything you want and configure Apache to
> > > direct this to web2py or PHP.
>
> > > > any help would be very helpful for me!
>
> > > --
> > > Álvaro Justen - Turicas
> > >  http://blog.justen.eng.br/
> > >  21 9898-0141


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Mengu
yes, this is possible. i don't know other databases but possible with
MySQL.

db(db.space.id.belongs((result_id))).select(orderby="FIELD(id,
1,6,136,2,18,119,122)")


On 13 Mayıs, 17:28, Francisco Costa  wrote:
> yes, then 2,18,119,122
>
> On May 13, 3:22 pm, Mengu  wrote:
>
>
>
> > so you want them to be ordered as first 1 then 6, then 136 etc?
>
> > On 13 Mayıs, 13:53, Francisco Costa  wrote:
>
> > > I have this query db(db.space.id.belongs(result_id)).select()
> > > the result id is an unsorted array of ids
> > > I don't want the query results to be order by id
>
> > > The SQL list this
> > > SELECT space.id, space.name FROM space WHERE space.id IN
> > > (1,6,136,2,18,119,122)
>
> > > i want the result to be in the order of the ids array


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Francisco Costa
yes, then 2,18,119,122

On May 13, 3:22 pm, Mengu  wrote:
> so you want them to be ordered as first 1 then 6, then 136 etc?
>
> On 13 Mayıs, 13:53, Francisco Costa  wrote:
>
> > I have this query db(db.space.id.belongs(result_id)).select()
> > the result id is an unsorted array of ids
> > I don't want the query results to be order by id
>
> > The SQL list this
> > SELECT space.id, space.name FROM space WHERE space.id IN
> > (1,6,136,2,18,119,122)
>
> > i want the result to be in the order of the ids array


[web2py] Re: design issue

2010-05-13 Thread cjrh
On May 13, 2:24 pm, annet  wrote:
> I know web2py can connect to multiple databases, and I wonder whether
> it would be possible to have two db.py files: db1.py and db2.py, where
> db1.py connects to the database containing the first type of data and
> db2.py connects to the company's database. db2.py would also contain
> the auth_ tables.

Hi annet

I also process requests from multiple companies.  I use a separate DB
for each company:

db.define_table(
  'company_db',
  Field('name'),
  Field('connection_string'),
  Field('access_key')
  )

I populate this list manually, and this is how I enable a company for
access.  Then, I select from this table right there in the model file
to keep the list available in a dict, and create the models on the sub-
DBs in a routine that is called on every record:

def define_company_db_tables(db_C);
  db_C.define_table(
'mytable1',
'description', length=128
'otherfield, 'integer'
)
  db_C.define_table(
'mytable2',
'blah', length=128
'bleh, 'integer'
)

rows = db().select(db.company_db.ALL)
company_db_dict = {}
for row in rows:
  company_db_dict[row.id] = DAL(row.connection_string)
  define_company_db_tables(company_db_dict[row.id])
  # This line is not required by the app,
  # but allows the admin interface to be used
  # to query the DBs of each company
  exec('db_%d = company_db_dict[row.id]' % (row.id))

The primary reason I do this is so that at some later date it the
company in question wants to self-host the web-app, for whatever
reason, they will be able to easily extact their specific data since
it all lies within a single DB.  In the controllers, I check for a
provided access_key either in the args, or in POST-data, and use that
to find the correct DB for that company by doing a select on
db.company_db, followed by an index into company_db_dict.   You could
also make the company_db_dict hash directly from the access_key to the
db connection.

I don't know whether this strategy is considered "good practice" or
not, but it's working quite well so far.


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Mengu
so you want them to be ordered as first 1 then 6, then 136 etc?

On 13 Mayıs, 13:53, Francisco Costa  wrote:
> I have this query db(db.space.id.belongs(result_id)).select()
> the result id is an unsorted array of ids
> I don't want the query results to be order by id
>
> The SQL list this
> SELECT space.id, space.name FROM space WHERE space.id IN
> (1,6,136,2,18,119,122)
>
> i want the result to be in the order of the ids array


[web2py] Re: [PATCH] Make decorators well behaved

2010-05-13 Thread mdipierro
excellent!

On May 13, 8:02 am, mathieu.clab...@gmail.com wrote:
> Without this patches, all decorated functions __name__ is set to f, which
> is not desirable in testing environment where on sometimes want to access
> the name of the function under test.
> Seehttp://wiki.python.org/moin/PythonDecoratorLibrary#CreatingWell-Behav...
>
>  web2py.patch
> 1KViewDownload


[web2py] Re: Do you use web2py in your company?

2010-05-13 Thread mdipierro
I guess I should add I made three apps for DePaul University:
1) Computes and projects students headcount, credit hours and revenue
by school and year.
2) Allow students to apply for assistantships and randly assignes them
to faculty for anonymous review
3) A simple class management system for posting assignment, returning
completed assignments and grading. All assignments are in wiki format
and allow latex in text. Uses difflib to check for plagiarism.

On May 13, 7:01 am, szimszon  wrote:
> I made several small apps, and installed a CAS to centralize the
> authentication but there are not enterprise grade...
>
> I made an Inventory app where we can follow the history of a piece of
> hardware installed and removed from computers, with categories,
> subcategories, sellers, invoice, warranty, e-mail notification...
>
> An app to track the duty times.
>
> Some looking glass functionality (mtr, ping, dig, traceroute...)
>
> I made a program to assist the printing of certificates of wine tests
> (http://linuxbox.hu/node/637) it works for me :)
>
> On máj. 10, 23:09, mdipierro  wrote:
>
> > Anthony made some good 
> > points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> > For now let's concentrate on one of them for now. If you have
> > developed software in web2py that you use internally in your company
> > but you cannot release it open source, would you let us know? Can you
> > tell us what is the software for? Could you provide a screenshot? Can
> > we quote the name of the company?
>
> > Massimo


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Francisco Costa
how can i sort results in the array order then?

On May 13, 2:42 pm, mdipierro  wrote:
> I think this is a SQL feature they sort list to use binary search in
> the index for the table for efficiency).
>
> On May 13, 6:57 am, Francisco Costa  wrote:
>
> > is this a SQL Bug/feature? how can I change it?
>
> > On May 13, 11:53 am, Francisco Costa  wrote:
>
> > > I have this query db(db.space.id.belongs(result_id)).select()
> > > the result id is an unsorted array of ids
> > > I don't want the query results to be order by id
>
> > > The SQL list this
> > > SELECT space.id, space.name FROM space WHERE space.id IN
> > > (1,6,136,2,18,119,122)
>
> > > i want the result to be in the order of the ids array


[web2py] Re: Belongs orders results by id

2010-05-13 Thread mdipierro
I think this is a SQL feature they sort list to use binary search in
the index for the table for efficiency).

On May 13, 6:57 am, Francisco Costa  wrote:
> is this a SQL Bug/feature? how can I change it?
>
> On May 13, 11:53 am, Francisco Costa  wrote:
>
> > I have this query db(db.space.id.belongs(result_id)).select()
> > the result id is an unsorted array of ids
> > I don't want the query results to be order by id
>
> > The SQL list this
> > SELECT space.id, space.name FROM space WHERE space.id IN
> > (1,6,136,2,18,119,122)
>
> > i want the result to be in the order of the ids array


[web2py] Re: hello

2010-05-13 Thread mdipierro
Did you look at that web2py/scripts/stup-web2py-ubuntu.sh?

On May 13, 5:51 am, ciprian  wrote:
> thanks for trying to help. but i already spent two days trying to
> figure it out. i can install web2py with no problems - but i dont have
> too much experience with mod_wsgi (google doesnt help) no web2py
> tutorials and i guess this is the end. i really need to run php too on
> the same apache but i cant. So i guess this is the end!
> So message for the comunity if someone cares anyways! even if i will
> remain a web2py fan - i wont use it for my bussiness, because it lacks
> where i needed it most.
> Some might call me a noob, whatever - i just dont know how to config
> the damn mod_wsgi. i am sure there are at least 100 in this world who
> have tried this and felt the same frustration i did. So like a project
> in future - write a tutorial on how to install web2py and php both
> running on the same server. ruby on rails have like 1000 tutorials on
> subject!
> Best Regards!
>
> On May 12, 5:16 pm, Álvaro Justen  wrote:
>
> > On Tue, May 11, 2010 at 18:39, ciprian  wrote:
> > > i used this script to install web2py:
> > >http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> > > so i have everything in www-data
> > > and everything works fine.
>
> > > now..what do i have to install to make php work on the same folder? or
> > > what do i have to config. i have a very old app writed on php so i
> > > want to be able to add on the server the demo - because i am rewriting
> > > my site from php to web2py.
>
> > What do you mean with "same folder"?
> > If you are saying about: mysite.com/somefolder get requests for web2py
> > AND PHP it'll not be possible, I think.
> > What you could do is to split the URLs, for example:
> > web2py.mysite.com will get the requests and send to web2py and
> > php.mysite.com will send to PHP.
> > You could do also:
> > mysite.com/web2py
> > and
> > mysite.com/php
> > Obviously you could use /anything you want and configure Apache to
> > direct this to web2py or PHP.
>
> > > any help would be very helpful for me!
>
> > --
> > Álvaro Justen - Turicas
> >  http://blog.justen.eng.br/
> >  21 9898-0141


[web2py] Re: ToscaWidgets

2010-05-13 Thread mdipierro
They do have lots of functionality. So keep up posted about progress.
Anyway, the {{=LOAD(...)}} function is a way to submit web2py forms
via ajax.

On May 13, 3:00 am, lannick  wrote:
> Hi,
>
> Thank you for your answer.
>
> Massimo, I agree with you using tw-forms is not the best way to
> construct forms.
> But with toscawidgets I don't want to use tw-forms but all others
> widgets. you can see them here :http://toscawidgets.org/hg
> I am a beginner in python and web2py. I don't want to learn javascript
> and TW seem to make easy the use of ajax widgets.
> Only an easy-install and an import in the web2py code.
>
> It is about that I would like some help from web2py community.
>
> Sorry for my bad english.
>
> Regards,
> Lannick
>
> On 12 mai, 18:16, mdipierro  wrote:
>
> > I do not think anybody did and here is why:
>
> > ToscaWidget example
>
> > import tw.forms as twf
> > movie_form = twf.TableForm('movie_form', action='save_movie',
> > children=[
> >     twf.HiddenField('id'),
> >     twf.TextField('title'),
> >     twf.TextField('year', size=4),
> >     twf.CalendarDatePicker('release_date'),
> >     twf.SingleSelectField('genera', options=['', 'Action', 'Comedy',
> > 'Other']),
> >     twf.TextArea('description'),
> > ])
>
> > same code in web2py:
>
> > movie_form = SQLFORM.factory(
> >     Field('title','text'),
> >     Field('year', length=4),
> >     Field('release_date','date'),
> >     Field('genera', requires=IS_IN_SET(('Action', 'Comedy',
> > 'Other'),zero='')),
> >     Field('description','text'),
> >     _hidden=dict(id=3),_action=URL(r=request,f='save_movie'))
>
> > On May 12, 10:36 am, stefaan  wrote:
>
> > > > Nobody know Toscawidgets and have try it with web2py ?
>
> > > Hello Lannick,
>
> > > Given the lack of answers it is safe to assume that no-one has tried
> > > it with web2py...
>
> > > Best regards,
> > > Stefaan.


[web2py] Re: duplicate ids on using auth.login and auth.register forms on same page

2010-05-13 Thread mdipierro
please post an example of the controller and view. If I understand the
problem, this should work.

On May 13, 1:54 am, Rohan  wrote:
> i am using  latest version 1.77.3 (2010-04-20 02:48:54)
>
> On May 12, 8:29 pm, mdipierro  wrote:
>
> > This was fixed. What version of web2py are you using?
>
> > On May 12, 5:51 am, Rohan  wrote:
>
> > >  I am using auth.login and auth.register forms on a single page and it
> > > is resulting in duplicate ids for email and password rows.
> > > similar discussions were going on this 
> > > threadhttp://groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630
> > > Is there any update on this?


[web2py] Re: Django GenericForeignKey

2010-05-13 Thread mdipierro
isn't that just an integer?

On May 13, 1:43 am, vihang  wrote:
> Hello,
>
> would anyone know how would one implement GenericForeignKey using
> DAL??
>
> Thanks
> Vihang


[web2py] [PATCH] Make decorators well behaved

2010-05-13 Thread mathieu . clabaut
Without this patches, all decorated functions __name__ is set to f, which
is not desirable in testing environment where on sometimes want to access
the name of the function under test.
See 
http://wiki.python.org/moin/PythonDecoratorLibrary#CreatingWell-BehavedDecorators.2BAC8.22Decoratordecorator.22


# HG changeset patch
# User Mathieu Clabaut 
# Date 1273752449 -7200
# Node ID 6acd0eed342316b128d4964dfa96d1bc1025a655
# Parent  6117613d0b77301aa6688e4d8f17f34252f2b88a
Make decorators well behaved.
Without this patches, all decorated functions __name__ is set to f, which
is not desirable in testing environment where on sometimes want to access
the name of the function under test.
See http://wiki.python.org/moin/PythonDecoratorLibrary#CreatingWell-BehavedDecorators.2BAC8.22Decoratordecorator.22

diff -r 6117613d0b77 -r 6acd0eed3423 gluon/tools.py
--- a/gluon/tools.py	Wed May 12 14:34:56 2010 -0500
+++ b/gluon/tools.py	Thu May 13 14:07:29 2010 +0200
@@ -1889,6 +1889,8 @@
 redirect(next)
 return action(*a, **b)
 f.__doc__ = action.__doc__
+f.__name__ = action.__name__
+f.__dict__.update(action.__dict__)
 return f
 
 return decorator
@@ -1910,6 +1912,8 @@
  '?_next='+urllib.quote(next))
 return action(*a, **b)
 f.__doc__ = action.__doc__
+f.__name__ = action.__name__
+f.__dict__.update(action.__dict__)
 return f
 
 return decorator
@@ -1938,6 +1942,8 @@
 redirect(next)
 return action(*a, **b)
 f.__doc__ = action.__doc__
+f.__name__ = action.__name__
+f.__dict__.update(action.__dict__)
 return f
 
 return decorator
@@ -1970,6 +1976,8 @@
 redirect(next)
 return action(*a, **b)
 f.__doc__ = action.__doc__
+f.__name__ = action.__name__
+f.__dict__.update(action.__dict__)
 return f
 
 return decorator


[web2py] design issue

2010-05-13 Thread annet
I have multiple applications connecting to the same database, some of
them query the database for data on multiple companies others query
the database for data on one company, apart from a company table
containing the company id there is no overlap.

I know web2py can connect to multiple databases, and I wonder whether
it would be possible to have two db.py files: db1.py and db2.py, where
db1.py connects to the database containing the first type of data and
db2.py connects to the company's database. db2.py would also contain
the auth_ tables.

I hope some of you are willing to comment on this idea.


Kind regards,

Annet.


[web2py] Re: Do you use web2py in your company?

2010-05-13 Thread szimszon
I made several small apps, and installed a CAS to centralize the
authentication but there are not enterprise grade...

I made an Inventory app where we can follow the history of a piece of
hardware installed and removed from computers, with categories,
subcategories, sellers, invoice, warranty, e-mail notification...

An app to track the duty times.

Some looking glass functionality (mtr, ping, dig, traceroute...)

I made a program to assist the printing of certificates of wine tests
(http://linuxbox.hu/node/637) it works for me :)



On máj. 10, 23:09, mdipierro  wrote:
> Anthony made some good 
> points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> For now let's concentrate on one of them for now. If you have
> developed software in web2py that you use internally in your company
> but you cannot release it open source, would you let us know? Can you
> tell us what is the software for? Could you provide a screenshot? Can
> we quote the name of the company?
>
> Massimo


[web2py] Re: Belongs orders results by id

2010-05-13 Thread Francisco Costa
is this a SQL Bug/feature? how can I change it?

On May 13, 11:53 am, Francisco Costa  wrote:
> I have this query db(db.space.id.belongs(result_id)).select()
> the result id is an unsorted array of ids
> I don't want the query results to be order by id
>
> The SQL list this
> SELECT space.id, space.name FROM space WHERE space.id IN
> (1,6,136,2,18,119,122)
>
> i want the result to be in the order of the ids array


[web2py] Cross reference error in DAL

2010-05-13 Thread vihang
Hi,

Why am I getting an error here?

model.py

db=SQLDB("sqlite://db.db")

db.define_table('test',
Field('t', 'reference test2'))

db.define_table('test2',
Field('t1', 'reference test'))


Error:

Traceback (most recent call last):
  File "c:\web2py\gluon\restricted.py", line 178, in restricted
exec ccode in environment
  File "c:/web2py/applications/video/models/db.py", line 6, in

Field('t', 'reference test2'))
  File "c:\web2py\gluon\sql.py", line 1299, in define_table
t._create_references()
  File "c:\web2py\gluon\sql.py", line 1571, in _create_references
raise SyntaxError, 'Table: table "%s" does not exist' % referenced
SyntaxError: Table: table "test2" does not exist

Bummer !


[web2py] Belongs orders results by id

2010-05-13 Thread Francisco Costa
I have this query db(db.space.id.belongs(result_id)).select()
the result id is an unsorted array of ids
I don't want the query results to be order by id

The SQL list this
SELECT space.id, space.name FROM space WHERE space.id IN
(1,6,136,2,18,119,122)

i want the result to be in the order of the ids array


[web2py] Re: hello

2010-05-13 Thread ciprian
thanks for trying to help. but i already spent two days trying to
figure it out. i can install web2py with no problems - but i dont have
too much experience with mod_wsgi (google doesnt help) no web2py
tutorials and i guess this is the end. i really need to run php too on
the same apache but i cant. So i guess this is the end!
So message for the comunity if someone cares anyways! even if i will
remain a web2py fan - i wont use it for my bussiness, because it lacks
where i needed it most.
Some might call me a noob, whatever - i just dont know how to config
the damn mod_wsgi. i am sure there are at least 100 in this world who
have tried this and felt the same frustration i did. So like a project
in future - write a tutorial on how to install web2py and php both
running on the same server. ruby on rails have like 1000 tutorials on
subject!
Best Regards!

On May 12, 5:16 pm, Álvaro Justen  wrote:
> On Tue, May 11, 2010 at 18:39, ciprian  wrote:
> > i used this script to install web2py:
> >http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> > so i have everything in www-data
> > and everything works fine.
>
> > now..what do i have to install to make php work on the same folder? or
> > what do i have to config. i have a very old app writed on php so i
> > want to be able to add on the server the demo - because i am rewriting
> > my site from php to web2py.
>
> What do you mean with "same folder"?
> If you are saying about: mysite.com/somefolder get requests for web2py
> AND PHP it'll not be possible, I think.
> What you could do is to split the URLs, for example:
> web2py.mysite.com will get the requests and send to web2py and
> php.mysite.com will send to PHP.
> You could do also:
> mysite.com/web2py
> and
> mysite.com/php
> Obviously you could use /anything you want and configure Apache to
> direct this to web2py or PHP.
>
> > any help would be very helpful for me!
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141


[web2py] Re: How to auto-login into an account from an specific computer.

2010-05-13 Thread cjrh
On May 13, 10:06 am, Benigno  wrote:
> We have made an app with web2py to present data from a home-automated
> home as a web service. There is a certain hardware at the home that
> sends all the information that transverses the bus into our server,
> and from there on, we process and present the data using web2py.

I am doing something similar.   My client is a daemon process.  Upon
my first contact with the server, the daemon client provides an
authentication key.  This is checked in the web2py DB.  If found/
valid, a session number is returned to the client (inside a cookie).
The client stores this cookie, and returns it to the web2py server, as
a cookie header, on each subsequent access.  This maintains the
session.  So far, this strategy appears to be working well.  All
functions in the controller used by the daemon process have an
"IsLoggedIn" decorator, which checks first.   Depending on the
specific details of your situation, you could extend the valid time of
the session from the default value.  I don't know the value of that
default offhand.


Re: [web2py] Re: Web2py Utils now on the CheeseShop, With a new unittesting module

2010-05-13 Thread Mathieu Clabaut
Oups.. Just seen "Warning You must use web2py version 1.77.4, or at least
source revision 445." on the documentation page...

Sorry for the noise.

-Mathieu

On Thu, May 13, 2010 at 10:27, Mathieu Clabaut wrote:

> Hello Thadeus,
> Trying to use the testing environment, I got the following traceback :
>
> File
> "/home/clabaut/.virtualenvs/web2py/lib/python2.6/site-packages/web2py_utils/test_runner.py",
> line 170, in new_env
> 'TEST_METHOD': 'FakeEnv'
> TypeError: env() got an unexpected keyword argument 'extra_request'
>
> Web2py version : R-1.77.3+20 (ff230ef97232)
> web2py-utils==0.0.7dev
>
> Did I miss something ?
>
>
> On Fri, May 7, 2010 at 00:30, Patrick  wrote:
>
>>
>>
>> On May 6, 3:15 pm, Mathieu Clabaut  wrote:
>> > Really nice !
>> >
>> > Thank you for publishing it... I'll try this soon...
>> > -Mathieu
>> >
>> >
>> >
>> > On Thu, May 6, 2010 at 20:19, Thadeus Burgess 
>> wrote:
>> > > The documentation will now live on the cheeseshop.
>> >
>> > >http://packages.python.org/web2py_utils/
>> >
>> > > You can now easy_install it
>> >
>> > > This release includes a new Test Runner module, to help properly
>> > > UnitTest web2py applications. It includes WebTest, Nosetests, Coverage
>> > > support, as well as creating a fake web2py environment for you!
>> >
>> > > To learn more about Test Runner, please see the following page
>> >
>> > >http://packages.python.org/web2py_utils/test_runner.html
>> >
>> > > --
>> > > Thadeus
>>
>> Thanks again Thadeus, you've really been a roll lately! Keep it up.
>>
>
>


Re: [web2py] Re: Web2py Utils now on the CheeseShop, With a new unittesting module

2010-05-13 Thread Mathieu Clabaut
Hello Thadeus,
Trying to use the testing environment, I got the following traceback :

File
"/home/clabaut/.virtualenvs/web2py/lib/python2.6/site-packages/web2py_utils/test_runner.py",
line 170, in new_env
'TEST_METHOD': 'FakeEnv'
TypeError: env() got an unexpected keyword argument 'extra_request'

Web2py version : R-1.77.3+20 (ff230ef97232)
web2py-utils==0.0.7dev

Did I miss something ?


On Fri, May 7, 2010 at 00:30, Patrick  wrote:

>
>
> On May 6, 3:15 pm, Mathieu Clabaut  wrote:
> > Really nice !
> >
> > Thank you for publishing it... I'll try this soon...
> > -Mathieu
> >
> >
> >
> > On Thu, May 6, 2010 at 20:19, Thadeus Burgess 
> wrote:
> > > The documentation will now live on the cheeseshop.
> >
> > >http://packages.python.org/web2py_utils/
> >
> > > You can now easy_install it
> >
> > > This release includes a new Test Runner module, to help properly
> > > UnitTest web2py applications. It includes WebTest, Nosetests, Coverage
> > > support, as well as creating a fake web2py environment for you!
> >
> > > To learn more about Test Runner, please see the following page
> >
> > >http://packages.python.org/web2py_utils/test_runner.html
> >
> > > --
> > > Thadeus
>
> Thanks again Thadeus, you've really been a roll lately! Keep it up.
>


[web2py] How to auto-login into an account from an specific computer.

2010-05-13 Thread Benigno
We have made an app with web2py to present data from a home-automated
home as a web service. There is a certain hardware at the home that
sends all the information that transverses the bus into our server,
and from there on, we process and present the data using web2py.

There are several homes using this service, so, the application
requires login. But I would like to have all computers from each home
to be able to access their account without needing to enter user and
password.

This is because people will access this app from touch screens mounted
on the walls of their homes.

Not all homes have a fixed IP address.

What would be the best way to do this without fixed IP addresses?
Permanent cookies (how would this be done in web2py?) the browsers in
those computers will be opening and closing, and there are reboots and
everything).

If it is much easier, how would this be done if they have fixed IP
addresses?. (I have to, not only give them access, but also to
identify them, as each can access only their home's data).

Thanks for your help,
Benigno.


[web2py] Re: ToscaWidgets

2010-05-13 Thread lannick
Hi,

Thank you for your answer.

Massimo, I agree with you using tw-forms is not the best way to
construct forms.
But with toscawidgets I don't want to use tw-forms but all others
widgets. you can see them here : http://toscawidgets.org/hg
I am a beginner in python and web2py. I don't want to learn javascript
and TW seem to make easy the use of ajax widgets.
Only an easy-install and an import in the web2py code.

It is about that I would like some help from web2py community.

Sorry for my bad english.

Regards,
Lannick

On 12 mai, 18:16, mdipierro  wrote:
> I do not think anybody did and here is why:
>
> ToscaWidget example
>
> import tw.forms as twf
> movie_form = twf.TableForm('movie_form', action='save_movie',
> children=[
>     twf.HiddenField('id'),
>     twf.TextField('title'),
>     twf.TextField('year', size=4),
>     twf.CalendarDatePicker('release_date'),
>     twf.SingleSelectField('genera', options=['', 'Action', 'Comedy',
> 'Other']),
>     twf.TextArea('description'),
> ])
>
> same code in web2py:
>
> movie_form = SQLFORM.factory(
>     Field('title','text'),
>     Field('year', length=4),
>     Field('release_date','date'),
>     Field('genera', requires=IS_IN_SET(('Action', 'Comedy',
> 'Other'),zero='')),
>     Field('description','text'),
>     _hidden=dict(id=3),_action=URL(r=request,f='save_movie'))
>
> On May 12, 10:36 am, stefaan  wrote:
>
> > > Nobody know Toscawidgets and have try it with web2py ?
>
> > Hello Lannick,
>
> > Given the lack of answers it is safe to assume that no-one has tried
> > it with web2py...
>
> > Best regards,
> > Stefaan.