[web2py] is it possible to communicate over webservices in web2py application?

2012-05-01 Thread Amit
Hi,
I have to develop one web2py application which will run on one machine 
(lets say SERVER), this machine will have MySql database also installed and 
running.
Users can connect remotely to the Web2py app over Https(Lets say it CLIENT)
There is one more system running over the network(Lets say N/W Panel) which 
can send the data to the SERVER and which will be further saved to the 
MySql database and Web2Py application will display the updated data to the 
CLIENT.
 So the scenarios are:
1.  SERVER can act like a client when CLIENT can request some data from N/W 
Panel (here N/W Panel acts as Server) using Web2Py application.
2.  N/W Panel can act like a client when it gets some updated data from 
different devices and needs to save to the MySql database which is running 
on SERVER(here SERVER acts as Server).

Now My question is how to achieve it using web services as it is a 
bi-directional communication between SERVER and N/W Panel AND how to 
integrate with Web2Py application?
Web services can be SOAP OR REST. 

Regards,
Amit


[web2py] Re: Amazon EC2 discussion: pros/cons, etc.

2012-05-01 Thread howesc
i use GAE heavilythe biggest reason to not use GAE is if you want an 
app that does complex queries - you just can't do complex queries and 
roll-ups on GAE.  there are other freedoms that EC2 give you that if you 
have the IT support to run them it might be worth it.  i am wrestling with 
that daily with my largest used app.

On Tuesday, May 1, 2012 5:18:02 PM UTC-7, Derek wrote:
>
> EC2 is good, but why would you use that when you can use GAE? What's the 
> advantage?
>
> On Monday, April 30, 2012 2:59:21 AM UTC-7, lucas wrote:
>>
>> hello one and all,
>>
>> i am curious about using a cloud, like Amazon EC2.  i don't know anything 
>> about it.  but i am curious and interested.  i have always setup my own 
>> server and run it.  but my needs have changed for more media and the 
>> throughput of my internet will be challenged if i try to host my server 
>> locally.  so i am thinking of off-sighting it.
>>
>> i am very used to CentOS, its the free version of Redhat Enterprise, and 
>> the current version of CentOS is v6.x, which lets the web2py install script 
>> run flawlessly without all kinds of package dependency issues and cross 
>> issues.  does Amazon EC2 allow me to install or have my own CentOS 6.x 
>> install?
>>
>> if amazon EC2 allows that centos 6.x install, then i can easily install 
>> web2py with the script, and postgresql 9.x, and apache and run my own 
>> server off-site.  does anyone foresee me having issues if i can do that at 
>> all?
>>
>> thanx in advance and i look forward to your experienced opinions.  lucas
>>
>

[web2py] Re: Amazon EC2 discussion: pros/cons, etc.

2012-05-01 Thread pbreit
I think it's much easier to justify using a normal stack vs. something very 
proprietary that may not support SQL, https, domains, some python 
libraries, etc and can get crazy expensive.

Re: [web2py] Re: CMS question

2012-05-01 Thread Massimo Di Pierro
I am thinking of turning it into a plugin once done, should be easy to do. 

On Tuesday, 1 May 2012 18:16:50 UTC-5, mcm wrote:
>
> Massimo, 
>
> Great! I want it! :-) 
>
> Does the single action mean that it is easily added to any existing 
> application?  Will it be a plugin? 
>
>
> mic 
>
> 2012/5/1 Massimo Di Pierro : 
> > One controller action deals with all pages. The page structure is 
> > 
> > http://.../w2cms/default/read// 
> > 
> > where w2cms/default/read/ can be collapsed into just  using 
> > routes.py. The slug is put there just for show but it not used 
> internally. 
> > It always uses the  for speed. The slug is computed from the title 
> > automatically therefore there is no issue with special characters (in 
> the 
> > sense they appear in title, but disappear from slug). 
> > 
> > 
> > On Tuesday, May 1, 2012 4:01:33 PM UTC-5, IK wrote: 
> >> 
> >> This looks great Massimo. It sure is kick-ass CMS. Can't wait to try it 
> on 
> >> my server :) ... I also like the name  :) 
> >> 
> >> Just wondering, how URL's file (page) structure, will be dealt with ( 
> one 
> >> Controller/View for all pages, or each page will have it's own View) 
> and how 
> >> customisable will it be? And, will hyphens in URLs cause any problems 
> (where 
> >> you can use both, hyphen and underscore in the same URL)? 
> >> 
> >> I don't want to rush you, but when can we expect GA version? :) 
> >> 
> >> Thanks 
> >> ivica 
> >> 
> >> 
> >> On 1 May 2012 21:35, Massimo Di Pierro  
> wrote: 
> >>> 
> >>> This is what I have so far... 
> >>> 
> >>> http://dl.dropbox.com/u/18065445/Tmp/w2cms.pdf 
> >>> 
> >>> you can try some of it here but you cannot login. You can edit the 
> >>> content of the white box. 
> >>> 
> >>> http://tests.web2py.com/w2cms/default/index 
> >>> 
> >>> 
> >>> - can clone any existing web site (copies, html, css, js, images and 
> >>> fixes all links) 
> >>> - comes with may layouts (supports all joomla, drupal, worldpress 
> >>> layouts) 
> >>> - can edit pages in place using html5 contentEditable (true wysiwyg) 
> but 
> >>> can also edit raw html 
> >>> - users can limit which page areas are editable 
> >>> - injects scripts into pages which display 3 drawers on every page and 
> >>> are content dependent 
> >>> - pages have tags and read-write attributes. You can find tags and 
> groups 
> >>> using autocomplete. 
> >>> - @{page.menu} inserts a menu, @{page.title} inserts title etc, 
> >>> @{widget.whatever.you.define} 
> >>> - If you cut and paste in the page a link to a youtube page, it embeds 
> >>> the video on the page. Same with vimeo and other oembed services. I 
> use my 
> >>> own library for this which is similar to django-oembed and micawber 
> (in fact 
> >>> it supports more services than them and I have submitted a patch to 
> >>> micawber). 
> >>> - supports latex via mathjax 
> >>> 
> >>> It still needs some work before I can release it. 
> >>> 
> >>> What else would you like to see in a CMS? 
> >>> 
> >>> massimo 
> >>> 
> >> 
> > 
>


Re: [web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Massimo Di Pierro
Thanks for letting us know.


On Tuesday, 1 May 2012 21:57:23 UTC-5, Rhys wrote:
>
> It was something in the apache config file. I've posted some replies to 
> the thread to the end of this. It was a result from a copy and paste. 
>
> Cheers,
>
> On 2 May 2012 11:49, Massimo Di Pierro  wrote:
>
>> I cannot reproduce this.
>>
>>
>> On Tuesday, 1 May 2012 16:56:34 UTC-5, Rhys wrote:
>>>
>>> All I did was download the distribution zip. Unzipped it and then ran 
>>> it. Nothing else. That is why It's gotten me stumped.
>>>
>>>
>>> On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:

 How did you install web2py? Did you download and unzip the distribution 
 or did you do something else?

 On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:
>
> Hi All,
>
> I've just installed the latest stable build of the framework and the 
> Welcome app is giving me an internal error. The examples app and admin 
> app 
> work fine, but the welcome app is dead. I've attached the error log spat 
> out. At first I thought it was apache, as I'm doing a virtual host with 
> it, 
> so I used the web2py.py server and achieved the same. I've looked at the 
> error file spat out and all it gives me is that the module doesn't have 
> an 
> attribute contrib. (gluon.contrib).
>
> I'm running a virtualenv --no-site-packages and also I've installed 
> the pysqlite package (this is the only package installed for the 
> virtualenv). Sqlite is woking as I have a python neural network using it 
> for experience data storage, and it working like a dream still.
>
> I would love some insight into the problem. Is it a clean fix, am I 
> missing something? I'm building a large project witih web2py for my PhD 
> and 
> don't really want little hicups like this to bite me latter down the 
> track.
>
> Cheers,
>
> Rhys
>

>
>
> -- 
>  
>
>  *Rhys Tague*
> *The Tall Guy*
> Skype: rhys.tague
> Profile: about.me/rhys
> E: rhys.ta...@vcrowd.com
> T: twitter.com/vcrowd 
>  


Re: [web2py] Re: CMS question

2012-05-01 Thread villas
It looks fascinating and I am looking forward to trying to integrate this 
into a project.

For any CMS I always think there are 3 types of editors.
1. MarkUp-only editors
2. Markup / HTML / CSS editors
3. Programmers who can also embed scripts,  database content,  etc. 

Solutions always seem to be limiting to at least one group.

>From the point of view of group 3,  it will be interesting how we can get 
python and data into the pages.

I also wonder where this might leave plugin-wiki?  

Regards, David



Re: [web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Rhys Tague
It was something in the apache config file. I've posted some replies to the
thread to the end of this. It was a result from a copy and paste.

Cheers,

On 2 May 2012 11:49, Massimo Di Pierro  wrote:

> I cannot reproduce this.
>
>
> On Tuesday, 1 May 2012 16:56:34 UTC-5, Rhys wrote:
>>
>> All I did was download the distribution zip. Unzipped it and then ran it.
>> Nothing else. That is why It's gotten me stumped.
>>
>>
>> On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:
>>>
>>> How did you install web2py? Did you download and unzip the distribution
>>> or did you do something else?
>>>
>>> On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:

 Hi All,

 I've just installed the latest stable build of the framework and the
 Welcome app is giving me an internal error. The examples app and admin app
 work fine, but the welcome app is dead. I've attached the error log spat
 out. At first I thought it was apache, as I'm doing a virtual host with it,
 so I used the web2py.py server and achieved the same. I've looked at the
 error file spat out and all it gives me is that the module doesn't have an
 attribute contrib. (gluon.contrib).

 I'm running a virtualenv --no-site-packages and also I've installed the
 pysqlite package (this is the only package installed for the virtualenv).
 Sqlite is woking as I have a python neural network using it
 for experience data storage, and it working like a dream still.

 I would love some insight into the problem. Is it a clean fix, am I
 missing something? I'm building a large project witih web2py for my PhD and
 don't really want little hicups like this to bite me latter down the track.

 Cheers,

 Rhys

>>>


-- 


 *Rhys Tague*
*The Tall Guy*
Skype: rhys.tague
Profile: about.me/rhys
E: rhys.ta...@vcrowd.com
T: twitter.com/vcrowd


[web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Massimo Di Pierro
I cannot reproduce this.

On Tuesday, 1 May 2012 16:56:34 UTC-5, Rhys wrote:
>
> All I did was download the distribution zip. Unzipped it and then ran it. 
> Nothing else. That is why It's gotten me stumped.
>
>
> On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:
>>
>> How did you install web2py? Did you download and unzip the distribution 
>> or did you do something else?
>>
>> On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:
>>>
>>> Hi All,
>>>
>>> I've just installed the latest stable build of the framework and the 
>>> Welcome app is giving me an internal error. The examples app and admin app 
>>> work fine, but the welcome app is dead. I've attached the error log spat 
>>> out. At first I thought it was apache, as I'm doing a virtual host with it, 
>>> so I used the web2py.py server and achieved the same. I've looked at the 
>>> error file spat out and all it gives me is that the module doesn't have an 
>>> attribute contrib. (gluon.contrib).
>>>
>>> I'm running a virtualenv --no-site-packages and also I've installed the 
>>> pysqlite package (this is the only package installed for the virtualenv). 
>>> Sqlite is woking as I have a python neural network using it 
>>> for experience data storage, and it working like a dream still.
>>>
>>> I would love some insight into the problem. Is it a clean fix, am I 
>>> missing something? I'm building a large project witih web2py for my PhD and 
>>> don't really want little hicups like this to bite me latter down the track.
>>>
>>> Cheers,
>>>
>>> Rhys
>>>
>>

[web2py] Re: Trouble using URLs to specify the language

2012-05-01 Thread Anthony
According to router.example.py, it should be request.language, not 
request.lang, though the only reference I see in rewrite.py is 
request.uri_language, so maybe try both of those and see if it works.

Anthony

On Tuesday, May 1, 2012 5:27:07 PM UTC-4, ender72 wrote:
>
> Hi,
> I'm reading "web2py application development cookbook",
> page 277
> "To specify a language for outgoing URLs using URL(), set request.lang to 
> one of the supported languages [...]".
>
> Mmm... maybe something's wrong, because if I put this code in a view:
>
> {{
>   request.lang='it'
>   link_it = URL('about', 'index')
>   request.lang='en'
>   link_en = URL('about', 'index')
>   request.lang='fr'
>   link_fr = URL('about', 'index')
> }}
> {{=link_it}}, {{=link_en}}, {{=link_fr}}
>
> results are:
> /en/azienda, /en/azienda, /en/azienda 
> (if request.url is http://127.0.0.1:8000/app/en///)
> or
> /it/azienda, /it/azienda, /it/azienda 
> (if request.url is http://127.0.0.1:8000/app/it///)
> etc...
>
> my routes.py is
>
> routers = dict(
> BASE = dict(
> default_application='app',
> default_controller = 'home',
> default_function = 'index'
> ),
> casal = dict(
> map_hyphen = True,
> languages = ['it', 'en', 'fr'],
> default_language = 'it',
> ),
> )
>
>
> Thanks.
>


[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread Anthony

>
> Another quick question if I may.  What if I didn't want to store the URL 
> in a database at all?  Can you have conditionals inside the 
> db.define_table?  Or maybe have separate function that would return the URL 
> string and call it from inside the _href.  Something like:
>
> _href='http://' + get_url(shipment.url) + value
>
> Would it be better to do it this way, eliminating the need for a separate 
> table to store the URLs?  Although "better" probably depends on what you 
> are trying to do.


Sure, if it's a relatively small number of shippers, you might just create 
a dictionary in a model file with shipper names as keys and urls as values.

Anthony


[web2py] Re: Lost printing auth_user - Server Error

2012-05-01 Thread Bruce Wade
Found the problem:
redirect('settings','index')

Should be:
redirect(URL('settings','index')) but the response it uses to handle it is
a major bug.

On Tue, May 1, 2012 at 5:15 PM, Bruce Wade  wrote:

> Hi,
>
> The screen only shows Server Error the console output shows:
>
> , 'last_name':
> 'Wade', 'update_record':  at 0x393e410>, 'uad_id': '12',
> 'reset_password_key': '', 'postal_code': 'V3B7W7', 'registration_key': '',
> 'id': 1, 'referral_id': '3244', 'city': 1, 'first_name': 'Stealth',
> 'reset_security_key': '', 'auth_cas': ,
> 'email': 'bruce.w...@gmail.com', 'delete_record':  at
> 0x393e398>, 'province': 1, 'registration_id': '', 'phone': '6047211080',
> 'address': '5115 Norfolk St', 'password':
> '6493b31ce41b6619c4f2889fc3cfa2e4', 'country': 1, 'auth_membership':
> }>
> ERROR:Rocket.Errors.Thread-11:Traceback (most recent call last):
>
>   File
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rocket.py",
> line 1302, in run
> self.run_app(conn)
>
>   File
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rocket.py",
> line 1994, in run_app
> output = self.app(environ, self.start_response)
>
>   File
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/main.py", line
> 678, in app_with_logging
> ret[0] = wsgiapp(environ, responder2)
>
>   File
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/main.py", line
> 602, in wsgibase
> http_response, request, environ, ticket)
>
>   File
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rewrite.py",
> line 164, in try_rewrite_on_error
> status = int(str(http_response.status).split()[0])
>
> ValueError: invalid literal for int() with base 10: 'index'
>
> And the code that is causing it:
>
> if createAccountFrom.accepts(request,session):
> member = advertising_db(advertising_db.auth_user.id ==
> auth.user.id).select().first()
> print member
> #member.first_name = createAccountFrom.vars.fname
> #print member
> session.flash = T("Account information has been updated!")
> redirect('settings','index')
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: Amazon EC2 discussion: pros/cons, etc.

2012-05-01 Thread Derek
EC2 is good, but why would you use that when you can use GAE? What's the 
advantage?

On Monday, April 30, 2012 2:59:21 AM UTC-7, lucas wrote:
>
> hello one and all,
>
> i am curious about using a cloud, like Amazon EC2.  i don't know anything 
> about it.  but i am curious and interested.  i have always setup my own 
> server and run it.  but my needs have changed for more media and the 
> throughput of my internet will be challenged if i try to host my server 
> locally.  so i am thinking of off-sighting it.
>
> i am very used to CentOS, its the free version of Redhat Enterprise, and 
> the current version of CentOS is v6.x, which lets the web2py install script 
> run flawlessly without all kinds of package dependency issues and cross 
> issues.  does Amazon EC2 allow me to install or have my own CentOS 6.x 
> install?
>
> if amazon EC2 allows that centos 6.x install, then i can easily install 
> web2py with the script, and postgresql 9.x, and apache and run my own 
> server off-site.  does anyone foresee me having issues if i can do that at 
> all?
>
> thanx in advance and i look forward to your experienced opinions.  lucas
>


[web2py] Lost printing auth_user - Server Error

2012-05-01 Thread Bruce Wade
Hi,

The screen only shows Server Error the console output shows:

, 'last_name':
'Wade', 'update_record':  at 0x393e410>, 'uad_id': '12',
'reset_password_key': '', 'postal_code': 'V3B7W7', 'registration_key': '',
'id': 1, 'referral_id': '3244', 'city': 1, 'first_name': 'Stealth',
'reset_security_key': '', 'auth_cas': ,
'email': 'bruce.w...@gmail.com', 'delete_record':  at
0x393e398>, 'province': 1, 'registration_id': '', 'phone': '6047211080',
'address': '5115 Norfolk St', 'password':
'6493b31ce41b6619c4f2889fc3cfa2e4', 'country': 1, 'auth_membership':
}>
ERROR:Rocket.Errors.Thread-11:Traceback (most recent call last):

  File
"/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rocket.py",
line 1302, in run
self.run_app(conn)

  File
"/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rocket.py",
line 1994, in run_app
output = self.app(environ, self.start_response)

  File
"/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/main.py", line
678, in app_with_logging
ret[0] = wsgiapp(environ, responder2)

  File
"/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/main.py", line
602, in wsgibase
http_response, request, environ, ticket)

  File
"/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/rewrite.py",
line 164, in try_rewrite_on_error
status = int(str(http_response.status).split()[0])

ValueError: invalid literal for int() with base 10: 'index'

And the code that is causing it:

if createAccountFrom.accepts(request,session):
member = advertising_db(advertising_db.auth_user.id == auth.user.id
).select().first()
print member
#member.first_name = createAccountFrom.vars.fname
#print member
session.flash = T("Account information has been updated!")
redirect('settings','index')

-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Rhys
Solved it!

There was a problem in my config for apache. Arrgh!! When I copied and 
pasted it form a text editor it placed / to signify a new line in one of 
the paths. Alias path to be exact, and therefor not everything was being 
located.

Thanks Massimo for your comments.

Cheers,

Rhys

On Wednesday, May 2, 2012 8:16:31 AM UTC+10, Rhys wrote:
>
> I just made a clone of the trunk from git hub and it is giving me the same 
> error. However, this time I can use the normal web2py.py server and 
> everything is fine. Here is my setup for apache.
>
> 
> #Use the virtual environment setup for python
> WSGIPythonHome /Users/rhystague/repos/env
> 
>
> 
>
>  ServerName airconhive.local
>  WSGIDaemonProcess web2py user=www
>
>
>  WSGIProcessGroup web2py 
>  WSGIScriptAlias / /Users/rhystague/repos/airconhive/var/wsgihandler.py
>
> 
> AllowOverride None
>   Order Allow,Deny
>   Deny from all
>   
> Allow from all
>   
> 
>
> AliasMatch ^/([^/]+)/static/(.*) \
> 
> /Users/rhystague//repos/airconhive//var/applications/$1/static/$2
>
>  /Users/rhystague/repos/airconhive/var/applications/*/static/>
> Order Allow,Deny
>   Allow from all
> 
>
> 
> Deny from all
> 
>
> 
> Deny from all
> 
>
> CustomLog "/opt/local/apache2/logs/airconhive-error" common
> ErrorLog "/opt/local/apache2/logs/airconhive-log"
>   
>
> On Wednesday, May 2, 2012 7:56:34 AM UTC+10, Rhys wrote:
>>
>> All I did was download the distribution zip. Unzipped it and then ran it. 
>> Nothing else. That is why It's gotten me stumped.
>>
>>
>> On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:
>>>
>>> How did you install web2py? Did you download and unzip the distribution 
>>> or did you do something else?
>>>
>>> On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:

 Hi All,

 I've just installed the latest stable build of the framework and the 
 Welcome app is giving me an internal error. The examples app and admin app 
 work fine, but the welcome app is dead. I've attached the error log spat 
 out. At first I thought it was apache, as I'm doing a virtual host with 
 it, 
 so I used the web2py.py server and achieved the same. I've looked at the 
 error file spat out and all it gives me is that the module doesn't have an 
 attribute contrib. (gluon.contrib).

 I'm running a virtualenv --no-site-packages and also I've installed the 
 pysqlite package (this is the only package installed for the virtualenv). 
 Sqlite is woking as I have a python neural network using it 
 for experience data storage, and it working like a dream still.

 I would love some insight into the problem. Is it a clean fix, am I 
 missing something? I'm building a large project witih web2py for my PhD 
 and 
 don't really want little hicups like this to bite me latter down the track.

 Cheers,

 Rhys

>>>

Re: [web2py] Re: CMS question

2012-05-01 Thread Michele Comitini
Massimo,

Great! I want it! :-)

Does the single action mean that it is easily added to any existing
application?  Will it be a plugin?


mic

2012/5/1 Massimo Di Pierro :
> One controller action deals with all pages. The page structure is
>
> http://.../w2cms/default/read//
>
> where w2cms/default/read/ can be collapsed into just  using
> routes.py. The slug is put there just for show but it not used internally.
> It always uses the  for speed. The slug is computed from the title
> automatically therefore there is no issue with special characters (in the
> sense they appear in title, but disappear from slug).
>
>
> On Tuesday, May 1, 2012 4:01:33 PM UTC-5, IK wrote:
>>
>> This looks great Massimo. It sure is kick-ass CMS. Can't wait to try it on
>> my server :) ... I also like the name  :)
>>
>> Just wondering, how URL's file (page) structure, will be dealt with ( one
>> Controller/View for all pages, or each page will have it's own View) and how
>> customisable will it be? And, will hyphens in URLs cause any problems (where
>> you can use both, hyphen and underscore in the same URL)?
>>
>> I don't want to rush you, but when can we expect GA version? :)
>>
>> Thanks
>> ivica
>>
>>
>> On 1 May 2012 21:35, Massimo Di Pierro  wrote:
>>>
>>> This is what I have so far...
>>>
>>> http://dl.dropbox.com/u/18065445/Tmp/w2cms.pdf
>>>
>>> you can try some of it here but you cannot login. You can edit the
>>> content of the white box.
>>>
>>> http://tests.web2py.com/w2cms/default/index
>>>
>>>
>>> - can clone any existing web site (copies, html, css, js, images and
>>> fixes all links)
>>> - comes with may layouts (supports all joomla, drupal, worldpress
>>> layouts)
>>> - can edit pages in place using html5 contentEditable (true wysiwyg) but
>>> can also edit raw html
>>> - users can limit which page areas are editable
>>> - injects scripts into pages which display 3 drawers on every page and
>>> are content dependent
>>> - pages have tags and read-write attributes. You can find tags and groups
>>> using autocomplete.
>>> - @{page.menu} inserts a menu, @{page.title} inserts title etc,
>>> @{widget.whatever.you.define}
>>> - If you cut and paste in the page a link to a youtube page, it embeds
>>> the video on the page. Same with vimeo and other oembed services. I use my
>>> own library for this which is similar to django-oembed and micawber (in fact
>>> it supports more services than them and I have submitted a patch to
>>> micawber).
>>> - supports latex via mathjax
>>>
>>> It still needs some work before I can release it.
>>>
>>> What else would you like to see in a CMS?
>>>
>>> massimo
>>>
>>
>


[web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Rhys
I just made a clone of the trunk from git hub and it is giving me the same 
error. However, this time I can use the normal web2py.py server and 
everything is fine. Here is my setup for apache.


#Use the virtual environment setup for python
WSGIPythonHome /Users/rhystague/repos/env




 ServerName airconhive.local
 WSGIDaemonProcess web2py user=www


 WSGIProcessGroup web2py 
 WSGIScriptAlias / /Users/rhystague/repos/airconhive/var/wsgihandler.py


AllowOverride None
  Order Allow,Deny
  Deny from all
  
Allow from all
  


AliasMatch ^/([^/]+)/static/(.*) \

/Users/rhystague//repos/airconhive//var/applications/$1/static/$2


Order Allow,Deny
  Allow from all



Deny from all



Deny from all


CustomLog "/opt/local/apache2/logs/airconhive-error" common
ErrorLog "/opt/local/apache2/logs/airconhive-log"
  

On Wednesday, May 2, 2012 7:56:34 AM UTC+10, Rhys wrote:
>
> All I did was download the distribution zip. Unzipped it and then ran it. 
> Nothing else. That is why It's gotten me stumped.
>
>
> On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:
>>
>> How did you install web2py? Did you download and unzip the distribution 
>> or did you do something else?
>>
>> On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:
>>>
>>> Hi All,
>>>
>>> I've just installed the latest stable build of the framework and the 
>>> Welcome app is giving me an internal error. The examples app and admin app 
>>> work fine, but the welcome app is dead. I've attached the error log spat 
>>> out. At first I thought it was apache, as I'm doing a virtual host with it, 
>>> so I used the web2py.py server and achieved the same. I've looked at the 
>>> error file spat out and all it gives me is that the module doesn't have an 
>>> attribute contrib. (gluon.contrib).
>>>
>>> I'm running a virtualenv --no-site-packages and also I've installed the 
>>> pysqlite package (this is the only package installed for the virtualenv). 
>>> Sqlite is woking as I have a python neural network using it 
>>> for experience data storage, and it working like a dream still.
>>>
>>> I would love some insight into the problem. Is it a clean fix, am I 
>>> missing something? I'm building a large project witih web2py for my PhD and 
>>> don't really want little hicups like this to bite me latter down the track.
>>>
>>> Cheers,
>>>
>>> Rhys
>>>
>>

[web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Rhys
All I did was download the distribution zip. Unzipped it and then ran it. 
Nothing else. That is why It's gotten me stumped.


On Tuesday, May 1, 2012 11:34:43 PM UTC+10, Massimo Di Pierro wrote:
>
> How did you install web2py? Did you download and unzip the distribution or 
> did you do something else?
>
> On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:
>>
>> Hi All,
>>
>> I've just installed the latest stable build of the framework and the 
>> Welcome app is giving me an internal error. The examples app and admin app 
>> work fine, but the welcome app is dead. I've attached the error log spat 
>> out. At first I thought it was apache, as I'm doing a virtual host with it, 
>> so I used the web2py.py server and achieved the same. I've looked at the 
>> error file spat out and all it gives me is that the module doesn't have an 
>> attribute contrib. (gluon.contrib).
>>
>> I'm running a virtualenv --no-site-packages and also I've installed the 
>> pysqlite package (this is the only package installed for the virtualenv). 
>> Sqlite is woking as I have a python neural network using it 
>> for experience data storage, and it working like a dream still.
>>
>> I would love some insight into the problem. Is it a clean fix, am I 
>> missing something? I'm building a large project witih web2py for my PhD and 
>> don't really want little hicups like this to bite me latter down the track.
>>
>> Cheers,
>>
>> Rhys
>>
>

Re: [web2py] Re: CMS question

2012-05-01 Thread Massimo Di Pierro
One controller action deals with all pages. The page structure is

http://.../w2cms/default/read//

where w2cms/default/read/ can be collapsed into just  using 
routes.py. The slug is put there just for show but it not used internally. 
It always uses the  for speed. The slug is computed from the title 
automatically therefore there is no issue with special characters (in the 
sense they appear in title, but disappear from slug).

On Tuesday, May 1, 2012 4:01:33 PM UTC-5, IK wrote:
>
> This looks great Massimo. It sure is kick-ass CMS. Can't wait to try it on 
> my server :) ... I also like the name  :)
>
> Just wondering, how URL's file (page) structure, will be dealt with ( one 
> Controller/View for all pages, or each page will have it's own View) and 
> how customisable will it be? And, will hyphens in URLs cause any problems 
> (where you can use both, hyphen and underscore in the same URL)?
>
> I don't want to rush you, but when can we expect GA version? :)
>
> Thanks
> ivica
>
>
> On 1 May 2012 21:35, Massimo Di Pierro  wrote:
>
>> This is what I have so far... 
>>
>> http://dl.dropbox.com/u/18065445/Tmp/w2cms.pdf
>>
>> you can try some of it here but you cannot login. You can edit the 
>> content of the white box.
>>
>> http://tests.web2py.com/w2cms/default/index
>>
>>
>> - can clone any existing web site (copies, html, css, js, images and 
>> fixes all links)
>> - comes with may layouts (supports all joomla, drupal, worldpress layouts)
>> - can edit pages in place using html5 contentEditable (true wysiwyg) but 
>> can also edit raw html
>> - users can limit which page areas are editable
>> - injects scripts into pages which display 3 drawers on every page and 
>> are content dependent
>> - pages have tags and read-write attributes. You can find tags and groups 
>> using autocomplete.
>> - @{page.menu} inserts a menu, @{page.title} inserts title etc, 
>> @{widget.whatever.you.define}
>> - If you cut and paste in the page a link to a youtube page, it embeds 
>> the video on the page. Same with vimeo and other oembed services. I use my 
>> own library for this which is similar to django-oembed and micawber (in 
>> fact it supports more services than them and I have submitted a patch to 
>> micawber).
>> - supports latex via mathjax
>>
>> It still needs some work before I can release it.
>>
>> What else would you like to see in a CMS?
>>
>> massimo
>>
>>
>

[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread zounds
Another quick question if I may.  What if I didn't want to store the URL in 
a database at all?  Can you have conditionals inside the db.define_table?  
Or maybe have separate function that would return the URL string and call 
it from inside the _href.  Something like:

_href='http://' + get_url(shipment.url) + value

Would it be better to do it this way, eliminating the need for a separate 
table to store the URLs?  Although "better" probably depends on what you 
are trying to do.

On Tuesday, May 1, 2012 4:02:29 PM UTC-4, Anthony wrote:
>
> I had entered the carrier.url as "www.bing.com/search?q=" instead of "
>> http://www.bing.com/search?q=";.
>>
>
> Yes, without the "http://";, the browser will still see it as a relative 
> URL and add it to the current domain. Instead of storing http:// with the 
> URL, you could also do:
>
> _href='http://' + row.carrier.url + value
>
> Anthony
>


[web2py] Trouble using URLs to specify the language

2012-05-01 Thread ender72
Hi,
I'm reading "web2py application development cookbook",
page 277
"To specify a language for outgoing URLs using URL(), set request.lang to 
one of the supported languages [...]".

Mmm... maybe something's wrong, because if I put this code in a view:

{{
  request.lang='it'
  link_it = URL('about', 'index')
  request.lang='en'
  link_en = URL('about', 'index')
  request.lang='fr'
  link_fr = URL('about', 'index')
}}
{{=link_it}}, {{=link_en}}, {{=link_fr}}

results are:
/en/azienda, /en/azienda, /en/azienda 
(if request.url is http://127.0.0.1:8000/app/en///)
or
/it/azienda, /it/azienda, /it/azienda 
(if request.url is http://127.0.0.1:8000/app/it///)
etc...

my routes.py is

routers = dict(
BASE = dict(
default_application='app',
default_controller = 'home',
default_function = 'index'
),
casal = dict(
map_hyphen = True,
languages = ['it', 'en', 'fr'],
default_language = 'it',
),
)


Thanks.


Re: [web2py] Re: CMS question

2012-05-01 Thread Ivica Kralj
This looks great Massimo. It sure is kick-ass CMS. Can't wait to try it on
my server :) ... I also like the name  :)

Just wondering, how URL's file (page) structure, will be dealt with ( one
Controller/View for all pages, or each page will have it's own View) and
how customisable will it be? And, will hyphens in URLs cause any problems
(where you can use both, hyphen and underscore in the same URL)?

I don't want to rush you, but when can we expect GA version? :)

Thanks
ivica


On 1 May 2012 21:35, Massimo Di Pierro  wrote:

> This is what I have so far...
>
> http://dl.dropbox.com/u/18065445/Tmp/w2cms.pdf
>
> you can try some of it here but you cannot login. You can edit the content
> of the white box.
>
> http://tests.web2py.com/w2cms/default/index
>
>
> - can clone any existing web site (copies, html, css, js, images and fixes
> all links)
> - comes with may layouts (supports all joomla, drupal, worldpress layouts)
> - can edit pages in place using html5 contentEditable (true wysiwyg) but
> can also edit raw html
> - users can limit which page areas are editable
> - injects scripts into pages which display 3 drawers on every page and are
> content dependent
> - pages have tags and read-write attributes. You can find tags and groups
> using autocomplete.
> - @{page.menu} inserts a menu, @{page.title} inserts title etc,
> @{widget.whatever.you.define}
> - If you cut and paste in the page a link to a youtube page, it embeds the
> video on the page. Same with vimeo and other oembed services. I use my own
> library for this which is similar to django-oembed and micawber (in fact it
> supports more services than them and I have submitted a patch to micawber).
> - supports latex via mathjax
>
> It still needs some work before I can release it.
>
> What else would you like to see in a CMS?
>
> massimo
>
>


[web2py] Re: CMS question

2012-05-01 Thread Massimo Di Pierro
This is what I have so far... 

http://dl.dropbox.com/u/18065445/Tmp/w2cms.pdf

you can try some of it here but you cannot login. You can edit the content 
of the white box.

http://tests.web2py.com/w2cms/default/index


- can clone any existing web site (copies, html, css, js, images and fixes 
all links)
- comes with may layouts (supports all joomla, drupal, worldpress layouts)
- can edit pages in place using html5 contentEditable (true wysiwyg) but 
can also edit raw html
- users can limit which page areas are editable
- injects scripts into pages which display 3 drawers on every page and are 
content dependent
- pages have tags and read-write attributes. You can find tags and groups 
using autocomplete.
- @{page.menu} inserts a menu, @{page.title} inserts title etc, 
@{widget.whatever.you.define}
- If you cut and paste in the page a link to a youtube page, it embeds the 
video on the page. Same with vimeo and other oembed services. I use my own 
library for this which is similar to django-oembed and micawber (in fact it 
supports more services than them and I have submitted a patch to micawber).
- supports latex via mathjax

It still needs some work before I can release it.

What else would you like to see in a CMS?

massimo



[web2py] [Solved] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
So both solutions are working. One on the form in the controller, one as 
compute in the models when defining the table.

Thanks,

Le mardi 1 mai 2012 21:38:59 UTC+2, François Delpierre a écrit :
>
> Hi Anthony,
>
> The proposal does not work as is. It looks like there is 
> no request.vars._formname.
> P.S. : There is a small typo : request.vars._formname.startswith(...
>
> However, with strong inspiration of your solution I made some additonal 
> tests and found a compute function that perfectly works :
>
> compute=lambda row: db.t_templates(request.vars.id).f_revision + 1 if (
> request.vars.id and db.t_templates(request.vars.id).f_revision) else 1,
>
> Super thanks Anthony. I'll use this solution as I prefer to have it on the 
> DAL.
>
> Le mardi 1 mai 2012 15:48:06 UTC+2, Anthony a écrit :
>>
>> I think the row object submitted to the compute function only includes 
>> the fields that are part of the update, so it won't include 
>> row['f_revision']. Instead, you could get the record id from request.vars 
>> and use that to query the current value of the f_revision field:
>>
>> db.define_table('t_templates', Field('name'),
>> Field('f_template', 'upload', label=T('File'), notnull=True),
>> Field('f_revision', 'integer', label=T('Revision'),
>> compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if 
>> (request.vars.id and
>> request.vars._formname and request.vars_formname.startswith(
>> 't_templates')) else 1))
>>
>> Anthony
>>
>> On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>>>
>>> Hi,
>>>
>>> Here is exactly what I would like to have, but it does not compute on 
>>> update :
>>>
>>> db.define_table('t_templates',
>>>   Field('f_template', type='upload', label=T('File'),notnull=True), 
>>>
>>> 
>>>   Field('f_revision', type='integer', label=T('Revision'),
>>>   default=1,
>>>   compute=lambda row: row['f_revision']+1 ,
>>>   ),
>>>   )
>>>
>>>

[web2py] Re: RFC: web2py-based workflow engine

2012-05-01 Thread Cliff
Ross,

I like the on-the-fly ability.

Each step in your template changes the state of the item.  Each one of 
those states should have a title.

There are two other states to account for, new and done.

Workflows sometimes have more than one path to completion.  

I see an entity called a workflow_item that has the ability to determine 
its current state and all possible states to which it could transition.  It 
also knows who can cause it to transition to one of those states as well as 
which of its attributes should be hidden, visible or editable in any given 
state, and who should be able to see or edit those attributes while in that 
state.


On Tuesday, May 1, 2012 12:00:42 PM UTC-4, Ross Peoples wrote:
>
> In reference to: 
> https://groups.google.com/forum/#!searchin/web2py/workflow/web2py/osEmmtu9hlg/2MHi_ZCeMBMJ
>
> Has anyone done any work on this yet? I was thinking about making a 
> web2py-based workflow engine.
>
> I mentioned previously that I built one of these for an application I 
> wrote several years ago, but it was built specifically for that app. This 
> will be my first attempt at making a general-use workflow engine, so let me 
> know if you find any problems with my design:
>
> Make a contrib module that is initialized like the Auth module:
> from gluon.contrib.workflow_engine import WorkflowEngine, Step
> workflow_engine = WorkflowEngine()
> workflow_engine.define_tables()
>
>
> I will use the example that I know best, which is passing around a sales 
> order throughout a company's departments. This first example would define a 
> workflow template because every sales order will have the same workflow:
> workflow_engine.add_template('Sales Order',
> Step(group_id=2, hours=4), # Engineering gets 4 hours to complete 
> their step
> Step(user_id=7, hours=0), # The engineering manager (user) has no 
> time limit
> Step(group_id=3, hours=2), # Quality department gets 2 hours to 
> inspect the order
> Step(group_id=8, hours=6.5), # Shipping department gets 6.5 hours to 
> ship order
> )
>
>
> You would start this workflow like this:
> workflow_id = workflow_engine.load_template('Sales Order', item_type=
> 'document', item_id=1)
> workflow_id = workflow_engine.
> workflow_engine.start(workflow_id)
>
>
> Optionally, a workflow can be created on the fly (if the workflow will 
> only be used once):
> workflow_id = workflow_engine.create_workflow('One-time Workflow', 
> 'document', 1 # same as item_type and item_id used in load_template()
> Step(group_id=2, hours=4)
> Step(group_id=3, due_date=request.now + datetime.timedelta(days=1)) # 
> set time limit to an exact datetime
> )
>
> workflow_engine.start(workflow_id) # start the workflow we just created
>
>
> We assume that we are going to associate this workflow with another 
> object. In this case, we will assume there is a table called "document" and 
> that the document we want to pass around has an id of 1. The "item_type" 
> argument allows you to pass around any type of database object. In this 
> case, we will call it the same thing as our table: "document".
>
> These are some common operations that could be done:
> workflow_engine.active_workflows() # returns a list of all active 
> workflows
> workflow_engine.active_workflows(user_id=1) # all active workflows for 
> the user_id
> workflow_engine.active_workflows(user_id=1, include_groups=True) # same 
> as above, but includes groups the user is a member of
> workflow_engine.active_workflows(group_id=2) # all active workflows for 
> the group_id
> workflow_engine.late_workflows() # returns a list of all late/overdue 
> workflows
> workflow_engine.step_complete(workflow_id, notes='General info about 
> completed task') # moves workflow to the next step
> workflow_engine.step_reject(workflow_id, to_step=2, notes='Why step was 
> rejected') # moves workflow back to step 2 incase there was a problem 
> with one of the previously completed steps
>
>
> Workflow triggers:
> workflow_engine.before_start = function(workflow, step)
> workflow_engine.after_start = function(workflow, step)
> workflow_engine.before_step_complete = function(workflow, step)
> workflow_engine.after_step_complete = function(workflow, step)
> workflow_engine.before_step_reject = function(workflow, step)
> workflow_engine.after_step_reject = function(workflow, step)
> workflow_engine.before_finish = function(workflow, step)
> workflow_engine.after_finish = function(workflow, step)
>
>
> Finally, (and I MIGHT do this) since we are using time limits in hours, we 
> should set some time ranges where users are available. For example, if the 
> company is only open from 8 AM to 5 PM, you wouldn't want something to be 
> late at 7 PM. You would want to roll over the extra 2 hours so that it 
> becomes late at 10 AM the next business day. A list of time ranges would be 
> created, and a user would be assigned to one of the time ranges. This would 
> accommodate users in different time zones or with di

[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread Anthony

>
> I had entered the carrier.url as "www.bing.com/search?q=" instead of "
> http://www.bing.com/search?q=";.
>

Yes, without the "http://";, the browser will still see it as a relative URL 
and add it to the current domain. Instead of storing http:// with the URL, 
you could also do:

_href='http://' + row.carrier.url + value

Anthony


Re: [web2py] Re: Icons in button on .grid and .smartgrid

2012-05-01 Thread Jim Steil
Not a problem for me at all.  I just thought I'd separate it in case I 
didn't have the most recent from trunk.


I haven't tested against the latest trunk.  My version is from last 
week, 2012-04-24 08:39:47.


-Jim

On 5/1/2012 2:29 PM, Massimo Di Pierro wrote:

Does this work for trunk? How about including it in web2py.css?

On Tuesday, 1 May 2012 11:50:19 UTC-5, Jim S wrote:

Ok, I created the attached file (based on what used to be in
base.css) and added the following line in my layout.html.

  response.files.append(URL('static','css/css3buttons.css'))

It is again working.

-Jim

On 5/1/2012 11:36 AM, Massimo Di Pierro wrote:

I probably broke it as a I moved to bootstrap.

On Tuesday, 1 May 2012 10:32:52 UTC-5, Jim S wrote:

Hi

In a prior version of web2py (probably within the last 6-8
months) there
were icons included on the default buttons use on the grid.
 The edit
button had a little pencil and the delete had a trash can,
etc.  I just
started a new app this week, and now they aren't there.
 Seems to me
like there used to be a base.css in the views directory and
that has
been replaced with web2py.css.  But, the icon sprite (I think
that's
what they are called) mappings are all gone.

Can someone confirm this or tell me that I'm going about
something
incorrectly?

 -Jim




[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread Anthony

>
> The proposal does not work as is. It looks like there is 
> no request.vars._formname.
>

How are you entering data into the table? If you are using SQLFORM, there 
should always be a hidden _formname field in the form. 
 

> P.S. : There is a small typo : request.vars._formname.startswith(...
>

Oops. 

However, with strong inspiration of your solution I made some additonal 
> tests and found a compute function that perfectly works :
>
> compute=lambda row: db.t_templates(request.vars.id).f_revision + 1 if (
> request.vars.id and db.t_templates(request.vars.id).f_revision) else 1,
>
>
That should generally work, though I would change it to

if (request.vars.id and db.t_templates(request.vars.id))

Otherwise you'll get an error if the query returns None and you then try to 
access the "f_revision" attribute of None. I had originally considered that 
simpler approach. The only danger is if for some reason a different form 
submission with request.vars.id comes in, and during that request you 
happen to insert or update the t_templates table as well -- in that case, 
the value inserted into f_revision will likely be based on the wrong 
record. I added a check for the _formname to ensure the submitted form is 
specifically for the t_templates table.

Anthony

 

> Super thanks Anthony. I'll use this solution as I prefer to have it on the 
> DAL.
>
> Le mardi 1 mai 2012 15:48:06 UTC+2, Anthony a écrit :
>>
>> I think the row object submitted to the compute function only includes 
>> the fields that are part of the update, so it won't include 
>> row['f_revision']. Instead, you could get the record id from request.vars 
>> and use that to query the current value of the f_revision field:
>>
>> db.define_table('t_templates', Field('name'),
>> Field('f_template', 'upload', label=T('File'), notnull=True),
>> Field('f_revision', 'integer', label=T('Revision'),
>> compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if 
>> (request.vars.id and
>> request.vars._formname and request.vars_formname.startswith(
>> 't_templates')) else 1))
>>
>> Anthony
>>
>> On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>>>
>>> Hi,
>>>
>>> Here is exactly what I would like to have, but it does not compute on 
>>> update :
>>>
>>> db.define_table('t_templates',
>>>   Field('f_template', type='upload', label=T('File'),notnull=True), 
>>>
>>> 
>>>   Field('f_revision', type='integer', label=T('Revision'),
>>>   default=1,
>>>   compute=lambda row: row['f_revision']+1 ,
>>>   ),
>>>   )
>>>
>>>

[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Hi Anthony,

The proposal does not work as is. It looks like there is 
no request.vars._formname.
P.S. : There is a small typo : request.vars._formname.startswith(...

However, with strong inspiration of your solution I made some additonal 
tests and found a compute function that perfectly works :

compute=lambda row: db.t_templates(request.vars.id).f_revision + 1 if (
request.vars.id and db.t_templates(request.vars.id).f_revision) else 1,

Super thanks Anthony. I'll use this solution as I prefer to have it on the 
DAL.

Le mardi 1 mai 2012 15:48:06 UTC+2, Anthony a écrit :
>
> I think the row object submitted to the compute function only includes the 
> fields that are part of the update, so it won't include row['f_revision']. 
> Instead, you could get the record id from request.vars and use that to 
> query the current value of the f_revision field:
>
> db.define_table('t_templates', Field('name'),
> Field('f_template', 'upload', label=T('File'), notnull=True),
> Field('f_revision', 'integer', label=T('Revision'),
> compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if 
> (request.vars.id and
> request.vars._formname and request.vars_formname.startswith(
> 't_templates')) else 1))
>
> Anthony
>
> On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>>
>> Hi,
>>
>> Here is exactly what I would like to have, but it does not compute on 
>> update :
>>
>> db.define_table('t_templates',
>>   Field('f_template', type='upload', label=T('File'),notnull=True),  
>>   
>> 
>>   Field('f_revision', type='integer', label=T('Revision'),
>>   default=1,
>>   compute=lambda row: row['f_revision']+1 ,
>>   ),
>>   )
>>
>>

[web2py] Re: web2py resources

2012-05-01 Thread Massimo Di Pierro
Web2py cheatsheet

http://dl.dropbox.com/u/18065445/Tmp/web2py_cheatsheet.pdf

>

Re: [web2py] Re: Icons in button on .grid and .smartgrid

2012-05-01 Thread Massimo Di Pierro
Does this work for trunk? How about including it in web2py.css?

On Tuesday, 1 May 2012 11:50:19 UTC-5, Jim S wrote:
>
>  Ok, I created the attached file (based on what used to be in base.css) 
> and added the following line in my layout.html.
>
>   response.files.append(URL('static','css/css3buttons.css'))
>
> It is again working.
>
> -Jim
>
> On 5/1/2012 11:36 AM, Massimo Di Pierro wrote: 
>
> I probably broke it as a I moved to bootstrap.
>
> On Tuesday, 1 May 2012 10:32:52 UTC-5, Jim S wrote: 
>>
>> Hi 
>>
>> In a prior version of web2py (probably within the last 6-8 months) there 
>> were icons included on the default buttons use on the grid.  The edit 
>> button had a little pencil and the delete had a trash can, etc.  I just 
>> started a new app this week, and now they aren't there.  Seems to me 
>> like there used to be a base.css in the views directory and that has 
>> been replaced with web2py.css.  But, the icon sprite (I think that's 
>> what they are called) mappings are all gone. 
>>
>> Can someone confirm this or tell me that I'm going about something 
>> incorrectly? 
>>
>>  -Jim 
>>
>>
>>   

[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-05-01 Thread Gour
On Tue, 1 May 2012 12:06:03 -0700 (PDT)
"Julio F. Schwarzbeck" 
wrote:

> Not really suggesting anything in particular, just another tool and
> "proof" that we can eat our own dog food, simple as that.

OK.

I'm just concerned to be left without my preferred medium for posting.

> Now ability to "post" from within a newsreader/nntp that is an
> interesting thought..

Check: http://forum.dlang.org/ which uses forum software (written in D)
which is connected to D-related newsgroups so both web/mailing_list/news
users can have their own way. ;)


Sincerely,
Gour

-- 
Those who are on this path are resolute in purpose, 
and their aim is one. O beloved child of the Kurus, 
the intelligence of those who are irresolute is many-branched.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: quick SQL question

2012-05-01 Thread Larry Wapnitsky
Let me clarify that the substring in particular I'm using is the first 3 
octets of an IP address..

On Tuesday, May 1, 2012 3:19:27 PM UTC-4, Larry Wapnitsky wrote:
>
> In a test (non-web2py) program, I'm using a MySQL query that 
> invokes SELECT SUBSTRING_INDEX.  What is the easiest way to convert this to 
> the proper usage within web2py's DAL specifications?
>
> Thanks,
> Larry
>


[web2py] quick SQL question

2012-05-01 Thread Larry Wapnitsky
In a test (non-web2py) program, I'm using a MySQL query that invokes SELECT 
SUBSTRING_INDEX.  What is the easiest way to convert this to the proper 
usage within web2py's DAL specifications?

Thanks,
Larry


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-05-01 Thread Julio F. Schwarzbeck
Not really suggesting anything in particular, just another tool and "proof" 
that we can eat our own dog food, simple as that.

Also, perhaps we are talking about different things, QA Stack is as it name 
implies, a Questions and Answers application, not a forum system, it has 
Q&A specific "tools" (upvoting, downvoting, automatic permissions 
escalation, administration, etc.).

Now ability to "post" from within a newsreader/nntp that is an interesting 
thought..

Thanks,

On Tuesday, May 1, 2012 11:50:49 AM UTC-7, Gour wrote:
>
> On Tue, 1 May 2012 10:42:03 -0700 (PDT) 
> "Julio F. Schwarzbeck" ...> 
> wrote: 
>
> > http://www.qa-stack.com/ 100% web2py, 100% open source. 
>
> It says "Welcome to QA-Stack.com - QA-Stack is a Q&A open source web 
> application..." so I wonder whether you suggest to move from mailing 
> list which is e.g. available as nntp group via Gmane and to which I can 
> post (just doing it) using my preferred mailer to web forum? 
>
>
> Sincerely, 
> Gour 
>
> -- 
> As a lamp in a windless place does not waver, so the transcendentalist, 
> whose mind is controlled, remains always steady in his meditation on 
> the transcendent self. 
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 
>


[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread zounds
Didn't even realize that.  I made a lot of changes to that line trying to 
get it to work.  I started off with:

A(value, _href=db.shipper(row.shipper).url + value)),


Which I got from 
http://stackoverflow.com/questions/10389775/how-can-i-make-sqltable-results-link-to-outside-pages.
  
But was being told, "AttributeError: 'NoneType' object has no attribute 
'url' ".

So messing around with the syntax I ended up with what you see above.  
Interestingly, it worked, i.e. didn't produce an error, but did produce the 
issue above.  I changed the href code as you suggested, and was still 
getting the link problem.  I had entered the carrier.url as 
"www.bing.com/search?q=" instead of "http://www.bing.com/search?q=";.  Now, 
having made both changes, it works like a charm! 

Thank You!




[web2py] Re: Copying Date From Sqlite to a Mysql database

2012-05-01 Thread nick name
On Tuesday, May 1, 2012 3:11:19 AM UTC-4, Hassan Alnatour wrote:
>
> How Can i copy all the records and tables in my sqlite database to a mysql 
> database ?
>

Web2py comes with a tool called "cpdb" (under scripts/) that does exactly 
that, and more. run with "--help" to get complete explanation.


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-05-01 Thread Gour
On Tue, 1 May 2012 10:42:03 -0700 (PDT)
"Julio F. Schwarzbeck" 
wrote:

> http://www.qa-stack.com/ 100% web2py, 100% open source.

It says "Welcome to QA-Stack.com - QA-Stack is a Q&A open source web
application..." so I wonder whether you suggest to move from mailing
list which is e.g. available as nntp group via Gmane and to which I can
post (just doing it) using my preferred mailer to web forum?


Sincerely,
Gour

-- 
As a lamp in a windless place does not waver, so the transcendentalist, 
whose mind is controlled, remains always steady in his meditation on
the transcendent self.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: How to intervene in web2py's upload process(store/retrieve/stream...) to do something with uploaded file?

2012-05-01 Thread Wikus van de Merwe
I think you need to customize the functions for storing/retrieving the 
uploaded file.

In you model add:
Field("myfile", "upload", custom_store=store_myfile, 
custom_retrieve=retrieve_myfile)

Then implement the functions:
def store_myfile(uploaded_file, filename=None, path=None):
  buffer = uploaded_file.read()
  filename = put_to_storage(buffer)
  return filename

def retrieve_myfile(filename, path=None):
buffer = get_from_storage(filename)
return (filename, buffer)


[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread Anthony

>
> db.define_table('shipment',
> Field('shipment_id', represent=lambda value,row: \
> A(value, _href=(row.carrier.url + value, ))),
>

Why is your href a tuple? How about:

A(value, _href=row.carrier.url + value)

That should produce http://www.bing.com/search?q=trumpet as long as 
row.carrier.url is the string "http://www.bing.com/search?q="; (assuming the 
shipment_id value is "trumpet").

Anthony


[web2py] Re: Noob Question. How do I make an external link?

2012-05-01 Thread Alan Etkin
We need to know what code are you using to store the url at the "carrier" 
table. The URL function (in case you are using it) builds relative urls 
with the request data. However, you can customize it forcing an absolute 
url with the host kwarg. See the book for examples www.web2py.com/book or 
the function signature with examples here:

http://www.web2py.com/examples/static/epydoc/web2py.gluon.html-module.html#URL

And as expected, you can always build your own url string and pass it to 
the db record update or insert command.

On Tuesday, May 1, 2012 2:51:29 PM UTC-3, zounds wrote:
>
> I have this in my db.py:
>
> db.define_table('carrier',
> Field('name',),
> Field('url',),
> format='%(name)s')
> 
> db.define_table('shipment',
> Field('shipment_id', represent=lambda value,row: \
> A(value, _href=(row.carrier.url + value, ))),
> Field('carrier', db.carrier))
>
> The shipment_id link is pointing to '
> http://127.0.0.1:8000/tracker/default/www.bing.com/search?q=trumpet'.  
> How can I make it just 'www.bing.com/search?q=trumpet'.
>
>

[web2py] Noob Question. How do I make an external link?

2012-05-01 Thread zounds
I have this in my db.py:

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

db.define_table('shipment',
Field('shipment_id', represent=lambda value,row: \
A(value, _href=(row.carrier.url + value, ))),
Field('carrier', db.carrier))

The shipment_id link is pointing to 
'http://127.0.0.1:8000/tracker/default/www.bing.com/search?q=trumpet'.  How 
can I make it just 'www.bing.com/search?q=trumpet'.



[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-05-01 Thread Julio F. Schwarzbeck
http://www.qa-stack.com/ 100% web2py, 100% open source.

Also here's the documentation:

https://docs.google.com/document/d/18WpX6BYgv1MD3IeClLsvNNR1AerMFOC2W0tQJ84EmGg/edit?authkey=CNDZjA0

It still needs some work (more ajax, mobile UI and switch registration/user 
control possibly to a plug in), but it is 100% useable now, cheers.

JulioS

On Tuesday, April 24, 2012 12:58:27 PM UTC-7, Yarin wrote:
>
> +1 for StackOverflow/StackExchange- Forget the latest google groups 
> iteration, StackOverflow is just the best proven system for software QA by 
> miles, and it bothers me that the best web framework out there still hasn't 
> taken the plunge and embraced it. Every time I have a web2py question I'm 
> forced to weigh the benefits of posting on SO, where I know I'll get an 
> answer within 10 minutes, vs posting in this forum where I'll wait a few 
> hours to get an answer from Massimo/Anthony. Those guys are heros but not 
> superhuman- We need to grow up as a community and offload support to each 
> other. Forget dogfooding, let's just use the best tools for the job. Single 
> biggest hinderance to web2py's growth IMO.
>
> On Saturday, April 21, 2012 12:24:32 PM UTC-4, JoeCodeswell wrote:
>>
>> This new look that Google Groups has implemented is seriously 
>> debilitating for a borderline dyslexic like me. 
>>
>> Also the AJAX panel sizing is not working on my Chrome/WinXP system. 
>>
>> Could this be a sign that web2py needs to eat the food it cooks and 
>> implement its own web2py-users forum?
>>
>> PS When i tried to submit this post with a tag of "meta", Google Groups 
>> told me "only suggested tags can be used". I chose "ajax" from "ajax, 
>> sessions, cache, internationalization". I think this restriction by Google 
>> Groups might be another reason to be web2py based.
>>
>> Thanks for any responses.
>>
>> Love and peace,
>>
>> Joe
>>
>
> On Saturday, April 21, 2012 12:24:32 PM UTC-4, JoeCodeswell wrote:
>>
>> This new look that Google Groups has implemented is seriously 
>> debilitating for a borderline dyslexic like me. 
>>
>> Also the AJAX panel sizing is not working on my Chrome/WinXP system. 
>>
>> Could this be a sign that web2py needs to eat the food it cooks and 
>> implement its own web2py-users forum?
>>
>> PS When i tried to submit this post with a tag of "meta", Google Groups 
>> told me "only suggested tags can be used". I chose "ajax" from "ajax, 
>> sessions, cache, internationalization". I think this restriction by Google 
>> Groups might be another reason to be web2py based.
>>
>> Thanks for any responses.
>>
>> Love and peace,
>>
>> Joe
>>
>
> On Saturday, April 21, 2012 12:24:32 PM UTC-4, JoeCodeswell wrote:
>>
>> This new look that Google Groups has implemented is seriously 
>> debilitating for a borderline dyslexic like me. 
>>
>> Also the AJAX panel sizing is not working on my Chrome/WinXP system. 
>>
>> Could this be a sign that web2py needs to eat the food it cooks and 
>> implement its own web2py-users forum?
>>
>> PS When i tried to submit this post with a tag of "meta", Google Groups 
>> told me "only suggested tags can be used". I chose "ajax" from "ajax, 
>> sessions, cache, internationalization". I think this restriction by Google 
>> Groups might be another reason to be web2py based.
>>
>> Thanks for any responses.
>>
>> Love and peace,
>>
>> Joe
>>
>

[web2py] Re: Escaping objects, and a book error...

2012-05-01 Thread Anthony

>
> I am looking how to escape particular items in html and want to know what 
> is actually being escaped.  Is there a list on this page somewhere to show 
> me this?  Is it somewhere else?
>

Escaping is done via the Python cgi.escape function (which converts "&", 
"<", and ">" -- see http://docs.python.org/library/cgi.html#functions), 
plus additional escaping of single quotes. See 
http://code.google.com/p/web2py/source/browse/gluon/html.py#122.
 

> Also, what do I do to define other things I wouldn't want the user writing?
>

I think the usual escaping should be safe, but it doesn't allow any HTML 
markup -- only text. If you want to allow some HTML but still try to keep 
it safe, you could do XML(potentially_unsafe_text, sanitize=True, 
permitted_tags=..., allowed_attributes=...) (see 
http://web2py.com/books/default/chapter/29/5#XML).

Anthony


[web2py] update images computed field .. again

2012-05-01 Thread CtrlSoft
hi i have a resize function wich creates image thumbanils...
def THUMB(image, nx=120, ny=120):
from PIL import Image 
import os  
try:
img = Image.open(request.folder + 'static/img_folder/' + image)
img.thumbnail((nx,ny), Image.ANTIALIAS) 
root,ext = os.path.splitext(image)
thumb='%s_thumb%s' %(root, ext)
img.save(request.folder + 'static/img_folder/' + thumb)
return thumb
except: 
return None  
 
and this :
db.define_table("news",
Field('image', 'upload', requires=IS_EMPTY_OR(IS_IMAGE()), 
uploadfolder=request.folder+'static/img_folder', autodelete=True), 
Field('image_thumb', 'upload', compute=lambda r: 
THUMB(r['image']), uploadfolder=request.folder+'static/img_folder', 
autodelete=True), 
Field("title",label=T('Title'),requires=IS_NOT_EMPTY()),
Field("content" 
,type='text',label=T('Content'),requires=IS_NOT_EMPTY()))

on row edit  when i change row image or delete only image big image is 
deleted/replaced but image_thumb stil remains on disk , could you give me 
any suggestions?


Re: [web2py] Re: sqlite int field that behave as string ?

2012-05-01 Thread Sebastian E. Ovide
I don't know how sqllite works... but using sqlbrowser (found it in the
standard ubuntu repo) I could see that the field was String so I could
change it to Number... (and match what declared in web2py)

if sqlbrowser can do that, I guess that also web2py could do that too
It is not a big deal tough...

On Mon, Apr 30, 2012 at 3:48 PM, Anthony  wrote:

> note: probably (I don't remember) it was String at some point...
>>
>
> That could be the problem if it's SQLite -- see
> http://web2py.com/books/default/chapter/29/6#Fixing-broken-migrations.
>
> Anthony
>



-- 
Sebastian E. Ovide


Re: [web2py] Re: Icons in button on .grid and .smartgrid

2012-05-01 Thread Jim Steil
Ok, I created the attached file (based on what used to be in base.css) 
and added the following line in my layout.html.


  response.files.append(URL('static','css/css3buttons.css'))

It is again working.

-Jim

On 5/1/2012 11:36 AM, Massimo Di Pierro wrote:

I probably broke it as a I moved to bootstrap.

On Tuesday, 1 May 2012 10:32:52 UTC-5, Jim S wrote:

Hi

In a prior version of web2py (probably within the last 6-8 months)
there
were icons included on the default buttons use on the grid.  The edit
button had a little pencil and the delete had a trash can, etc.  I
just
started a new app this week, and now they aren't there.  Seems to me
like there used to be a base.css in the views directory and that has
been replaced with web2py.css.  But, the icon sprite (I think that's
what they are called) mappings are all gone.

Can someone confirm this or tell me that I'm going about something
incorrectly?

 -Jim


a.button, button { display: inline-block; padding: 5px; font-family: 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 12px; color: #3C3C3D; text-shadow: 1px 1px 0 #FF; background: #ECECEC url('../images/css3buttons_backgrounds.png') 0 0 no-repeat; white-space: nowrap; overflow: visible; cursor: pointer; text-decoration: none; border: 1px solid #CACACA; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; outline: none; position: relative; zoom: 1; line-height: 1.11; *display: inline; *vertical-align: middle; }
button { margin-left: 0; margin-right: 0; *padding: 5px 5px 3px 5px; }
a.button { -moz-user-select: none; -webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-user-select: none; -webkit-touch-callout: none;}
button::-moz-focus-inner { border: 0; padding:0px; }
a.button.primary, button.primary { font-weight: bold }
/*button:focus,a.button:hover, 
button:hover { border-color: #388AD4; text-decoration: none; text-shadow: -1px -1px 0 rgba(0,0,0,0.3); background-position: 0 -40px;  }*/
/*a.button:active, button:active,
a.button.active, button.active { background-position: 0 -81px; border-color: #347BBA; background-color: #0F5EA2; color: #FF; text-shadow: none; }
a.button:active, button:active { top: 1px }*/
a.button.negative:hover, button.negative:hover { color: #FF; background-position: 0 -121px; background-color: #D84743; border-color: #911D1B; }
a.button.negative:active, button.negative:active,
a.button.negative.active, button.negative.active { background-position: 0 -161px; background-color: #A5211E; border-color: #911D1B; }
a.button.positive:hover, button.positive:hover { background-position: 0 -280px; background-color: #96ED89; border-color: #45BF55; }
a.button.positive:active, button.positive:active,
a.button.positive.active, button.positive.active { background-position: 0 -320px; background-color: #45BF55; }
a.button.pill, button.pill { -webkit-border-radius: 19px; -moz-border-radius: 19px; border-radius: 19px; padding: 5px 10px 4px 10px; *padding: 4px 10px; }
a.button.left, button.left { -webkit-border-bottom-right-radius: 0px; -webkit-border-top-right-radius: 0px; -moz-border-radius-bottomright: 0px; -moz-border-radius-topright: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; margin-right: 0px; border-right: none; }
a.button.middle, button.middle { margin-right: 0px; margin-left: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px; border-right: none; }
a.button.right, button.right { -webkit-border-bottom-left-radius: 0px; -webkit-border-top-left-radius: 0px; -moz-border-radius-bottomleft: 0px; -moz-border-radius-topleft: 0px; border-top-left-radius: 0px; border-bottom-left-radius: 0px; margin-left: 0px; }
a.button.left:active, button.left:active,
a.button.middle:active, button.middle:active,
a.button.right:active, button.right:active { top: 0px }
a.button.big, button.big { font-size: 16px; padding-left: 14px; padding-right: 17px; }
button.big { *padding: 4px 17px 2px 17px; }
a.button span.icon, button span.icon { display: inline-block; width: 14px; height: 12px; margin: auto 7px auto auto; position: relative; top: 0; *top: 0px; background-image: url('../images/css3buttons_icons.png'); background-repeat: no-repeat; }
a.big.button span.icon, button.big span.icon { top: 0px }
a.button span.icon.book, button span.icon.book { background-position: 0 0 }
/*a.button:hover span.icon.book, button:hover span.icon.book { background-position: 0 -15px }*/
a.button span.icon.calendar, button span.icon.calendar { background-position: 0 -30px }
/*a.button:hover span.icon.calendar, button:hover span.icon.calendar { background-position: 0 -45px }*/
a.button span.icon.chat, button span.icon.chat { background-position: 0 -60px }
/*a.button:hover span.icon.chat, button:hover span.icon.chat { background-position: 0 -75px }*/
a.button span.icon.check, button span.icon.check { background-position: 0 -90px }
/*a.button:hover span.icon.check, button:hover span.icon.che

[web2py] Escaping objects, and a book error...

2012-05-01 Thread encompass
http://web2py.com/books/default/chapter/29/3?search=escape
And search for markdown2 and you get a broken link.
With that outtadaway. :)
I am looking how to escape particular items in html and want to know what 
is actually being escaped.  Is there a list on this page somewhere to show 
me this?  Is it somewhere else?
Also, what do I do to define other things I wouldn't want the user writing?
...
BR,
Jason Brower


[web2py] Re: Icons in button on .grid and .smartgrid

2012-05-01 Thread Massimo Di Pierro
I probably broke it as a I moved to bootstrap.

On Tuesday, 1 May 2012 10:32:52 UTC-5, Jim S wrote:
>
> Hi 
>
> In a prior version of web2py (probably within the last 6-8 months) there 
> were icons included on the default buttons use on the grid.  The edit 
> button had a little pencil and the delete had a trash can, etc.  I just 
> started a new app this week, and now they aren't there.  Seems to me 
> like there used to be a base.css in the views directory and that has 
> been replaced with web2py.css.  But, the icon sprite (I think that's 
> what they are called) mappings are all gone. 
>
> Can someone confirm this or tell me that I'm going about something 
> incorrectly? 
>
>  -Jim 
>
>
>

[web2py] Re: Amazon EC2 discussion: pros/cons, etc.

2012-05-01 Thread pbreit
The AMI list that Amazon maintains is pretty reliable:
https://aws.amazon.com/amis?platform=Cent+OS&selection=platform

If you are still evaluating cloud providers, Rackspace is a bit more 
straightforward, can be cheaper and formally supplies a CentOS 6.0 image.


Re: [web2py] Re: How would I do something like this?

2012-05-01 Thread Bruce Wade
Works like a charm thanks.

On Tue, May 1, 2012 at 7:08 AM, Bruce Wade  wrote:

> Ok thanks will try using it today.
>
>
> On Tue, May 1, 2012 at 7:01 AM, Anthony  wrote:
>
>> Yes, use the lambda form -- that way it will only do the has_membership
>> queries when the index function is called rather than on every request to
>> the controller.
>>
>> Anthony
>>
>>
>> On Tuesday, May 1, 2012 12:50:47 AM UTC-4, Annet wrote:
>>>
>>> Hi Bruce,
>>>
>>> I had the same problem, this is the best solution, according to Anthony (
>>> https://groups.google.com/**forum/#!msg/web2py/**
>>> A0z8DSZdYTo/H_1N6_4MZfEJ
>>> ):
>>>
>>> @auth.requires(lambda: auth.has_membership('**Analytics') or
>>> auth.has_membership('Analytics Manager))
>>>
>>> I made the groups constants, in my case:
>>>
>>> NODE='Node Manager'
>>> HUB='Hub Manager'
>>>
>>>
>>> Best regards,
>>>
>>> Annet
>>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] RFC: web2py-based workflow engine

2012-05-01 Thread Ross Peoples
In reference 
to: 
https://groups.google.com/forum/#!searchin/web2py/workflow/web2py/osEmmtu9hlg/2MHi_ZCeMBMJ

Has anyone done any work on this yet? I was thinking about making a 
web2py-based workflow engine.

I mentioned previously that I built one of these for an application I wrote 
several years ago, but it was built specifically for that app. This will be 
my first attempt at making a general-use workflow engine, so let me know if 
you find any problems with my design:

Make a contrib module that is initialized like the Auth module:
from gluon.contrib.workflow_engine import WorkflowEngine, Step
workflow_engine = WorkflowEngine()
workflow_engine.define_tables()


I will use the example that I know best, which is passing around a sales 
order throughout a company's departments. This first example would define a 
workflow template because every sales order will have the same workflow:
workflow_engine.add_template('Sales Order',
Step(group_id=2, hours=4), # Engineering gets 4 hours to complete their 
step
Step(user_id=7, hours=0), # The engineering manager (user) has no time 
limit
Step(group_id=3, hours=2), # Quality department gets 2 hours to inspect 
the order
Step(group_id=8, hours=6.5), # Shipping department gets 6.5 hours to 
ship order
)


You would start this workflow like this:
workflow_id = workflow_engine.load_template('Sales Order', item_type=
'document', item_id=1)
workflow_id = workflow_engine.
workflow_engine.start(workflow_id)


Optionally, a workflow can be created on the fly (if the workflow will only 
be used once):
workflow_id = workflow_engine.create_workflow('One-time Workflow', 
'document', 1 # same as item_type and item_id used in load_template()
Step(group_id=2, hours=4)
Step(group_id=3, due_date=request.now + datetime.timedelta(days=1)) # 
set time limit to an exact datetime
)

workflow_engine.start(workflow_id) # start the workflow we just created


We assume that we are going to associate this workflow with another object. 
In this case, we will assume there is a table called "document" and that 
the document we want to pass around has an id of 1. The "item_type" 
argument allows you to pass around any type of database object. In this 
case, we will call it the same thing as our table: "document".

These are some common operations that could be done:
workflow_engine.active_workflows() # returns a list of all active workflows
workflow_engine.active_workflows(user_id=1) # all active workflows for the 
user_id
workflow_engine.active_workflows(user_id=1, include_groups=True) # same as 
above, but includes groups the user is a member of
workflow_engine.active_workflows(group_id=2) # all active workflows for the 
group_id
workflow_engine.late_workflows() # returns a list of all late/overdue 
workflows
workflow_engine.step_complete(workflow_id, notes='General info about 
completed task') # moves workflow to the next step
workflow_engine.step_reject(workflow_id, to_step=2, notes='Why step was 
rejected') # moves workflow back to step 2 incase there was a problem with 
one of the previously completed steps


Workflow triggers:
workflow_engine.before_start = function(workflow, step)
workflow_engine.after_start = function(workflow, step)
workflow_engine.before_step_complete = function(workflow, step)
workflow_engine.after_step_complete = function(workflow, step)
workflow_engine.before_step_reject = function(workflow, step)
workflow_engine.after_step_reject = function(workflow, step)
workflow_engine.before_finish = function(workflow, step)
workflow_engine.after_finish = function(workflow, step)


Finally, (and I MIGHT do this) since we are using time limits in hours, we 
should set some time ranges where users are available. For example, if the 
company is only open from 8 AM to 5 PM, you wouldn't want something to be 
late at 7 PM. You would want to roll over the extra 2 hours so that it 
becomes late at 10 AM the next business day. A list of time ranges would be 
created, and a user would be assigned to one of the time ranges. This would 
accommodate users in different time zones or with different "work" hours. 
Again, this last part I MIGHT do if I have enough time. I've done it 
before, but I'm sure you can imagine how complicated this part is.


So any questions, comments, improvements? Thanks!


Re: [web2py] MSSQL bit does not evaluate to True for boolean datatype

2012-05-01 Thread David Rager
For MSSQL the bit is stored.  With MySQL the evaluations work correctly - 
with MSSQL they do not so wondering if there is an infra issue. 

I have tried both mssql and mssql2 - I was under the impression that mssql2 
would stor the char T and F however that is not the case.

On Tuesday, May 1, 2012 7:26:41 AM UTC-6, Johann Spies wrote:
>
>
>
> On 1 May 2012 10:33, David Rager  wrote:
>
>> All - 
>> Am starting a large-scale project to monitor solar plants using web2py 
>> and python as the main app layer.
>>
>> I am also using mssql so I can take advantage of the column storage 
>> indexing as we are logging a large amount of data.
>>
>> The issue I am facing is that MSSQL boolean datatypes (which translate to 
>> a bit in the DB) are not evaluating to True or False when retrieved from 
>> the DB.
>>
>> The table itself will show a bit value of 1 or 0 however any boolean test 
>> will fail.
>>
>> At this point I am going to have to define a string value and evaluate 
>> the value as str("True") or False which seems like a poor workaround.  Has 
>> anyone else seen this issue or found a resolution?
>>
>> I have tried 2 configurations:
>> 1. Red Hat Enterprise 6 with pyodbc and the Microsoft driver installed (a 
>> pain as you have to hack it to work with Web2py)
>> and 
>> 2. Windows Server 2008 R2 with pyodbc, python utils and the Windows SDK 
>> comand "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe" 
>> -inputresource:c:\
>> windows\syswow64\python27.dll;#2 
>> -outputresource:C:\Python27\Lib\site-packages\p
>> yodbc.pyd;#2
>>
>> Both setups were somewhat painful but result in an operating web2py 
>> setup.  If the setup itself is incorrect would love feedback.
>>
>> Appreciate any help - this is an important project, green, high-profile, 
>> and large-scale but hinges on the ability to run MSSQL.
>>
>>
>
> Are you aware of the fact that the boolean datatype in Web2py translates 
> to 'T' or 'F' (Char[1])  in the backend datatype? 
>
> Example:
>
>  Field("sadc", "boolean", default = False),  
>
> in DAL translates into 
>
>  sadc character(1),  
>
> in Postgresql.
>
> See https://groups.google.com/forum/?fromgroups#!topic/web2py/qwFYJb6k7bQfor 
> one of the discussions about it.
>
>
>
> Regards
> Johann 
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

[web2py] Icons in button on .grid and .smartgrid

2012-05-01 Thread Jim Steil

Hi

In a prior version of web2py (probably within the last 6-8 months) there 
were icons included on the default buttons use on the grid.  The edit 
button had a little pencil and the delete had a trash can, etc.  I just 
started a new app this week, and now they aren't there.  Seems to me 
like there used to be a base.css in the views directory and that has 
been replaced with web2py.css.  But, the icon sprite (I think that's 
what they are called) mappings are all gone.


Can someone confirm this or tell me that I'm going about something 
incorrectly?


-Jim




Re: [web2py] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Thanks Khalil,

I did a try but it did not work, in fact the form.vars.t_revision does not 
exists.
1. Could it be because I'm using SQLFORM.grid ?
2. I was aware that we can paste a list to onvalidation, but never a dict 
( onvalidation={'onsuccess':mycustom} ), is this in the docs ?

I would have prefered to do it in the DAL, but anyway, I tried in the 
controller, and here is a possible solution. This is definitely not simple, 
but it works :
@auth.requires_login() 
   
def manage_templates(): 
  
def increment_rev_number(form): 
  
print('Enter increment_rev_number : form.vars = %s' % 
(str(form.vars)))   
print( db(db.t_templates.id==form.vars.id).select().first() )   
  
db(db.t_templates.id==form.vars.id).update( 
  
f_revision = 
(db(db.t_templates.id==10).select().first()['f_revision'] or 0) + 1 
 
)   
  
db.commit() 
  

  
form = SQLFORM.grid(   
   
db.t_templates, 
  
fields=[   
   
db.t_templates.f_name, 
   
db.t_templates.f_template, 
   
db.t_templates.f_revision, 
   
db.t_templates.f_revdate,   
  
], 
   
csv=False, 
   
details=False, 
   
onvalidation=auth.archive, 
   
onupdate=increment_rev_number, 
   
)   
  
return locals()

I just noticed the solution provided by Anthony, I'll also give it a try. 
Thanks Anthony.




Re: [web2py] Re: Copying Date From Sqlite to a Mysql database

2012-05-01 Thread Anthony
On Tuesday, May 1, 2012 10:02:51 AM UTC-4, Hassan Alnatour wrote:
>
> Can you tell me some more about it how do i use it ?? and i want to use 
> web2py and would this take all the recordes and stuff in the database ?
>

It should copy everything. You have to define all the db tables in web2py, 
though, so web2py knows all the tables and fields it is exporting and 
importing. So, after all the table definitions, run the export command. 
Then on a separate request, run the import command. Or you could put the 
export and import commands in a script and run via the command line.

Anthony


Re: [web2py] Re: Reloading modules

2012-05-01 Thread Yarin
@Massimo- Thank you, I understand the practice but still not the 
prescription. By turning the app on/off you mean disable/enable? Don't all 
apps live in the same site-wide Python process, and wouldn't that mean that 
the global objects would remain?

On Tuesday, May 1, 2012 9:40:00 AM UTC-4, Massimo Di Pierro wrote:
>
> Models and controllers are executed at every request therefore it is safe 
> to change them while the app is running. Web2py handles them the way it 
> does to allow you how replacement.
>
> Python modules - in general - should not be replaced without turning the 
> app off and on again.
> It really depends on the module and this is not a web2py specific issue. A 
> module may define a global object and if you reload the module you end up 
> with two of those objects. Depending on how it is used this may have 
> unintended consequences. The fact that you technically can force python to 
> reload a module does not mean that is  good practice in general. 
>
>
>
>
> On Tuesday, 1 May 2012 08:18:45 UTC-5, Yarin wrote:
>>
>> @Massimo- you're saying a production application should not reload 
>> modules, but then what is the correct process for updating an app in 
>> production - i.e. installing an app by overwriting an old one - if it has 
>> modules that have changed?
>>
>> On Sunday, April 29, 2012 12:02:52 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Let's clarify something
>>>
>>> web2py always uses the most comment models/controllers/views.
>>> web2py (as Python does) loads modules onces and keeps them in memory, 
>>> even when modules are shipped with the app.
>>> The fact that 
>>>
>>> from gluon.custom_import import track_changes; track_changes(True)
>>>
>>> overrides this behavior if a feature to be used in development, not in 
>>> production.
>>>
>>> Reloading modules is a bad idea. It has performance penalties and can 
>>> cause undesired effects because of global objects defined in the modules.
>>> A production application should not do this. 
>>>
>>>
>>>
>>> On Sunday, 29 April 2012 08:34:26 UTC-5, Yarin wrote:

 Got to say this is scary- we're about to go into production with our 
 first web2py app, and having erratic module behavior persist across server 
 restarts is not something we signed up for. Please let's address this.

 On Sunday, April 29, 2012 9:12:55 AM UTC-4, Yarin wrote:
>
> @Bruno- Thanks for confirming this issue
> @Anthony - Thoughts?
>
>
>>

Re: [web2py] Re: How would I do something like this?

2012-05-01 Thread Bruce Wade
Ok thanks will try using it today.

On Tue, May 1, 2012 at 7:01 AM, Anthony  wrote:

> Yes, use the lambda form -- that way it will only do the has_membership
> queries when the index function is called rather than on every request to
> the controller.
>
> Anthony
>
>
> On Tuesday, May 1, 2012 12:50:47 AM UTC-4, Annet wrote:
>>
>> Hi Bruce,
>>
>> I had the same problem, this is the best solution, according to Anthony (
>> https://groups.google.com/**forum/#!msg/web2py/**A0z8DSZdYTo/H_1N6_4MZfEJ
>> ):
>>
>> @auth.requires(lambda: auth.has_membership('**Analytics') or
>> auth.has_membership('Analytics Manager))
>>
>> I made the groups constants, in my case:
>>
>> NODE='Node Manager'
>> HUB='Hub Manager'
>>
>>
>> Best regards,
>>
>> Annet
>>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: Copying Date From Sqlite to a Mysql database

2012-05-01 Thread hasan alnator
Can you tell me some more about it how do i use it ?? and i want to use
web2py and would this take all the recordes and stuff in the database ?


[web2py] Re: How would I do something like this?

2012-05-01 Thread Anthony
Yes, use the lambda form -- that way it will only do the has_membership 
queries when the index function is called rather than on every request to 
the controller.

Anthony

On Tuesday, May 1, 2012 12:50:47 AM UTC-4, Annet wrote:
>
> Hi Bruce,
>
> I had the same problem, this is the best solution, according to Anthony (
> https://groups.google.com/forum/#!msg/web2py/A0z8DSZdYTo/H_1N6_4MZfEJ):
>
> @auth.requires(lambda: auth.has_membership('Analytics') or 
> auth.has_membership('Analytics Manager))
>
> I made the groups constants, in my case:
>
> NODE='Node Manager'
> HUB='Hub Manager'
>
>
> Best regards,
>
> Annet
>


[web2py] Re: Copying Date From Sqlite to a Mysql database

2012-05-01 Thread Anthony
If you want to use web2py, you can also do this: 
http://web2py.com/books/default/chapter/29/6#CSV-(all-tables-at-once)

Anthony

On Tuesday, May 1, 2012 3:17:20 AM UTC-4, kokoyo wrote:
>
> hi, try this:  
> http://www.maxkpage.com/blog/free-sqlite-to-mysql-converter-super-easy/ 
>
> On Tuesday, May 1, 2012 4:11:19 PM UTC+9, Hassan Alnatour wrote:
>>
>> Dear ALL, 
>>
>> How Can i copy all the records and tables in my sqlite database to a 
>> mysql database ?
>>
>> regards,
>>
>

[web2py] Re: redirect('http://www.web2py.com')

2012-05-01 Thread Anthony
Can you post the full code that reproduces the problem?

On Tuesday, May 1, 2012 3:08:18 AM UTC-4, Hassan Alnatour wrote:
>
> No am not using ajax  ,  i used a javascript redirect now , but why the 
> python redirect is not working and when i use it , it keeps my domain and 
> adds the url that i want to redirect to it



[web2py] Re: Amazon EC2 discussion: pros/cons, etc.

2012-05-01 Thread Richard Galka
Community AMI's are present for FreeBSD. Apparently at least a few are 
identified as windows systems, while others are identifed as (Linux Other). 
A quick search gives: http://www.daemonology.net/freebsd-on-ec2/ which 
identifies several different AMI's. (Also searching for FreeBSD on 
community AMI's provides a list). I don't remember which one was used, but 
none the less, I never used it in any real environment (and hence trusted 
the image).

On Monday, April 30, 2012 11:11:14 AM UTC-5, lucas wrote:
>
> wow, really, so did you actually install freebsd on your EC2 harddisk 
> slice because i don't see freebsd under the amazon EC2 operating systems. 
>  i do see redhat enterprise 6, which is probably very very similar to 
> centos 6.  and with that freebsd install, did you install and use a 
> relational database system like postgres?
>
> On Monday, April 30, 2012 10:24:24 AM UTC-4, Richard Galka wrote:
>>
>> I had a setup for a while with freebsd, web2py (and corresponding 
>> dependencies). There was very little difference on setup between amazone 
>> ec2 and the bare metal machines I previously set everything up on. Just 
>> remember, by default no guaranteed static IP...
>
>

[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread Anthony
I think the row object submitted to the compute function only includes the 
fields that are part of the update, so it won't include row['f_revision']. 
Instead, you could get the record id from request.vars and use that to 
query the current value of the f_revision field:

db.define_table('t_templates', Field('name'),
Field('f_template', 'upload', label=T('File'), notnull=True),
Field('f_revision', 'integer', label=T('Revision'),
compute=lambda: db.t_templates(request.vars.id).f_revision + 1 if (
request.vars.id and
request.vars._formname and request.vars_formname.startswith(
't_templates')) else 1))

Anthony

On Tuesday, May 1, 2012 7:31:43 AM UTC-4, François Delpierre wrote:
>
> Hi,
>
> Here is exactly what I would like to have, but it does not compute on 
> update :
>
> db.define_table('t_templates',
>   Field('f_template', type='upload', label=T('File'),notnull=True),   
> 
>   
>   Field('f_revision', type='integer', label=T('Revision'),
>   default=1,
>   compute=lambda row: row['f_revision']+1 ,
>   ),
>   )
>
>

Re: [web2py] How to compute Field on update based on previous value.

2012-05-01 Thread Khalil KHAMLICHI
there is a typo :  form = SQLFORM( t_templates, record)  should be  form =
SQLFORM( db.t_templates, record)

On Tue, May 1, 2012 at 12:13 PM, Khalil KHAMLICHI <
khamlichi.kha...@gmail.com> wrote:

> this might not be the perfect solution but it might let you move on
>
> models :
> db.define_table('t_templates',
>   Field('f_template', type='upload', label=T('File'),notnull=True),
>
>
>   Field('f_revision', type='integer', label=T('Revision'),
>   default=1,
>  * writable=False, #hide it on the form*
>   ),
>   )
>
> Controller:
> def edit():
>   ID = request.vars.id
>   record = db(db.t_templates.Id == ID).select()[0]
>   form = SQLFORM( t_templates, record)
>   def mycustom(form):
>form.vars.t_revision = int(form.vars.t_revision) + 1
>   # we call our function upon validation
>   if form.process(onvalidation={'onsuccess':mycustom}).accepted:
>pass
>   return dict(form=form)
>
> On Tue,
> May 1, 2012 at 11:31 AM, François Delpierre 
> wrote:
>
>> Hi,
>>
>> Here is exactly what I would like to have, but it does not compute on
>> update :
>>
>> db.define_table('t_templates',
>>   Field('f_template', type='upload', label=T('File'),notnull=True),
>>
>>   Field('f_revision', type='integer', label=T('Revision'),
>>   default=1,
>>   compute=lambda row: row['f_revision']+1 ,
>>   ),
>>   )
>>
>>
>


Re: [web2py] Re: Reloading modules

2012-05-01 Thread Massimo Di Pierro
Models and controllers are executed at every request therefore it is safe 
to change them while the app is running. Web2py handles them the way it 
does to allow you how replacement.

Python modules - in general - should not be replaced without turning the 
app off and on again.
It really depends on the module and this is not a web2py specific issue. A 
module may define a global object and if you reload the module you end up 
with two of those objects. Depending on how it is used this may have 
unintended consequences. The fact that you technically can force python to 
reload a module does not mean that is  good practice in general. 




On Tuesday, 1 May 2012 08:18:45 UTC-5, Yarin wrote:
>
> @Massimo- you're saying a production application should not reload 
> modules, but then what is the correct process for updating an app in 
> production - i.e. installing an app by overwriting an old one - if it has 
> modules that have changed?
>
> On Sunday, April 29, 2012 12:02:52 PM UTC-4, Massimo Di Pierro wrote:
>>
>> Let's clarify something
>>
>> web2py always uses the most comment models/controllers/views.
>> web2py (as Python does) loads modules onces and keeps them in memory, 
>> even when modules are shipped with the app.
>> The fact that 
>>
>> from gluon.custom_import import track_changes; track_changes(True)
>>
>> overrides this behavior if a feature to be used in development, not in 
>> production.
>>
>> Reloading modules is a bad idea. It has performance penalties and can 
>> cause undesired effects because of global objects defined in the modules.
>> A production application should not do this. 
>>
>>
>>
>> On Sunday, 29 April 2012 08:34:26 UTC-5, Yarin wrote:
>>>
>>> Got to say this is scary- we're about to go into production with our 
>>> first web2py app, and having erratic module behavior persist across server 
>>> restarts is not something we signed up for. Please let's address this.
>>>
>>> On Sunday, April 29, 2012 9:12:55 AM UTC-4, Yarin wrote:

 @Bruno- Thanks for confirming this issue
 @Anthony - Thoughts?


>

Re: [web2py] Re: Strange import problem

2012-05-01 Thread Bruce Wade
I will look closer at the code another programmer on my team wrote it.
However when moving the methods from the imported module to the controller
and using them doesn't get an error.

On Tue, May 1, 2012 at 6:31 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> One known problem with the custom import is that if there is a bug in the
> imported module, you always get an Importerror instead of the proper
> more-descriptive error. In you case I do not see what the error may be but
> any typo could be causing this.
>
>
> On Monday, 30 April 2012 23:06:51 UTC-5, Bruce Wade wrote:
>>
>>
>> applications/advertisement/**modules/util.py
>> from gluon import *
>>
>> def make_page_breadcrumbs(page_**breadcrumbs_items):
>> page_breadcrumbs_items_buffer = [ DIV(SPAN("",
>> _class="breadcrumbs-arrow"),**SPAN(crumb)) for crumb in
>> page_breadcrumbs_items ]
>> return DIV(page_breadcrumbs_items_**buffer)
>>
>> def make_page_title(page_title, icon):
>> return SPAN(IMG(_src=icon), H6(page_title))
>>
>> class pageIcon:
>> UNION = "/advertisement/static/images/**union_icon_55x55.png"
>>
>> controllers/union.py
>> def index():
>> from util import make_page_title
>> ...
>>
>> Error:
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/home/bruce/Development/**bossteam_dev/projects/yaw_dev/**gluon/restricted.py",
>>  line 205, in restricted
>>
>> exec ccode in environment
>>
>>   File 
>> "/home/bruce/Development/**bossteam_dev/projects/yaw_dev/**applications/advertisement/**controllers/union.py"
>>  , line 
>> 346, in 
>>
>>   File 
>> "/home/bruce/Development/**bossteam_dev/projects/yaw_dev/**gluon/globals.py",
>>  line 173, in 
>>
>> self._caller = lambda f: f()
>>
>>   File 
>> "/home/bruce/Development/**bossteam_dev/projects/yaw_dev/**gluon/tools.py", 
>> line 2575, in f
>>
>> return action(*a, **b)
>>
>>   File 
>> "/home/bruce/Development/**bossteam_dev/projects/yaw_dev/**applications/advertisement/**controllers/union.py"
>>  , line 
>> 5, in index
>>
>> from util import make_page_title
>>
>> ImportError: cannot import name make_page_title
>>
>> I have no idea why in the world this is happening, any suggestions?
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: Welcome App not working on stable build. gluon.contrib (Module doesn't have attribute: contrib)

2012-05-01 Thread Massimo Di Pierro
How did you install web2py? Did you download and unzip the distribution or 
did you do something else?

On Tuesday, 1 May 2012 05:57:52 UTC-5, Rhys wrote:
>
> Hi All,
>
> I've just installed the latest stable build of the framework and the 
> Welcome app is giving me an internal error. The examples app and admin app 
> work fine, but the welcome app is dead. I've attached the error log spat 
> out. At first I thought it was apache, as I'm doing a virtual host with it, 
> so I used the web2py.py server and achieved the same. I've looked at the 
> error file spat out and all it gives me is that the module doesn't have an 
> attribute contrib. (gluon.contrib).
>
> I'm running a virtualenv --no-site-packages and also I've installed the 
> pysqlite package (this is the only package installed for the virtualenv). 
> Sqlite is woking as I have a python neural network using it 
> for experience data storage, and it working like a dream still.
>
> I would love some insight into the problem. Is it a clean fix, am I 
> missing something? I'm building a large project witih web2py for my PhD and 
> don't really want little hicups like this to bite me latter down the track.
>
> Cheers,
>
> Rhys
>


[web2py] Re: Strange import problem

2012-05-01 Thread Massimo Di Pierro
One known problem with the custom import is that if there is a bug in the 
imported module, you always get an Importerror instead of the proper 
more-descriptive error. In you case I do not see what the error may be but 
any typo could be causing this.

On Monday, 30 April 2012 23:06:51 UTC-5, Bruce Wade wrote:
>
>
> applications/advertisement/modules/util.py
> from gluon import *
>
> def make_page_breadcrumbs(page_breadcrumbs_items):   
> page_breadcrumbs_items_buffer = [ DIV(SPAN("", 
> _class="breadcrumbs-arrow"),SPAN(crumb)) for crumb in 
> page_breadcrumbs_items ]
> return DIV(page_breadcrumbs_items_buffer)
>
> def make_page_title(page_title, icon):
> return SPAN(IMG(_src=icon), H6(page_title))
>
> class pageIcon:
> UNION = "/advertisement/static/images/union_icon_55x55.png"
>
> controllers/union.py
> def index():
> from util import make_page_title
> ...
>
> Error:
>
> Traceback (most recent call last):
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/restricted.py", 
> line 205, in restricted
>
> exec ccode in environment
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/applications/advertisement/controllers/union.py"
>  , line 
> 346, in 
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/globals.py", 
> line 173, in 
>
> self._caller = lambda f: f()
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/tools.py", line 
> 2575, in f
>
> return action(*a, **b)
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/applications/advertisement/controllers/union.py"
>  , line 
> 5, in index
>
> from util import make_page_title
>
> ImportError: cannot import name make_page_title
>
> I have no idea why in the world this is happening, any suggestions?
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

[web2py] Re: Best practices question

2012-05-01 Thread Massimo Di Pierro
Hello Rod,

I do not see a big advantage of one approach over another, with one 
exception. If you plan to package integration with jquery anytime for 
others to use it may be easier to do it as a widget defined in a web2py 
plugin. 

On Monday, 30 April 2012 21:32:27 UTC-5, Rod Watkins wrote:
>
>
> Hello everyone,
>
> I have a question regarding best practices with respect to SQLform and 
> custom widgets.
>
> My forms require custom layouts to achieve look I am after. So far, to 
> accomplish this, I have used SQLform to handle the form processing 
> (brilliant, by the way) and then have done my form layout mostly by hand 
> and then inserting the specific widgets, e.g., {{=form.custom.widget.name}} 
> and so on.
>
> For some of these I am setting id and class names in the controller to 
> make use of my own css styles and jquery plugins.
>
> All works very well. Of course, the cost is that my forms will no longer 
> work quite right with the out-of-the-box web2py layouts. Not a big concern 
> for me as I have designed my own.
>
> Recently I have been studying custom widgets and would like some feedback 
> from those more experienced with web2py, if I may.
>
> Is is better practice to code custom widgets. For example, I really like 
> the anytime jquery plugin. To use it, I have overridden in the controller 
> the css class name and id for the datetime fields in my forms. And then 
> hooked them up to the anytime plugin with a short bit of javascript and 
> custom css classes. 
>
> But is it better to code a custom widget? I noticed in the deposit 
> directory that there was an anytime plugin widget (which I have not taken 
> too close a look at yet). Is it wiser to use a custom widget like that or 
> just proceed as I have? Pros/cons? 
>
> I just don't want to get too far along and discover I ought to have done 
> things differently.
>
> Thanks in advance.
>
> Cheers
> Rod



Re: [web2py] MSSQL bit does not evaluate to True for boolean datatype

2012-05-01 Thread Johann Spies
On 1 May 2012 10:33, David Rager  wrote:

> All -
> Am starting a large-scale project to monitor solar plants using web2py and
> python as the main app layer.
>
> I am also using mssql so I can take advantage of the column storage
> indexing as we are logging a large amount of data.
>
> The issue I am facing is that MSSQL boolean datatypes (which translate to
> a bit in the DB) are not evaluating to True or False when retrieved from
> the DB.
>
> The table itself will show a bit value of 1 or 0 however any boolean test
> will fail.
>
> At this point I am going to have to define a string value and evaluate the
> value as str("True") or False which seems like a poor workaround.  Has
> anyone else seen this issue or found a resolution?
>
> I have tried 2 configurations:
> 1. Red Hat Enterprise 6 with pyodbc and the Microsoft driver installed (a
> pain as you have to hack it to work with Web2py)
> and
> 2. Windows Server 2008 R2 with pyodbc, python utils and the Windows SDK
> comand "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe"
> -inputresource:c:\
> windows\syswow64\python27.dll;#2
> -outputresource:C:\Python27\Lib\site-packages\p
> yodbc.pyd;#2
>
> Both setups were somewhat painful but result in an operating web2py
> setup.  If the setup itself is incorrect would love feedback.
>
> Appreciate any help - this is an important project, green, high-profile,
> and large-scale but hinges on the ability to run MSSQL.
>
>

Are you aware of the fact that the boolean datatype in Web2py translates to
'T' or 'F' (Char[1])  in the backend datatype?

Example:

 Field("sadc", "boolean", default = False),

in DAL translates into

 sadc character(1),

in Postgresql.

See https://groups.google.com/forum/?fromgroups#!topic/web2py/qwFYJb6k7bQfor
one of the discussions about it.



Regards
Johann



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] SQLFORM.grid edit form

2012-05-01 Thread Jim Steil

I see a couple ways to handle it.

1. Using a custom view, wrap the button html with an if statement 
testing to see if request.args(1) == 'edit'.  If so, then you are in the 
edit form for the grid.
2. Specify a custom view based on request.args(1) == 'edit' and then 
code the entire thing using custom forms -->  
http://web2py.com/books/default/chapter/29/7#Custom-forms.  Put your 
buttons anywhere you like then.


I have code similar to this in a few of my controller methods:

if request.args(1) in ['new']:
response.view = 'applications/railUnloading.html'
form = grid.create_form
if request.args(1) in ['edit']:
response.view = 'applications/railUnloading.html'
form = grid.update_form

I then pass 'form' to the view and can use it as you would in the book 
example above.


-Jim

On 5/1/2012 12:42 AM, Keith Edmunds wrote:

I have a SQLFORM.grid, and I want to add a button to the form used to edit
records (as called from the grid). Is that possible?


Re: [web2py] Re: Reloading modules

2012-05-01 Thread Yarin
@Massimo- you're saying a production application should not reload modules, 
but then what is the correct process for updating an app in production - 
i.e. installing an app by overwriting an old one - if it has modules that 
have changed?

On Sunday, April 29, 2012 12:02:52 PM UTC-4, Massimo Di Pierro wrote:
>
> Let's clarify something
>
> web2py always uses the most comment models/controllers/views.
> web2py (as Python does) loads modules onces and keeps them in memory, even 
> when modules are shipped with the app.
> The fact that 
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> overrides this behavior if a feature to be used in development, not in 
> production.
>
> Reloading modules is a bad idea. It has performance penalties and can 
> cause undesired effects because of global objects defined in the modules.
> A production application should not do this. 
>
>
>
> On Sunday, 29 April 2012 08:34:26 UTC-5, Yarin wrote:
>>
>> Got to say this is scary- we're about to go into production with our 
>> first web2py app, and having erratic module behavior persist across server 
>> restarts is not something we signed up for. Please let's address this.
>>
>> On Sunday, April 29, 2012 9:12:55 AM UTC-4, Yarin wrote:
>>>
>>> @Bruno- Thanks for confirming this issue
>>> @Anthony - Thoughts?
>>>
>>>


Re: [web2py] Re: Reloading modules

2012-05-01 Thread Yarin
@Massimo- you're saying a production application should not reload modules, 
but then what is the correct process for updating an app in production - 
i.e. installing an app by overwriting an old one - if it has modules that 
have changed?

You're saying that an installing an app that overwrites an existing app - 
i.e. updating an app - will not load the new app's modules if the old app 
had modules of the same name? Is this correct? 

On Sunday, April 29, 2012 12:02:52 PM UTC-4, Massimo Di Pierro wrote:
>
> Let's clarify something
>
> web2py always uses the most comment models/controllers/views.
> web2py (as Python does) loads modules onces and keeps them in memory, even 
> when modules are shipped with the app.
> The fact that 
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> overrides this behavior if a feature to be used in development, not in 
> production.
>
> Reloading modules is a bad idea. It has performance penalties and can 
> cause undesired effects because of global objects defined in the modules.
> A production application should not do this. 
>
>
>
> On Sunday, 29 April 2012 08:34:26 UTC-5, Yarin wrote:
>>
>> Got to say this is scary- we're about to go into production with our 
>> first web2py app, and having erratic module behavior persist across server 
>> restarts is not something we signed up for. Please let's address this.
>>
>> On Sunday, April 29, 2012 9:12:55 AM UTC-4, Yarin wrote:
>>>
>>> @Bruno- Thanks for confirming this issue
>>> @Anthony - Thoughts?
>>>
>>>


Re: [web2py] How to compute Field on update based on previous value.

2012-05-01 Thread Khalil KHAMLICHI
this might not be the perfect solution but it might let you move on

models :
db.define_table('t_templates',
  Field('f_template', type='upload', label=T('File'),notnull=True),

  Field('f_revision', type='integer', label=T('Revision'),
  default=1,
 * writable=False, #hide it on the form*
  ),
  )

Controller:
def edit():
  ID = request.vars.id
  record = db(db.t_templates.Id == ID).select()[0]
  form = SQLFORM( t_templates, record)
  def mycustom(form):
   form.vars.t_revision = int(form.vars.t_revision) + 1
  # we call our function upon validation
  if form.process(onvalidation={'onsuccess':mycustom}).accepted:
   pass
  return dict(form=form)

On Tue,
May 1, 2012 at 11:31 AM, François Delpierre wrote:

> Hi,
>
> Here is exactly what I would like to have, but it does not compute on
> update :
>
> db.define_table('t_templates',
>   Field('f_template', type='upload', label=T('File'),notnull=True),
>
>
>   Field('f_revision', type='integer', label=T('Revision'),
>   default=1,
>   compute=lambda row: row['f_revision']+1 ,
>   ),
>   )
>
>


[web2py] Re: unable to deploy web2py application on GAE

2012-05-01 Thread ShriramK
Hello Monika,

Could you tell if it ran successfully after registration as suggested by 
Eric ?

Shriram

On Thursday, April 12, 2012 5:00:47 PM UTC+5:30, Monika Vashistha wrote:
>
>
> I have successfully managed to run my web2py application on dev_appserver. 
> However when I tried to deploy it on GAE using command on terminal : 
>
> python2.5 appcfg.py update ../web2py , it is giving error :
> Error 404: --- begin server output ---
> This application does not exist (app_id=u'friends').
> --- end server output ---
>
> I have edited the app.yaml and set the application id as required.
> Kindly help.
>
>
On Thursday, April 12, 2012 5:00:47 PM UTC+5:30, Monika Vashistha wrote:
>
>
> I have successfully managed to run my web2py application on dev_appserver. 
> However when I tried to deploy it on GAE using command on terminal : 
>
> python2.5 appcfg.py update ../web2py , it is giving error :
> Error 404: --- begin server output ---
> This application does not exist (app_id=u'friends').
> --- end server output ---
>
> I have edited the app.yaml and set the application id as required.
> Kindly help.
>
>

[web2py] MSSQL bit does not evaluate to True for boolean datatype

2012-05-01 Thread David Rager
All - 
Am starting a large-scale project to monitor solar plants using web2py and 
python as the main app layer.

I am also using mssql so I can take advantage of the column storage 
indexing as we are logging a large amount of data.

The issue I am facing is that MSSQL boolean datatypes (which translate to a 
bit in the DB) are not evaluating to True or False when retrieved from the 
DB.

The table itself will show a bit value of 1 or 0 however any boolean test 
will fail.

At this point I am going to have to define a string value and evaluate the 
value as str("True") or False which seems like a poor workaround.  Has 
anyone else seen this issue or found a resolution?

I have tried 2 configurations:
1. Red Hat Enterprise 6 with pyodbc and the Microsoft driver installed (a 
pain as you have to hack it to work with Web2py)
and 
2. Windows Server 2008 R2 with pyodbc, python utils and the Windows SDK 
comand "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe" 
-inputresource:c:\
windows\syswow64\python27.dll;#2 
-outputresource:C:\Python27\Lib\site-packages\p
yodbc.pyd;#2

Both setups were somewhat painful but result in an operating web2py setup.  
If the setup itself is incorrect would love feedback.

Appreciate any help - this is an important project, green, high-profile, 
and large-scale but hinges on the ability to run MSSQL.

Thanks!!






[web2py] Re: How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
I have no error message, but I suspect the row to not be populated with the 
['f_revision'] field.

Le mardi 1 mai 2012 13:31:43 UTC+2, François Delpierre a écrit :
>
> Hi,
>
> Here is exactly what I would like to have, but it does not compute on 
> update :
>
> db.define_table('t_templates',
>   Field('f_template', type='upload', label=T('File'),notnull=True),   
> 
>   
>   Field('f_revision', type='integer', label=T('Revision'),
>   default=1,
>   compute=lambda row: row['f_revision']+1 ,
>   ),
>   )
>
>

[web2py] How to compute Field on update based on previous value.

2012-05-01 Thread François Delpierre
Hi,

Here is exactly what I would like to have, but it does not compute on 
update :

db.define_table('t_templates',
  Field('f_template', type='upload', label=T('File'),notnull=True), 

  Field('f_revision', type='integer', label=T('Revision'),
  default=1,
  compute=lambda row: row['f_revision']+1 ,
  ),
  )



Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-05-01 Thread kokoyo
Exactly, It works like a charm after updated web2py version as you said. 
Amazing 
speed
thank a lot Bruno 
regards.

On Tuesday, May 1, 2012 4:54:28 PM UTC+9, rochacbruno wrote:
>
> Looks like you have an error because of your web2py version.
>
> Movuca requires web2py-trunk, it needs the new user_groups key in auth,
>
>
> On Tue, May 1, 2012 at 2:45 AM, kokoyo  wrote:
>
>> Hi Bruno, thank so much for your movuca
>> i tried this version: rochacbruno-Movuca-ed8c8dc but got error:
>> run : http://localhost:8000/ movuca 
>> /setup/install  
>>  ---> it shows:  bootstrap 
>> run : http://localhost:8000/ movuca 
>> /home/index --> 
>> got error ticket:'Access' object 
>> has no attribute 'user_groups'
>> Function argument list
>>
>> (self=)
>>  Code listing
>>
>>
>> 38.
>> 39.
>> 40.
>> 41.
>> 42.
>> 43.
>>
>> 44.
>> 45.
>> 46.
>> 47.
>>
>> for hook in hooks:
>> self.__getattribute__(hook)()
>>
>>
>> def allowed_content_types(self):
>>
>>
>> if self.db.auth:
>>
>> allowed_types = self.db.auth.user_groups.values()
>>
>> query = (self.db.ContentType.access_control.contains("public"))
>>
>>
>> for content_type in allowed_types:
>> query |= 
>> (self.db.ContentType.access_control.contains(content_type))
>>
>>
>> return self.db(query).select()
>>
>>
>> how to fix this?
>>
>>
>>
>> On Thursday, April 12, 2012 2:15:32 AM UTC+9, rochacbruno wrote:
>>>
>>> have you done it first?
>>>
>>> - http://localhost:8000/appname/**setup/install 
>>> 
>>>
>>> ??
>>>
>>> It is needed to populate the config db
>>>
>>>
>>>
>>> On Wed, Apr 11, 2012 at 2:07 PM, Gour  wrote:
>>>
 On Wed, 11 Apr 2012 13:09:17 -0300
 Bruno Rocha  wrote:

 > Movu.ca is a general purpose CMS with focus on social network
 > features (as likes, shares, users and connections...)

 Tried to install according to:
 https://github.com/**rochacbruno/Movuca#readmebut
  got error ticket:

  'NoneType' object has no attribute
 'uri'

 Traceback (most recent call last):
  File "/home/gour/repos/external/**web2py/gluon/restricted.py", line
 205, in restricted exec ccode in environment
  File
 "/home/gour/repos/external/**web2py/applications/demo/**
 controllers/home.py",
 line 33, in  File
 "/home/gour/repos/external/**web2py/gluon/globals.py", line 175, in
  self._caller = lambda f: f() File
 "/home/gour/repos/external/**web2py/applications/demo/**
 controllers/home.py",
 line 17, in index home = Home(['featured', 'featured_members', 'ads'])
 File "applications/demo/modules/**handlers/base.py", line 30, in 
 __init__
 self.start() File "applications/demo/modules/**handlers/home.py", line
 11, in start self.db = DataBase([User, ContentType, Category, Article,
 Ads]) File "applications/demo/modules/**movuca.py", line 31, in 
 __init__
 DAL.__init__(self, self.config.db.uri, AttributeError: 'NoneType'
 object has no attribute 'uri'


 Sincerely,
 Gour

 --
 O best of the Kuru dynasty, without sacrifice one can never
 live happily on this planet or in this life: what then of the next?

 http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810

>>>
>>>
>>>
>>> -- 
>>>
>>> Bruno Rocha
>>> [http://rochacbruno.com.br]
>>>
>>>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] Re: Strange import problem

2012-05-01 Thread Rakesh Singh
I had a similar issue with another application some time back.
Eventually I found this article and moved my imports around which resolved 
my issue :

http://codingrecipes.com/python-importerror-cannot-import-name-x

Hope that helps you.





On Tuesday, 1 May 2012 06:06:51 UTC+2, Bruce Wade wrote:
>
>
> applications/advertisement/modules/util.py
> from gluon import *
>
> def make_page_breadcrumbs(page_breadcrumbs_items):   
> page_breadcrumbs_items_buffer = [ DIV(SPAN("", 
> _class="breadcrumbs-arrow"),SPAN(crumb)) for crumb in 
> page_breadcrumbs_items ]
> return DIV(page_breadcrumbs_items_buffer)
>
> def make_page_title(page_title, icon):
> return SPAN(IMG(_src=icon), H6(page_title))
>
> class pageIcon:
> UNION = "/advertisement/static/images/union_icon_55x55.png"
>
> controllers/union.py
> def index():
> from util import make_page_title
> ...
>
> Error:
>
> Traceback (most recent call last):
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/restricted.py", 
> line 205, in restricted
>
> exec ccode in environment
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/applications/advertisement/controllers/union.py"
>  , line 
> 346, in 
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/globals.py", 
> line 173, in 
>
> self._caller = lambda f: f()
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/gluon/tools.py", line 
> 2575, in f
>
> return action(*a, **b)
>
>   File 
> "/home/bruce/Development/bossteam_dev/projects/yaw_dev/applications/advertisement/controllers/union.py"
>  , line 
> 5, in index
>
> from util import make_page_title
>
> ImportError: cannot import name make_page_title
>
> I have no idea why in the world this is happening, any suggestions?
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-05-01 Thread Bruno Rocha
Looks like you have an error because of your web2py version.

Movuca requires web2py-trunk, it needs the new user_groups key in auth,


On Tue, May 1, 2012 at 2:45 AM, kokoyo  wrote:

> Hi Bruno, thank so much for your movuca
> i tried this version: rochacbruno-Movuca-ed8c8dc but got error:
> run : http://localhost:8000/ movuca 
> /setup/install
>  ---> it shows:  bootstrap
> run : http://localhost:8000/ movuca 
> /home/index -->
> got error ticket:'Access' object
> has no attribute 'user_groups'
> Function argument list
>
> (self=)
>  Code listing
>
>
> 38.
> 39.
> 40.
> 41.
> 42.
> 43.
>
> 44.
> 45.
> 46.
> 47.
>
>
> for hook in hooks:
> self.__getattribute__(hook)()
>
> def allowed_content_types(self):
>
> if self.db.auth:
> allowed_types = self.db.auth.user_groups.values()
>
> query = (self.db.ContentType.access_control.contains("public"))
>
> for content_type in allowed_types:
> query |= 
> (self.db.ContentType.access_control.contains(content_type))
>
> return self.db(query).select()
>
>
> how to fix this?
>
>
>
> On Thursday, April 12, 2012 2:15:32 AM UTC+9, rochacbruno wrote:
>>
>> have you done it first?
>>
>> - http://localhost:8000/appname/**setup/install 
>> 
>>
>> ??
>>
>> It is needed to populate the config db
>>
>>
>>
>> On Wed, Apr 11, 2012 at 2:07 PM, Gour  wrote:
>>
>>> On Wed, 11 Apr 2012 13:09:17 -0300
>>> Bruno Rocha  wrote:
>>>
>>> > Movu.ca is a general purpose CMS with focus on social network
>>> > features (as likes, shares, users and connections...)
>>>
>>> Tried to install according to:
>>> https://github.com/**rochacbruno/Movuca#readmebut
>>>  got error ticket:
>>>
>>>  'NoneType' object has no attribute
>>> 'uri'
>>>
>>> Traceback (most recent call last):
>>>  File "/home/gour/repos/external/**web2py/gluon/restricted.py", line
>>> 205, in restricted exec ccode in environment
>>>  File
>>> "/home/gour/repos/external/**web2py/applications/demo/**
>>> controllers/home.py",
>>> line 33, in  File
>>> "/home/gour/repos/external/**web2py/gluon/globals.py", line 175, in
>>>  self._caller = lambda f: f() File
>>> "/home/gour/repos/external/**web2py/applications/demo/**
>>> controllers/home.py",
>>> line 17, in index home = Home(['featured', 'featured_members', 'ads'])
>>> File "applications/demo/modules/**handlers/base.py", line 30, in
>>> __init__
>>> self.start() File "applications/demo/modules/**handlers/home.py", line
>>> 11, in start self.db = DataBase([User, ContentType, Category, Article,
>>> Ads]) File "applications/demo/modules/**movuca.py", line 31, in __init__
>>> DAL.__init__(self, self.config.db.uri, AttributeError: 'NoneType'
>>> object has no attribute 'uri'
>>>
>>>
>>> Sincerely,
>>> Gour
>>>
>>> --
>>> O best of the Kuru dynasty, without sacrifice one can never
>>> live happily on this planet or in this life: what then of the next?
>>>
>>> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>>>
>>
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>


-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: redirect('http://www.web2py.com')

2012-05-01 Thread pbreit
That's very strange because redirect() is pretty straightforward. How are 
you POSTing to /members ? What does that FORM POST look like? From an 
internal page or from elsewhere? What is the exact URL that it takes you 
to? Does it always go to the same URL or does it sometimes go to a 
different URL?

[web2py] Best practices question

2012-05-01 Thread Rod Watkins

Hello everyone,

I have a question regarding best practices with respect to SQLform and 
custom widgets.

My forms require custom layouts to achieve look I am after. So far, to 
accomplish this, I have used SQLform to handle the form processing 
(brilliant, by the way) and then have done my form layout mostly by hand 
and then inserting the specific widgets, e.g., {{=form.custom.widget.name}} 
and so on.

For some of these I am setting id and class names in the controller to make 
use of my own css styles and jquery plugins.

All works very well. Of course, the cost is that my forms will no longer 
work quite right with the out-of-the-box web2py layouts. Not a big concern 
for me as I have designed my own.

Recently I have been studying custom widgets and would like some feedback 
from those more experienced with web2py, if I may.

Is is better practice to code custom widgets. For example, I really like 
the anytime jquery plugin. To use it, I have overridden in the controller 
the css class name and id for the datetime fields in my forms. And then 
hooked them up to the anytime plugin with a short bit of javascript and 
custom css classes. 

But is it better to code a custom widget? I noticed in the deposit 
directory that there was an anytime plugin widget (which I have not taken 
too close a look at yet). Is it wiser to use a custom widget like that or 
just proceed as I have? Pros/cons? 

I just don't want to get too far along and discover I ought to have done 
things differently.

Thanks in advance.

Cheers
Rod

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-05-01 Thread kokoyo
Hi Bruno, thank so much for your movuca
i tried this version: rochacbruno-Movuca-ed8c8dc but got error:
run : http://localhost:8000/ movuca 
/setup/install  
 ---> it shows:  bootstrap 
run : http://localhost:8000/ movuca 
/home/index --> 
got error ticket:   'Access' object has 
no attribute 'user_groups'
Function argument list

(self=)
Code listing

38.
39.
40.
41.
42.
43.

44.
45.
46.
47.

for hook in hooks:
self.__getattribute__(hook)()

def allowed_content_types(self):
if self.db.auth:
allowed_types = self.db.auth.user_groups.values()

query = (self.db.ContentType.access_control.contains("public"))
for content_type in allowed_types:
query |= 
(self.db.ContentType.access_control.contains(content_type))
return self.db(query).select()


how to fix this?



On Thursday, April 12, 2012 2:15:32 AM UTC+9, rochacbruno wrote:
>
> have you done it first?
>
> - http://localhost:8000/appname/setup/install
>
> ??
>
> It is needed to populate the config db
>
>
>
> On Wed, Apr 11, 2012 at 2:07 PM, Gour  wrote:
>
>> On Wed, 11 Apr 2012 13:09:17 -0300
>> Bruno Rocha  wrote:
>>
>> > Movu.ca is a general purpose CMS with focus on social network
>> > features (as likes, shares, users and connections...)
>>
>> Tried to install according to:
>> https://github.com/rochacbruno/Movuca#readme but got error ticket:
>>
>>  'NoneType' object has no attribute
>> 'uri'
>>
>> Traceback (most recent call last):
>>  File "/home/gour/repos/external/web2py/gluon/restricted.py", line
>> 205, in restricted exec ccode in environment
>>  File
>> "/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
>> line 33, in  File
>> "/home/gour/repos/external/web2py/gluon/globals.py", line 175, in
>>  self._caller = lambda f: f() File
>> "/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
>> line 17, in index home = Home(['featured', 'featured_members', 'ads'])
>> File "applications/demo/modules/handlers/base.py", line 30, in __init__
>> self.start() File "applications/demo/modules/handlers/home.py", line
>> 11, in start self.db = DataBase([User, ContentType, Category, Article,
>> Ads]) File "applications/demo/modules/movuca.py", line 31, in __init__
>> DAL.__init__(self, self.config.db.uri, AttributeError: 'NoneType'
>> object has no attribute 'uri'
>>
>>
>> Sincerely,
>> Gour
>>
>> --
>> O best of the Kuru dynasty, without sacrifice one can never
>> live happily on this planet or in this life: what then of the next?
>>
>> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>>
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] Re: Copying Date From Sqlite to a Mysql database

2012-05-01 Thread kokoyo
hi, try this:  
http://www.maxkpage.com/blog/free-sqlite-to-mysql-converter-super-easy/ 

On Tuesday, May 1, 2012 4:11:19 PM UTC+9, Hassan Alnatour wrote:
>
> Dear ALL, 
>
> How Can i copy all the records and tables in my sqlite database to a 
> mysql database ?
>
> regards,
>


[web2py] Copying Date From Sqlite to a Mysql database

2012-05-01 Thread Hassan Alnatour
Dear ALL, 

How Can i copy all the records and tables in my sqlite database to a mysql 
database ?

regards,


[web2py] Re: redirect('http://www.web2py.com')

2012-05-01 Thread Hassan Alnatour
No am not using ajax  ,  i used a javascript redirect now , but why the 
python redirect is not working and when i use it , it keeps my domain and 
adds the url that i want to redirect to it