Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-24 Thread Bruno Rocha
Yes it is very nice, I am already using since the beta in http://movu.ca, I
am also developing a boostrap theme for the CMS

-- 

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


Re: [web2py] Re: google code (mercurial) problem

2012-01-24 Thread Bruno Rocha
I am using Git
Em 24/01/2012 12:20, "Ross Peoples"  escreveu:

> Which one are we using as the primary repo now, is it Google Code or
> GitHub?


Re: [web2py] Problem with plugin_PowerFormWizard and Internetexplorer

2012-01-23 Thread Bruno Rocha
t; #send the message
> mail.send(to=[sendtoemail], subject='Anmeldebestätigung - TSV
> Schmiden Leichtatletik - %s' % Veranstaltungsausgewaehlt, message='Hallo %s
> %s,\n\ndie Anmeldung: %s ist eingegangen. \n\nVielen Dank\nTSV Schmiden
> Leichtathletik' %(form.vars.vorname, form.vars.nachname, laufbezeichnung))
>
> response.flash = "Vielen Dank für Ihre Meldung - TSV Schmiden
> Leichtathletik."
>
> elif form.errors:
> form.step_validation() # VERY IMPORTANT FOR VALIDATION
> response.flash = "Bei der Eingabe Ihrer Anmeldung ist ein Fehler
> aufgetreten."
>
> # Enjoy!
> return dict(Erklaerung=Erklaerung ,
> Veranstaltungsausgewaehlt=Veranstaltungsausgewaehlt, form=form)
>
>


-- 

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


Re: [web2py] google code (mercurial) problem

2012-01-23 Thread Bruno Rocha
in google repository just change the branch to pg8000 and you will see last
updates.

On Mon, Jan 23, 2012 at 12:35 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I messed up something with mercurial and the google code repository
> has not been updated since Jan 17. The git repository on github should
> be fine. You will find about 10 tickets marked as closed but the
> "trunk" in googlecode will not show the fix.
>
> Hopefully this will be fixed today.
>
> Apologies.
>
> Massimo




-- 

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


Re: [web2py] Re: web2py.com is down

2012-01-22 Thread Bruno Rocha
I am using Linode for more than one year and Linode is amazing!

http://www.linode.com/?r=3f383df8639c367bfc73419d6c1ebfbd8dc11cf7


-- 

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


Re: [web2py] web2py.com is down

2012-01-22 Thread Bruno Rocha
On Sun, Jan 22, 2012 at 6:15 PM, Anthony  wrote:

> http://www.downforeveryoneorjustme.com/web2py.com:
>
> It's not just you! http://web2py.com looks down from here.
>


Yesterday the site was down for me, it is occurring every day since the
last week.
-- 

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


[web2py] Auth.registration_requires_invitation

2012-01-21 Thread Bruno Rocha
Hi,

I am planning to develop an "registration requires invitation" to my custom
Auth.

auth.settings.registration_requires_invitation = True
auth.messages.invitation = \
'HI, You have been invited to join X, click on the link
http://' + self.db.request.env.http_host + \
self.db.CURL('default', 'user', args=['invite']) + \
'?invitationkey=%(key)s to register'

The flow is:

Registered user goes to /default/user/invite, so the user puts the e-mail
of a friend and auth does:


   1. Store an invitation key in to auth_invitation table
   (user_id_who_invited, invitation_key, invited_id, signature)
   2. Send an email to the invited user with a link to the register page
   with   ?invitationkey=KFDNJFLDKNFJDLNFJDNF&*9340540985
   3. Invited user clicks in the link, auth checks if invitation ID exists,
   so user are redirected to the register page, if sucess invitation_key is
   set to NULL, invited_id is set to the new user id.
   4. The user who invited receives an confirmation email "The user you
   have invited registered!"

Auth will have a function bulk_invitation(list_of_emails) so developers can
use to send mass invitation

Have somebody already implemented this? can share?
what are the chances to include it in Auth?


-- 

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


Re: [web2py] web2py with Plesk Control Panel ?

2012-01-21 Thread Bruno Rocha
Plesk does allow overriding vhost directives and also Plesk has mod python
(verify if it is installed)

So you can try to create or edit a vhost.conf file in the right directory;

*sudo vim /home/www/vhosts/yourdomain.com/conf/vhost.conf*

Then simply add your vhost directives:

*ServerAdmin "y...@yourdomain.com"
> DocumentRoot /var/www/vhosts/yourdomain.com/httpdocs/web2py
> SetHandler python-program
> PythonHandler modpythonhandler
> PythonPath \"['/path/to/web2py/'] + sys.path\"
> PythonOption SCRIPT_NAME /yourappname*
> ...
>

Then you just have to refresh Plesk's config and restart apache:

*/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=
yourdomain.com
/etc/init.d/httpd graceful*




On Sat, Jan 21, 2012 at 8:32 PM, Ben Tammetta  wrote:

> Hello,
>
> I have a VPS running on CentOS that comes with Plesk.  It seems there
> are instructions to setup web2py with apache in the online book, but I
> am afraid making config file changes could mess up the Plesk
> management system.
>
> So can anyone provide any guidance or links to instructions to setup
> web2py to integrate smoothly with the Plesk control panel?
>
> It is great that web2py can be downloaded and running in just a couple
> of minutes.. but we need an easily to deploy solution that plays well
> with 90% of the most common hosting environments hosting providers
> provide.
> Namely Cpanel and Plesk. If this were easier to deploy in such
> environments I think we would see a whole lot more web2py
> deployments.   At least in my world as I could slowly transition
> current and new client websites to a web2py setup.
>
>


-- 

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


Re: [web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Bruno Rocha
Thats what I have in http://movu.ca

def loginbare(self):
username = self.request.vars.email
password = self.request.vars.password
user = auth.login_bare(username, password)
if user:
redirect(URL('person', 'show'))
else:
redirect(URL('home', 'index', args=[username, 'loginerror']))

So I have a form that posts username and password to /loginbare action (it
can be done in ajax)


-- 

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


Re: [web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Bruno Rocha
session.auth.user = auth.login_bare(someusername, somepassword)

On Sat, Jan 21, 2012 at 1:38 PM, Anthony  wrote:

> I haven't tried it, but maybe something along these lines:
>
> def login():
> form = auth.login(next=URL('default', 'login'))
> if not request.post_vars:
> return form.formkey
>
> On the client side, you would make an initial Ajax request to login() when
> setting up your login form/widget -- in that case, login() will return a
> formkey as a string (which it will also store in the session). Upon login,
> send an Ajax post request to login() with the formkey value in a '_formkey'
> field. Once the login is processed, it should redirect back to login(),
> which will then return a new formkey value.
>
> Anthony
>
>
> On Friday, January 20, 2012 8:45:39 AM UTC-5, Phyo Arkar wrote:
>
>> To keep it simple.
>>
>> How can i login (without using form) to web2py Auth  via AJAX?
>>
>> Thanks
>>
>> Phyo.
>>
>>
>> On Fri, Jan 20, 2012 at 7:45 PM, Phyo Arkar  wrote:
>>
>>> hello web2py.
>>>
>>> I am trying to get auth working with qooxdoo , can i know how should i
>>> login using ajax and (ofcoz use session) of webpy?
>>>
>>> Thanks
>>>
>>> Phyo.
>>>
>>
>>


-- 

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


Re: [web2py] PSTV [Paradigm Shift Television] Powered by Inclusion

2012-01-20 Thread Bruno Rocha
looks very nice on mobile! congrats!

On Sat, Jan 21, 2012 at 12:42 AM, Andrew Evans wrote:

> Wondering if this site can be included in the powered by web2py
>
> www.paradigmshift.tv
>
> *cheers
>
> Andrew
>



-- 

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


Re: [web2py] Setting mysql collation in web2py?

2012-01-19 Thread Bruno Rocha
BTW, DAL receives another argument

driver_args = None

You can pass args to the mysql driver


Re: [web2py] Setting mysql collation in web2py?

2012-01-19 Thread Bruno Rocha
may be this argument

db = DAL("mysql://", * db_codec*='UTF-8')


On Thu, Jan 19, 2012 at 6:47 PM, mdorval  wrote:

> Hey,
> I was wondering if there's any way to set the collation of the mysql
> tables created by web2py to utf8_bin. Thanks!
>



-- 

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


Re: [web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Bruno Rocha
So you can use:

results = msdb.execute_sql("SELECT * FROM table.")


-- 

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


Re: [web2py] MSSQL How to access tables which not created by web2py

2012-01-17 Thread Bruno Rocha
You need to map the existent table and set migrate=False, also you will
need to specify which field is the 'id' or primary keys, and for all fields
you need to tell the datatype.

msdb.define_table(
'test',
FIeld('cod', 'id'),
Field('field1', "datatype"),
Field('field2', "datatype"),
migrate=False
   )

look here:
http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-keyed-tables

-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-17 Thread Bruno Rocha
HI,

A lot of people are sending me emails with suggestions and bug reports
(some people who are not familiar with github to fill issues there)

So I created UserVoice account for Movuca

If you have any consideration, suggestion, bug report, idea etc...
http://movuca.uservoice.com

Thank you

-- 

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


Re: [web2py] Re: Python / web2py or.... the learning path?

2012-01-17 Thread Bruno Rocha
Absolutelly YES!

I teach web2py in my course http://cursodepython.com.br  the great part of
audience is beginners also in web and programming, with Python it is very
easy to learn O.O and web2py makes very easy to understand web workflow.

* I am making some tests, may be my course will be recorded in english too.

On Tue, Jan 17, 2012 at 5:46 PM, Anthony  wrote:

> web2py was originally created as a teaching tool -- I think you'll find it
> relatively easy to learn web programming with web2py, especially if you
> have some programming experience. The book (
> http://web2py.com/books/default/chapter/29) is a great learning resource.
> For a general understanding of how things work, check out the Introduction,
> Overview, http://web2py.com/books/default/chapter/29/4#Workflow, and
> http://web2py.com/books/default/chapter/29/4#Dispatching.
>
> Another new (partially complete) learning resource for beginners is
> http://killer-web-development.com/.
>
> Anthony
>
>
> On Tuesday, January 17, 2012 10:38:17 AM UTC-5, Artur wrote:
>>
>> Do you think that someone with basic knowledge of programming (a little
>> theoretical knowledge of languages like python, javascript and c), could
>> have a chance to start learning web programming language using python and
>> web2py framework?
>>
>> I'm not talking about the understanding of language syntax, but more
>> about the programming, mechanisms understanding which explain what is
>> happening behind a website. Are there any good sources of knowledge, which
>> explains all these basic things in a simple way... of course, using python
>> and web2py framework?
>>
>> Many says, that PHP is better choice, because have many sources that
>> explain a beginner programmer all the important mechanisms what is going on
>> behind the website and so on. Also, you can become productive fairly
>> rapidly.
>>
>> What would you say? What is your expiriens?
>>
>


-- 

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


Re: [web2py] Re: I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
After hours hacking Jquery plugin I have a good and working web2py
tag-widget.

http://www.diigo.com/item/image/121xl/3snt

The code is in github

-- 

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


Re: [web2py] Re: I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
Thats working!

http://www.diigo.com/item/image/121xl/vnwt

-- 

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


Re: [web2py] Re: get user id on mobile app after login to web2py

2012-01-16 Thread Bruno Rocha
You can redirect the user after login to a new url and post user ID as args
or vars, so in client side I think you can take it from location. Or you
can set a  with the value and read it with jquery, or the
cookie.

On Tue, Jan 17, 2012 at 2:07 AM, Yuval  wrote:

> This is on the server side, I looked for the better way to get it over
> from the server to the mobile application/ client side.
> I will just set the user id in a cookie and I will pick up from the
> cookie on the mobile application side.
>
> Thanks
> Yuval
>
> On Jan 16, 4:50 pm, Yuval  wrote:
> > I need the web2py user id on an android mobile application.
> >
> > The user will use a web page (WebView) to perform the login (or to
> > register).
> >
> > Once logged in, what is the best suggested way to pass back the user
> > id to the container application (browser)?
> >
> > Thanks,
> > Yuval
>



-- 

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


Re: [web2py] get user id on mobile app after login to web2py

2012-01-16 Thread Bruno Rocha
the user id is in session.auth.user.id once usre logged in.

On Mon, Jan 16, 2012 at 10:50 PM, Yuval  wrote:

> I need the web2py user id on an android mobile application.
>
> The user will use a web page (WebView) to perform the login (or to
> register).
>
> Once logged in, what is the best suggested way to pass back the user
> id to the container application (browser)?
>
> Thanks,
> Yuval
>
>


-- 

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


Re: [web2py] Re: I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
The web2py widget for it is almost done! I just need to solve one issue:

form.errors:



request.vars:



I dont know why, but form is not receiving the same args as request, or
form is not validating its type for a list:string field.

-- 

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


[web2py] Re: I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
I found the resource http://webspirited.com/tagit/?page=tagit just need to
know if it already exists for web2py, so I will not start to develop, else
I will start tomorrow.
-- 

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


[web2py] Re: I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
Something like that http://www.diigo.com/item/image/121xl/oahk would be
great for list widget


-- 

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


Re: [web2py] Welcome app and i18n

2012-01-16 Thread Bruno Rocha
You have to pack your customized welcome and place the welcome.w2p in
web2py/welcome.w2p

On Mon, Jan 16, 2012 at 7:03 PM, Otto Domínguez wrote:

> I have understood that the Welcome app is a template for new apps. I
> changed the About of the Welcome app and when making a new app I get this
> modified About page. But not so with language files. On the Welcome app I
> created a new spanish file for my country (Guatemala) named es-gt.py. It
> does work in that app, but when making a new Simple Application (based on
> Welcome) this file does not get copied to the new app. Am I missing
> something?
>



-- 

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


[web2py] I am looking for an html widget for lists

2012-01-16 Thread Bruno Rocha
Hi,

Some people are little confused with the list widget that we have in
web2py, some enters values separated by comma when it needs to press 

I would like to have an html widget which shows + and - buttons next to
each item, and can watch for ',' so when user press ',' it wraps and
automatically creates a new text box.

Take a look in to this image http://www.diigo.com/item/image/121xl/8cvh

That's the idea, may be somebody already developed something like that?

-- 

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


Re: [web2py] Re: error class proposal

2012-01-16 Thread Bruno Rocha
*include this in the page where you have the form*


jQuery(function(){
jQuery(".error").prev().css({"border":"1px solid red"});
});


*There is a css way for doing this (but not all browsers support css
siblings ~*


.error~input, .error~select, .error~textarea {
border: 1px solid red;
}



On Mon, Jan 16, 2012 at 6:25 PM, David  wrote:

> Sorry for not being clear;
>
> I meant if the field has an error obviously.
>
> After form validation, the ie. input would have an error class
>
> This would be useful for styling the fields with say "red borders"
>
> Alternatively if there is generic way to handle this I would appreciate it.
>
> Thanks.
>
>
>
>
> On 1/16/12 2:26 PM, Massimo Di Pierro wrote:
>
>> Why do you want to add an "error" class to the input? The error class
>> is normally used for inputs. Perhaps I do not understand.
>>
>> On Jan 15, 7:40 pm, David  wrote:
>>
>>> I was thinking about the form validation.
>>>
>>> I thought that it may be useful to include an "error" class on the input
>>> widget when the form is submitted and has invalid data.
>>>
>>> ie.
>>>
>>> from
>>>
>>> 
>>> >> assword">
>>> too
>>> short
>>> 
>>>
>>> to
>>>
>>> 
>>> >> error"type="password"value=""**name="password">
>>> too
>>> short
>>> 
>>>
>>> Notice the error is the class of the input.
>>>
>>> I think this would be very useful and don't think it would break any
>>> backwards compatibility.
>>>
>>> Thanks.
>>>
>>
>


-- 

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


Re: [web2py] Auth with Google Oauth2 - Google Plus, Gmail and other scopes

2012-01-16 Thread Bruno Rocha
yes we can! the difference is only some keys passed to auth and token url,
also the redirect page and the api caller.

I think we can create an api proxy to decide which class to use and have
the google/facebook/linkedin etc mappings in a single file.

I will try and if works I send a patch.

http://zerp.ly/rochacbruno
Em 16/01/2012 09:25, "Michele Comitini" 
escreveu:

> Hi Bruno,
>
> Do you think we can integrate all in one oath20 module?
>
> tnx
>
> mic
>
> 2012/1/16 Bruno Rocha :
> > Hi,
> >
> > I just implemented Google Connect Oauth2 in http://movu.ca/demo
> >
> > If someone interested in the code it is in
> >
> >
> https://github.com/rochacbruno/Movuca/blob/master/modules/oauth20_account_google.py
> > (modified module)
> >
> https://github.com/rochacbruno/Movuca/blob/master/modules/helpers/googleplus.py
> > (modified handler, can go in models or modules)
> >
> https://github.com/rochacbruno/Movuca/blob/master/modules/handlers/person.py#L378
> > (action handler)
> >
> https://github.com/rochacbruno/Movuca/blob/master/controllers/person.py#L95
> > (controller)
> >
> > It is based in the facebook version with some changes, but still needs
> > improvements.
> >
> > To use it you have to create API keys in
> > https://code.google.com/apis/console/ and the other things will be just
> like
> > the facebook version. I guess the twitter version can be implemented in
> the
> > same way.
> >
> > ** im my code I am using Movuca config to get the option values, you just
> > need to replace them with your API keys.
> >
> > I also found an issue in Auth
> > http://code.google.com/p/web2py/issues/detail?id=616
> >
> >
> > --
> >
> > Bruno Rocha
> > [http://rochacbruno.com.br]
> >
>


[web2py] Auth with Google Oauth2 - Google Plus, Gmail and other scopes

2012-01-16 Thread Bruno Rocha
Hi,

I just implemented Google Connect Oauth2 in http://movu.ca/demo

If someone interested in the code it is in

https://github.com/rochacbruno/Movuca/blob/master/modules/oauth20_account_google.py(modified
module)
https://github.com/rochacbruno/Movuca/blob/master/modules/helpers/googleplus.py(modified
handler, can go in models or modules)
https://github.com/rochacbruno/Movuca/blob/master/modules/handlers/person.py#L378(action
handler)
https://github.com/rochacbruno/Movuca/blob/master/controllers/person.py#L95(controller)

It is based in the facebook version with some changes, but still needs
improvements.

To use it you have to create API keys in
https://code.google.com/apis/console/ and the other things will be just
like the facebook version. I guess the twitter version can be implemented
in the same way.

** im my code I am using Movuca config to get the option values, you just
need to replace them with your API keys.

I also found an issue in Auth
http://code.google.com/p/web2py/issues/detail?id=616


-- 

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


Re: [web2py] Re: Executing controller- and function-specific models in web2py shell

2012-01-15 Thread Bruno Rocha
I guess he wants to exec a submodel, not a controller!

On Sun, Jan 15, 2012 at 8:54 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> If you do
>
> execfile('applications/app/controllers/default.py')
>
> you will expose them all. The problem is that they may have logic like
> @auth.requires_login() decorators which may prevent you from calling
> those functions.
>
> If you want to do this better you should define make the controllers
> delegate execution for funcitons in a module and import the module.
>
> Massimo
>
>
> On Jan 15, 3:55 pm, Robert Clark  wrote:
> > If running a web2py shell, how can model files within controller
> > subdirectories be made available in the environment?
> >
> > For example if we have these two model files:
> > myapp/models/db.py
> > myapp/models/acontroller/db_controller.py
> >
> > Then when launching web2py using:
> > $> python web2py.py -S myapp -M
> >
> > Typing 'db.tables' prints tables defined in db.py
> >
> > Is there a way to specify a controller (or function) to execute models
> > for in a web2py shell?
> >
> > Thanks
>



-- 

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


Re: [web2py] Executing controller- and function-specific models in web2py shell

2012-01-15 Thread Bruno Rocha
I guess you can do inside the web2py shell environment.

>>> execfile("applications/myapp/models/acontroller/somefile.py")

Not tested, but should work.

if you are using Ipython, doing

>>> edit path/to/file and then exit saving the file the file is also
executed

On Sun, Jan 15, 2012 at 7:55 PM, Robert Clark wrote:

>
> If running a web2py shell, how can model files within controller
> subdirectories be made available in the environment?
>
> For example if we have these two model files:
> myapp/models/db.py
> myapp/models/acontroller/db_controller.py
>
> Then when launching web2py using:
> $> python web2py.py -S myapp -M
>
> Typing 'db.tables' prints tables defined in db.py
>
> Is there a way to specify a controller (or function) to execute models
> for in a web2py shell?
>
> Thanks
>



-- 

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


Re: [web2py] Screencasts for web2py? where?

2012-01-15 Thread Bruno Rocha
what about this http://www.youtube.com/playlist?list=PL5E2E223FE3777851

I have 36 videos but it is all in portuguese and part of
cursodepython.com.br

I am planning to include english subtitles or record new with my bad
english pronunciation.

BTW it is not all free, I released some free but the most important are
closed to students.

http://zerp.ly/rochacbruno
Em 15/01/2012 12:38, "António Ramos"  escreveu:

> Hello,
> when will we have good quality videos screencasts of web2py?
> Going from beginner to expert?
>
> I ran into a lot of screencasts like peepcode, codeschool. This guys are
> very good,but for RAILS, not for web2py.
>
> When it comes to web2py i only run into Massimo videos.And those are not
> the school of web2py. Only some nice features
>
> This is very litle in my opinion.
>
> With thousands of us in this blog it should have produced more quality
> videos by now like the ones we see in peepcode or codeschool for example
>
> Don´t you think?
>
> Thank you
>
> António
>


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-15 Thread Bruno Rocha
it will get the config values bypassing the cache.

config is in a sqlite db, so it is cached for 300s (the expiration is a
config option and you can change it)

because of that I have the setup/install (which needs a interface)

you can reload the cache with setup/reload


http://zerp.ly/rochacbruno
Em 15/01/2012 12:00, "villas"  escreveu:

> Thanks Bruno,  I am now experimenting with it.
>
> Probably worth mentioning for the benefit of others that changing a line
> in controllers/setup.py was sufficient to get things initially going:
>
> config = Config(autogetconfig=False)
>
> to
>
> config = Config(autogetconfig=True)
>
>
>
>


Re: [web2py] Re: priority of web2py CMS

2012-01-15 Thread Bruno Rocha
content types are "posts" but you can customize the fields it has to store
in db. and customize the new/edit/show views.

you can also include specific methods for each content type

you can specify how a content type will be listed and its privacy options.

the idea is to have content types created by community, so you can install
then

http://www.movu.ca/demo/article/show/1/how-to-create-content-types-in-movuca-cms
 Em 15/01/2012 11:24, "Gour"  escreveu:

> On Sun, 15 Jan 2012 10:47:31 -0200
> Bruno Rocha  wrote:
>
> > Movuca is a social network engine, but it is also a CMS.
>
> OK.
>
> > It is intended to be generic and customizable, you can create themes,
> > contenttypes etc...
>
> This sounds good.
>
> New contentypes are sort of plugins or something else?
>
> > If someone do not want the social features such as, user profiles,
> > likes, dislikes, follows and boards.
>
> Nice.
>
> > With one click in config and some chsnges in the theme it can be
> > disabled and turned to a normal CMS with only blocks, modules,
> > themes, content in various content types, categories etc.
>
> Hmm...I'll put it on my list for evaluation.
>
> > Movuca features (some working, some in roadmap)
> >
> > - multiple content type
> > - WYSIWYG with media gallery
> > - tag and categories
> > - Search
> > - themeable
> > - ajax plugins, blocks and components
> > - various options for comment system (internal, disqus, facebook,
> > intense debate)
> > - facebook and google login
> > - user profiles
> > - user follow/following
> > - user boards
> > - user activities (timeline)
> > - user pictures album
> > - pages and groups
> > - customizable/themeable email system
> > - ads system
> > - RSS for everything
> > - REST API
> > - Android and IOS client
> > - admin panel
> > - more...
> >
> > it is easy to enable/disable some features in movu.ca
>
> Thanks a lot for your input. Looks as the best web2py-based CMS so far.
> ;)
>
>
> Sincerely,
> Gour
>
>
> --
> But those who, out of envy, disregard these teachings and do not
> follow them are to be considered bereft of all knowledge, befooled,
> and ruined in their endeavors for perfection.
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>


Re: [web2py] priority of web2py CMS

2012-01-15 Thread Bruno Rocha
Movuca is a social network engine, but it is also a CMS.

It is intended to be generic and customizable, you can create themes,
contenttypes etc...

If someone do not want the social features such as, user profiles, likes,
dislikes, follows and boards.

With one click in config and some chsnges in the theme it can be disabled
and turned to a normal CMS with only blocks, modules, themes, content in
various content types, categories etc.

I did not work in category system, but I am open for contributions for it.

Movuca features (some working, some in roadmap)

- multiple content type
- WYSIWYG with media gallery
- tag and categories
- Search
- themeable
- ajax plugins, blocks and components
- various options for comment system (internal, disqus, facebook, intense
debate)
- facebook and google login
- user profiles
- user follow/following
- user boards
- user activities (timeline)
- user pictures album
- pages and groups
- customizable/themeable email system
- ads system
- RSS for everything
- REST API
- Android and IOS client
- admin panel
- more...

it is easy to enable/disable some features in movu.ca

I am waiting a pull request if someone want to add or change some feature
also to improve the category system.

http://zerp.ly/rochacbruno
Em 15/01/2012 07:45, "Gour"  escreveu:

> Hello!
>
> In the middle of November Massimo wrote:
>
> "this will be the top priority after web2py 2.0 is released and the
> book 4th edition. By the end of November."
>
> in regard to working on some decent CMS for web2py.
>
> Due to some other engagements, I was not following the group closely,
> but afaict, the book is released, but there is no web2py 2.0.
>
> In the meantime there was InstantPress-2.1 release, but based on my
> experience when reporting some bug, it took quite some time to be fixed
> (~2 months), so I guess that the only developer (there are no forks
> @bitbucket) is probably occupied with other engagements and IP is not
> his main focus and we gave up on it.
>
> Now I also see there is new project Movuca - Social CMS, but our needs
> are more in the category of 'classical' CMS wahtever it means (we've
> already discussed it a lot here).
>
> So, the question remains if the above statement is still relevant and
> there is a desire to work on one complete web2py-powered CMS-framework
> or is it that web2py community is simply more interested for other
> web-related applications?
>
> Nothing wrong with that, just to be sure where to put our present focus.
> (We, anyway, have to fiddle with PHP & Concrete5 at the moment.)
>
>
> btw, what's preventing 2.0 release?
>
> Sincerely,
> Gour
>
>
> --
> One who restrains the senses of action but whose mind dwells on
> sense objects certainly deludes himself and is called a pretender.
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>


Re: [web2py] Re: PCBSD 9 release (freebsd 9) cannot start web2py

2012-01-14 Thread Bruno Rocha
Judging from your error message and our exchange in the comments, I think
the big problem is you might just be missing sqlite3 support for python.

>From your error messages I take it you're running FreeBSD, so you should
install the databases/py-sqlite3 package from ports.

I don't know much about FreeBSD's ports system, but after you install the
py-sqlite3 package, your problem should hopefully be cleared up.

I'm going to assume, from brief reading, you do something like this,
assuming you have the ports tree on your system:

> cd /usr/ports/databases/py-sqlite3
> make && make install
>


--

http://stackoverflow.com/questions/7973660/python-sqlite3-error-in-freebsd-9



On Sun, Jan 15, 2012 at 4:40 AM, Bruce Wade  wrote:

> ** Now I am running python 2.7 **
>
>
> On Sat, Jan 14, 2012 at 10:40 PM, Bruce Wade  wrote:
>
>> Hi,
>>
>> Fresh install of pcbsd 9, just downloaded web2py source version, when
>> running python web2py:
>>
>> please visit:
>> http://127.0.0.1:8000
>> use "kill -SIGTERM 21799" to shutdown the web2py server
>> DEBUG: connect attempt 0, connection error:
>> Traceback (most recent call last):
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 4736, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 1634, in __init__
>> raise RuntimeError, "Unable to import driver"
>> RuntimeError: Unable to import driver
>> DEBUG: connect attempt 1, connection error:
>> Traceback (most recent call last):
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 4736, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 1634, in __init__
>> raise RuntimeError, "Unable to import driver"
>> RuntimeError: Unable to import driver
>> DEBUG: connect attempt 2, connection error:
>> Traceback (most recent call last):
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 4736, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 1634, in __init__
>> raise RuntimeError, "Unable to import driver"
>> RuntimeError: Unable to import driver
>> DEBUG: connect attempt 3, connection error:
>> Traceback (most recent call last):
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 4736, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 1634, in __init__
>> raise RuntimeError, "Unable to import driver"
>> RuntimeError: Unable to import driver
>>
>>
>> DEBUG: connect attempt 4, connection error:
>>
>>
>> Traceback (most recent call last):
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 4736, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File "/usr/home/detectedstealth/Downloads/web2py/gluon/dal.py", line
>> 1634, in __init__
>>     raise RuntimeError, "Unable to import driver"
>> RuntimeError: Unable to import driver
>>
>> Not I am running python 2.7 and the default database is sqlite.
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>



-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-14 Thread Bruno Rocha
I forgot to mention that you can have comments in different ways, Facebook
comments, DIsqus, Intense Debate or Movuca comments.

All configuration is in databases/config_movuca.sqlite  (I am developing an
admin page for that)


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-14 Thread Bruno Rocha
I made several changes to database model, the problem is that SQLITE does
not support ALTER TABLE so you need to delete your tables and let them to
be created again.

You can just delete config* from databases folder, but I has problems with
birthdate column in auth_user, so it is a good idea to start again from the
scratch.

The easiest way is:

*- git clone git://github.com/mdipierro/web2py.git web2py
- cd web2py/applications
- git clone git://github.com/rochacbruno/Movuca.git demo
- cd ..
- python web2py.py -a "yourdesiredpassword"

- Go to brower and:
- http://localhost:8000/demo/setup/install
- then
- http://localhost:8000/demo



*

I implemented Facebook login, Google Connect login, Now users e-mail is
using MailHide API from Recaptcha, User avatar can be taken from facebook,
twitter, gravatar.

I am working on posts via e-mail, privacy options, groups, pages and
notifications, after that I think I will release the beta version.


Re: [web2py] Re: [FYI] DAL IMAPAdapter

2012-01-14 Thread Bruno Rocha
>
> Actually, I did not add any sending mail feature, since it can be
> accomplished with tools.Mail.


Yes, what I need is a simple API to read emails from google, the workflow
should be.

User obtain a key from settings page in movu.ca CMS e.g *x4f567899083*
Now the user can publish posts to CMS by sending an e-mail to movucacms+*
x4f567899083*@gmail.com

I will use DAL with your API to

rows = imapdb(imapdb.INBOX.to.contains("*x4f567899083*")).select()

So I can take the email, parse and process to publish as a post in CMS.

I am going to try it!


-- 

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


Re: [web2py] [FYI] DAL IMAPAdapter

2012-01-14 Thread Bruno Rocha
Nice!

It it in trunk?

I would like to test it for http://movu.ca I am planning having the
possibility for users to publish posts via e-mail messages.

On Sat, Jan 14, 2012 at 10:40 PM, Alan Etkin  wrote:

> I sent an IMAP interface proposal to the issues list. As of now, there
> is a dal module modification available that allows connecting to an
> IMAP (i.e. Gmail) server, auto create tables and query for mailbox
> messages with the web2py query syntax.
>
> It is possible to construct queries using ==, !=, >, <=, belongs,
> contains, ...
>
> This web2py command returns rows that contain a string within the
> subject text
>
> rows = imapdb(imapdb.INBOX.subject.contains("mytext")).select()
>
> I will appreciate your comments.
>



-- 

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


Re: [web2py] contains return no rows of field list:string

2012-01-14 Thread Bruno Rocha
Have you redefined tje field type to list:string or originally created as
list:string?

Can you open your SQLITE using SQLITEMANAGER or other client and see if
values are |learning|other|another|

if you retrieve the Row the column returns a list type?

I tested here and for me its working, looks like you have problems in your
db.

On Sat, Jan 14, 2012 at 8:07 AM, Joseph Jude  wrote:

> I have the below table definition
>
> db.define_table('entries',
> Field('tags', 'list:string',required=True))
>
> and then inserted values. Now I am trying to select using the below
>
> entries = db(db.entries.tags.contains('learning')).select()
>
> It returns no values (though there are rows in db).
>
> db: sqlite; web2py: 1.99.4
>
> Thank you,
> Joseph
>



-- 

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


Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-13 Thread Bruno Rocha
I can help with the plugin, but where is the docs about plugin creation?

http://zerp.ly/rochacbruno
Em 13/01/2012 14:45, "monotasker"  escreveu:

> I had an email exchange over the last couple of days with a developer at
> Jetbrains who works on PyCharm. The bad news is they've chosen not to work
> on web2py integration any time soon. The even worse news (from my
> perspective) is that they seem to have a very negative impression of the
> web2py community, and this was given as one factor in the decision not to
> make web2py a priority. Now, I think the last thing we need is a flame war
> against PyCharm. It sounds like they've had some legitimately bad
> interactions with a few of the people wanting web2py support (I have no
> idea who). So I think this is a moment to be on our best behaviour.
>
> The good news, though, is that the developer encouraged the development of
> a third-party plugin for web2py support. This isn't something I can take on
> alone right now, but is there any interest from others in forming a team to
> work on one?
>


Re: [web2py] Re: URL Helper.

2012-01-12 Thread Bruno Rocha
Or can just create a new helper URLBuilder


-- 

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


Re: [web2py] html5 charting library

2012-01-12 Thread Bruno Rocha
I like to use wijmo charts (but it is not free)

Googlecharts is very easy to use, I created a plugin for google charts ajax
api.

http://zerp.ly/rochacbruno
Em 12/01/2012 11:40, "Kenneth"  escreveu:

> Hello,
>
> has anybody done any comparing of different html5 charting libraries?
>
> Something quite easy to use, good documentation.
>
>
> Kenneth


Re: [web2py] How to perform a function in a template?

2012-01-11 Thread Bruno Rocha
You can import modules, call functions and even define functions in
template,  if the function returns something you want to write to the body
just put a = sign.


On Thu, Jan 12, 2012 at 3:37 AM, thstart  wrote:
 *{{import urllib}}*

>   {{for name_first in names_first:}}
> 
> {{=name_first[0]}}
> 
> {{=*urllib.quote_plus*(name_first[0])}}
> 
> {{=name_first[1]}}
> {{pass}}
>



-- 

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


Re: [web2py] webserver hash collision DoS

2012-01-11 Thread Bruno Rocha
This is akready being discussed in web2py-developers list

On Wed, Jan 11, 2012 at 8:41 PM, G. Clifford Williams <
g...@notadiscussion.com> wrote:

> I haven't seen anyone mention this so I thought I'd bring it up for
> web2py in general and rocket specifically.
>
> http://www.ocert.org/advisories/ocert-2011-003.html
>
> The above URL speaks of an attack that's been well known for a number
> of years and someone has recently gotten around to demonstrating how
> much damage can be caused by exploiting it.
>
> Do we know whether Rocket is vulnerable to this?
>
>
> --G. Clifford Williams
> Your friendly absentee enthusiast..
>



-- 

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


Re: [web2py] Intercept file download

2012-01-11 Thread Bruno Rocha
On Wed, Jan 11, 2012 at 2:23 PM, Bruno Rocha  wrote:

> https://github.com/globocom/thumbor


and

https://github.com/globocom/mugshot


Re: [web2py] Intercept file download

2012-01-11 Thread Bruno Rocha
https://github.com/globocom/thumbor

On Wed, Jan 11, 2012 at 2:16 PM, Angelo Compagnucci <
angelo.compagnu...@gmail.com> wrote:

> Hi guys,
>
> For a web application, I have to implement a sort of responsive design for
> images. There are tons of solution online, but they requires to use some
> sort of javascript and custom html to work (insert special tags or classes
> in code). I don't like the approch because it make the code unmaintenable.
>
> The idea I have in mind is something like this:
>
> 1) On page load, a jquery function calls a controller and communicates
> infos about the device.
> 2) Controller stores those infos in session
> 3) I intercept images download and
> 3a) If there are session infos about device width and is_mobile, I resize
> the image with PIL to the exact width server side and give the new url to
> the response.
> 3b) If there aren't infos (browser doesn't support cookies) and is_mobile,
> I resize the image to an arbitrary small size (ex: 480 px) and give the new
> url to the response.
> 3c) If !is_mobile, I return the normal url
>
> How can I intercept file download also the static ones?
>
> Thank you!
>
> --
> Profile: http://it.linkedin.com/in/compagnucciangelo
>



-- 

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


Re: [web2py] Reminder : Web2py Application Exhibition Version 3.0

2012-01-10 Thread Bruno Rocha
I have an app, but I cant join (because I won latest edition)



On Tue, Jan 10, 2012 at 2:56 PM, NetAdmin  wrote:

>
> Just a reminder : See the "pinned" message at the top of the web2py-
> users list for more details.
>
> Mr.NetAdmin
>



-- 

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


Re: [web2py] Re: plugin badmin

2012-01-10 Thread Bruno Rocha
On Tue, Jan 10, 2012 at 12:39 PM, Ross Peoples wrote:

> What does it do? There's no description, just that it's an "automatic
> admin".


It creates a very nice and clean easy customizable admin from db tables

take a look

http://www.diigo.com/item/image/121xl/vsj5?size=o


-- 

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


Re: [web2py] Re: One to many question

2012-01-10 Thread Bruno Rocha
On Tue, Jan 10, 2012 at 1:16 PM, Ross Peoples wrote:

> Bruno, I've never tried that way before. Will that cause web2py to create
> a new field "account"?


You are right, I am wrong (forget what I said)

This works only for Rows

rows = db(db.table).select()
for row in rows:
row.account = row.account_id
print row.account.first_name


-- 

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


Re: [web2py] Re: One to many question

2012-01-10 Thread Bruno Rocha
may be


db.user.account = db.user.account_id

should work in controllers




-- 

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


[web2py] plugin badmin

2012-01-10 Thread Bruno Rocha
Just found this

https://github.com/elcio/badmin

I am going to test it more, looks very nice!


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-09 Thread Bruno Rocha
I just finished the article

http://movu.ca/demo/article/show/15/how-to-create-content-types-in-movuca-cms

"subscribers should receive an alert e-mail"

I am open for suggestions and also I appreciate code reviews!

-- 

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


Re: [web2py] New select widget plugin available for testing

2012-01-09 Thread Bruno Rocha
Would be very nice to see some screenshots or a live demo!

Thank you for sharing it, I am testing!

On Mon, Jan 9, 2012 at 5:38 PM, monotasker  wrote:

> I've written a new plugin that provides a select widget that can be
> refreshed via ajax, along with a button that opens a dialog to add new
> items to the linked table. When the dialog is closed, the select widget is
> automatically refreshed via ajax and the added item(s) are available as
> selectable options. You can download or clone the file from the github
> repository: https://github.com/monotasker/plugin_ajaxselect
>
> In one sense this is a duplication of the "select_or_add" module that has
> been available on web2py slices. Under the hood, though, they are quite
> different. My ajaxselect plugin does not manipulate the select widget on
> the user side (inserting options via jquery). Instead, I use web2py's built
> in ajax functionality to refresh the widget *from the db*. I think this
> will make for a more robust and versatile plugin.
>
> Please test it out and let me know about (a) bugs and (b) additional
> features you would like to see (more customizability, etc.). My immediate
> plan is to expand the plugin to use the same approach for filtering the
> contents of one select widget based on the value of another.
>
> The plugin is licensed under GPL3, so feel free to adapt and reuse it as
> you like.
>
> Cheers,
>
> Ian
>



-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-09 Thread Bruno Rocha
Hi all,

I am writing a post explaining how datamodels works and how to create your
own content types with just a Python class and a view.

In this post I will show how to transform the Movuca CMS in a social
commerce adding a "Product" content type.

http://movu.ca/demo/article/show/15/how-to-create-content-types-in-movuca-cms

The post is in progress, if you login and click in subscribe you will
receive an e-mail alerting post updates.

Comments are open for you to give me suggestions.

-- 

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


Re: [web2py] web2py wins an InfoWorld 2012 Technology of the Year Award

2012-01-09 Thread Bruno Rocha
great!!!

the website now needs a page to post every award web2py wins!

Congratulations everyone, users and developers!

http://zerp.ly/rochacbruno
Em 09/01/2012 13:48, "Anthony"  escreveu:

>
> http://www.infoworld.com/slideshow/24605/infoworlds-2012-technology-the-year-award-winners-183313#slide23
>
> http://www.infoworld.com/t/application-development/picking-the-top-technologies-in-wild-year-183463
>
> Other winners include Amazon Web Services, Heroku, Node.js, Apple iOS 5,
> iPad 2, and other well-known brands/technologies -- pretty good company.
>
> Anthony
>


[web2py] Python for Android (any takers to run web2py)

2012-01-08 Thread Bruno Rocha
Look this project

https://github.com/kivy/python-for-android

May be someone has time to spend trying to run web2py with this.


-- 

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


Re: [web2py] best way to process date deltas?

2012-01-07 Thread Bruno Rocha
Also:
>>> import datetime as dt
>>> date1 = dt.datetime.strptime('2011-12-31', '%Y-%m-%d')
>>> date2 = dt.datetime.now()
>>> diff = date2 - date1
>>> diff
datetime.timedelta(7, 65912, 169900)
>>> diff.days
7



-- 

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


Re: [web2py] best way to process date deltas?

2012-01-07 Thread Bruno Rocha
>>> from datetime import datetime, timedelta
>>> factor = timedelta(7)
>>> now = datetime.now()
>>> past_week = now - factor
>>> past_week
datetime.datetime(*2011, 12, 31*, 18, 12, 22, 417567)
>>>


On Sat, Jan 7, 2012 at 6:06 PM, Adrian Edwards  wrote:

> Hello,
>
> What's the best way to calculate deltas between 2 dates? For example I
> need to calculate how many days are inbetwen 12/31/2011 and today.
> Then if the delta is a factor of 7 (weekly) do something.
>
> Thanks.
> Adrian




-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-06 Thread Bruno Rocha
Got a domain name! http://movu.ca

-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-06 Thread Bruno Rocha
On Thu, Jan 5, 2012 at 7:07 PM, Alan Etkin  wrote:

> Martin Mulone is also developing Instant Press for web2py, with
> similar features i think.
>

InstantPress is a CMS, I think its goal is to be a CMS just like Joomla,
Drupal or WordPress where some "admin" people have rights to post content
and users can read and comment there.

Movuca is a CMS but its goal is to be all open (or moderated but still
open). I mean, Any registered user can post content, and content can be of
multiple types (Articles, Products, Links, Cook Recipes, Code Recipes etc..)

Movuca will not have some centralized admin area like Instant Press has,
all content will be manageable in-place and privacy/moderate options will
be limitated.

By now It has suport to some content types (Article, Cook Recipe, Code
Recipe and Product) each content type is a Python Class (the data model)
and a web2py custom view, So it is easy for developers to create and
customize more content types.

"Products" in example is a special kind of content type, which when
available starts a new session for the user cart, so it is easy to create a
Social-Commerce. "Cook Recipe" has a different layout ans stars a
"CookBook" and people can add recipes to personal book to print or download
as pdf.

In resume, Instant Press is an organized CMS (just like wordpress). Movuca
is a mess! :)


-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-06 Thread Bruno Rocha
http://labs.blouweb.com/movuca/article/show/11/about-the-name-movuca



-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-06 Thread Bruno Rocha
Originally "Muvuca", is a word of Indian origin, is a mixture of various
grains and seeds with soil, to reforest an area devastated. In portuguese
it also means "a group of people making a mess"

I like the name because I think social network is a mixture of various
content types (just like the indians stuff) and I think it is still a group
of people making an organized mess!

I changes the world a little to Movuca with "o". First because it had no
entry in search engines and domains available, also because it has a pun
with the word "Move" + "You" Mov-U

In 30 days I will start to offer social network as a service, I already
have 3 clients to use this and I am developing some things according their
needs.

On Thu, Jan 5, 2012 at 11:23 AM, Martín Mulone wrote:

> nice bruno, what does it mean movuca?
>
>
> 2012/1/5 Bruno Rocha 
>
>> On Thu, Jan 5, 2012 at 9:27 AM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> Looks really slick
>>
>>
>>
>> This is the "basic" theme, I am working on two more themes. One based in
>> Foundation and another in twitter bootstrap. It is all modular so its easy
>> to create new themes.
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>
>
>
> --
>  http://martin.tecnodoc.com.ar
>
>


-- 

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


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-06 Thread Bruno Rocha
this is a work in progress.

10% are done, have a lot of missing views and I am geting suggestions to
improve the next functionalities.

thanks for testing it!

http://zerp.ly/rochacbruno
Em 06/01/2012 06:31, "Vineet"  escreveu:

> Hi Bruno,
> Nice work.
> I registered to movuca.
> Some links are erroneous (invalid function (person/favorites)).
> e.g.  'My Recipe Book', 'New Page', 'My Favorites', etc.
>
> Clicking on 'My Drafts' issues this ticket---
>
> Ticket issued: movuca/
> 117.200.216.21.2012-01-06.06-28-15.6dd97c85-2fbe-4253-95a3-73dd5c138de1
>
> -- Vineet
>
> On Jan 6, 2:07 am, Alan Etkin  wrote:
> > The WYSIWYG editor works smooth, altough i didn't used all of its
> > functions. I also like the multi-tab upload facility. It all looks
> > really good with Firefox 3.6.24
> >
> > Martin Mulone is also developing Instant Press for web2py, with
> > similar features i think.
> >
> > On 5 ene, 07:36, Bruno Rocha  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I am developing a Social CMS, I was very inspired by vikuit.com but I
> made
> > > some conceptual improvements on what I think is a Social CMS.
> >
> > > This is a simple system based in Articles, Content Types, Themes,
> Users,
> > > Activities etc...
> >
> > > The code is in github[1] and you have to note that I am trying a
> different
> > > approach which is very un-web2pythonic and it is already under tests.
> >
> > > The demo page is alive[2] Please help me test it! register, login,
> create
> > > articles, like, dislike, favorite, comment etc...
> >
> > > If you have suggestions or ideas please let me know!
> >
> > > * this will be released as Creative Commons Share-a-like-attribution
> license
> >
> > > I need opinions, testers and contributors.
> >
> > > [1]https://github.com/rochacbruno/Movuca(repo)
> > > [2]http://labs.blouweb.com/movuca (DEMO)
> >
> > > * if you want to install it, just run setup/install to load system
> fixtures
> > > * you need web2py trunk
> > > * you need PIL
> > > * not sure if runs on GAE
> >
> > > --
> >
> > > Bruno Rocha
> > > [http://rochacbruno.com.br]


Re: [web2py] How do Global Variables Work?

2012-01-05 Thread Bruno Rocha
you need to pass it

return dict(t1=t1)

or

return locals()

http://zerp.ly/rochacbruno
Em 05/01/2012 12:03, "Peter O"  escreveu:

> Hihi,
>
> I am baffled by what I see between Example 1 and 2.
>
> It may be a good case to improve my understanding of the run-time
> environment of web2py.
>
> Thanks in advance for any comments.
>
> VIEW: (test.html)
>
>   
> {{=globals().get('t1', False)}}
>   
>
> CONTROLLER:
>
> == Example 1 ==
>
> def test():
> global t1
> t1 = True
> return dict() # the browser show 'False'. I was expecting 'True'
>
> == Example 2 ==
>
> def test():
> global t1
> t1 = True
>
> response.render('default/test.html', globals() ) #the return is
> discarded
>
> return dict() # the browser show 'True'. I was expecting the same
> result as Example 1.
>
>
>
>
>
>


Re: [web2py] Re: Movuca - The Social CMS - Need Testers and Contributors

2012-01-05 Thread Bruno Rocha
On Thu, Jan 5, 2012 at 9:27 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Looks really slick



This is the "basic" theme, I am working on two more themes. One based in
Foundation and another in twitter bootstrap. It is all modular so its easy
to create new themes.

-- 

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


[web2py] Movuca - The Social CMS - Need Testers and Contributors

2012-01-05 Thread Bruno Rocha
Hi,

I am developing a Social CMS, I was very inspired by vikuit.com but I made
some conceptual improvements on what I think is a Social CMS.

This is a simple system based in Articles, Content Types, Themes, Users,
Activities etc...

The code is in github[1] and you have to note that I am trying a different
approach which is very un-web2pythonic and it is already under tests.

The demo page is alive[2] Please help me test it! register, login, create
articles, like, dislike, favorite, comment etc...

If you have suggestions or ideas please let me know!

* this will be released as Creative Commons Share-a-like-attribution license

I need opinions, testers and contributors.

[1] https://github.com/rochacbruno/Movuca (repo)
[2] http://labs.blouweb.com/movuca  (DEMO)

* if you want to install it, just run setup/install to load system fixtures
* you need web2py trunk
* you need PIL
* not sure if runs on GAE

-- 

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


Re: [web2py] gluon.storage.Storage - No more KeyError breaks backward compatibility

2012-01-03 Thread Bruno Rocha
One good feature of storage object is the 'None' returned instead of
KeyError.

By the way it does not break backwards compatibility because it is a
documented feature[1]

"Unlike a dictionary, if an attribute (or key) does not exist, it does not
raise an exception. Instead, it returns None."

The above statement is there for a long time and I guess storage always had
this behaviour since I am using web2py.

[1] http://web2py.com/books/default/chapter/29/4?search=gluon.storage

On Tue, Jan 3, 2012 at 12:53 PM, Yarin  wrote:

> Having just upgraded from 1.99.2 to 1.99.4, I noticed that trying to
> access a gluon.storage.Storage with a missing key no longer returns a
> KeyError, but None. This broke my application due to the way I check
> for request vars:
>
>try:
>sort = request.vars['sort']
>except KeyError:
>sort = 'created'
>
> When the 'sort' request var is missing, this code will now assign None
> to sort instead of the default value.
>
> I could not find mention of this change or the reasoning behind it in
> the change log. Can someone speak to this? My view is that making
> gluon.storage.Storage key access behave differently from standard
> Python dictionaries is confusing.




-- 

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


Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-02 Thread Bruno Rocha
On Mon, Jan 2, 2012 at 11:25 AM, Vikas Singhal
wrote:

> Any news on integrating it in web2py?
>

I am waiting the final 2.0 version to update it

-- 

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


Re: [web2py] Happy new year

2012-01-01 Thread Bruno Rocha
Feliz Ano Novo!

http://zerp.ly/rochacbruno
Em 01/01/2012 05:26, "Massimo Di Pierro" 
escreveu:

> Happy new year everybody!


Re: [web2py] Re: log in issue with client tools, Mr freeze or anyone can help?

2011-12-30 Thread Bruno Rocha
I did not updated the current web2pyslices website because I am developing
a new one based on my new CMS.

recently the registration_id field is now required by Auth but your table
does not have it.

Simply add to your auth_user table a new field called registration_id, you
can do using extra_fields

-- 

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


Re: [web2py] Need Help with Custom Form Widget (Possible web2py Bug)

2011-12-30 Thread Bruno Rocha
I got the same problem, I think I solved it (but I cant remember how)

it is working here:
http://labs.blouweb.com/movuca3/article/show/3/flying-spaguetti-monster
(you can register/login to test) I am using your plugin in comments and
also in article creator.

The source is in github.

On Fri, Dec 30, 2011 at 8:09 PM, Ross Peoples wrote:

> Was recently informed of a problem with plugin_ckeditor that I have been
> trying to solve for a while now, but I think it may actually be a web2py
> bug. First of all, here is the widget:
>
> def widget(self, field, value, **attributes):
> """
> To be used with db.table.field.widget to set CKEditor as the
> desired widget for the field.
> Simply set db.table.field.widget = ckeditor.widget to use the
> CKEditor widget.
> """
> default = dict(
> value = value,
> _cols = 80,
> _rows = 10
> )
>
> attributes = FormWidget._attributes(field, default, **attributes)
> attributes['_class'] = 'text plugin_ckeditor'
>
> textarea = TEXTAREA(**attributes)
> javascript = XML('some javascript code here')
> result = [textarea, javascript]
>
> return result
>
>
> And here is a test controller:
>
> def test():
> form = SQLFORM.factory(
> Field('requiredfield', required=True, notnull=True),
> Field('textfield', 'text', widget=ckeditor.widget)
> )
>
> if form.accepts(request.vars, session, keepvalues=True):
> response.flash = 'Accepted'
> elif form.errors:
> response.flash = 'There are some errors'
>
> return dict(form=form)
>
>
> This works great until there is a validation problem while submitting the
> form. Once that happens, instead of getting CKEditor in the form for the
> 'textfield' field, I get "[,
> ]".
>
> I have tried wrapping both TEXTAREA and XML(javascript) into a single
> XML() object, but when this happens, FORM will not pick up the value for
> the field, even though it's in request.vars.
>
> Thanks for your help.
>



-- 

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


Re: [web2py] access auth in modules

2011-12-29 Thread Bruno Rocha
Access control decorators are designed to work in controller actions only,
because actions define workflow of the application, even if you have code
in modules, the action is what your user will call.

But, you can always use other methods to check permissions etc..

in modulesyou can do [ auth.has_permission(), auth.has_membership(), if
auth.user.id: ]

but have in mind that if your Auth instance is created in models, you will
have to always pass it to the module or use the current object.

I am not using models anymore, so all my objects (db, crud, auth, service)
are created in modules and I have access to them.

On Fri, Dec 30, 2011 at 12:52 AM, lyn2py  wrote:

> In controllers, it would look like:
>
> @auth.requires_login()
> def function():
>pass
>
> How do I implement requires_login (and other auth decorators)
> correctly in module methods that require access control?
>
> Thanks!




-- 

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


Re: [web2py] How to use SELECT Tag (HTML HELP) to print out a list

2011-12-28 Thread Bruno Rocha
*SELECT(*[OPTION(i) for i in ['a', 'b', 'c']])*

On Thu, Dec 29, 2011 at 4:52 AM, Dan  wrote:

> 
> {{for i in ['a','b','c']:}}
> {{=i}} 
> {{pass}}
> 
>



-- 

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


[web2py] rxncon bug tracking plugin

2011-12-22 Thread Bruno Rocha
Someone posted in web2py facebook group.

http://rxncon.org/rxncon/plugin_issue/index

http://sourceforge.net/projects/yeastmap/develop


-- 

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


Re: [web2py] OFF TOPIC - www.codeschool.com

2011-12-20 Thread Bruno Rocha
Very nice!

I teach an online web2py class at cursodepython.com.br

I am now preparing some material in english, so I will have the first
in-english online class very soon.


-- 

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


Re: [web2py] error gluon/sqlhtml.py?

2011-12-13 Thread Bruno Rocha
On Wed, Dec 7, 2011 at 12:40 PM, Martin Weissenboeck wrote:

> message = error or T('%(nrows)s records found') % dict(nrows=nrows)


I think we cannot do the above (unless things have changed)

T(..) gives us a LazyT object which cannot be interpolated as a string,
because o that we need to interpolate the string before passing it to T(..)

For me the right is
T("a placeholder %(key)s" % dict(key=value) )

because for me this raises an error:

T("a placeholder %(key)s") % dict(key=value)

*TypeError: unsupported operand type(s) for %:*

-- 

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


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-12-09 Thread Bruno Rocha
On Sat, Dec 10, 2011 at 12:32 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> What's the plugin? can you send me a link?
>

Yes, thats the link

 https://bitbucket.org/PhreeStyle/web2py_ckeditor/src

I made some changes, my code is here:

https://github.com/rochacbruno/Movuca/blob/master/modules/plugin_ckeditor.py

But I am planning to submit a patch to the author.

I am using the edit in place for comments


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



-- 

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


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-12-09 Thread Bruno Rocha
On Fri, Dec 9, 2011 at 6:48 PM, Ross Peoples  wrote:

> Glad to know someone is using my plugin :)


Your plugin is very good, I made some changes, included more methods and
solved some bugs. I will send a patch,


-- 

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


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-12-09 Thread Bruno Rocha
you have to login to see inline-edit working.


Re: [web2py] Re: Mixing/supporting CMS with Web2py

2011-12-09 Thread Bruno Rocha
>
> Any ideas? Suggestions?
>

I am using plugin_ckeditor with inline edit support.

look it working here:
http://labs.blouweb.com/movuca2/article/show/1/how-to-use-modules-in-web2py
(t...@test.com / 1234)

It is all server-side so i think it has no problem with custom layouts.

-- 

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


Re: [web2py] Re: web2py 1.99.3 is OUT

2011-12-09 Thread Bruno Rocha
I miss a "click here for regular website" to bypass mobile detection.

http://zerp.ly/rochacbruno
Em 09/12/2011 16:01, "Vasile Ermicioi"  escreveu:

> also web2py.com website changed,
> I like old menu better than new one
>


Re: [web2py] web2py book 4th Edition

2011-12-09 Thread Bruno Rocha
the book cover is very nice! I like that!



On Fri, Dec 9, 2011 at 3:30 PM, Massimo Di Pierro
wrote:

> The book 4th edition (in print) is available here:
>
> http://www.lulu.com/product/paperback/web2py-book-4th-edition/18738286
>
> I will post it on the web site asap and in PDF.
>
> The book described web2py 1.99.3 and later.
>
> Massimo
>



-- 

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


Re: [web2py] Re: How to reuse view functions

2011-12-09 Thread Bruno Rocha
In that cases I prefer to keep the generators in server side.


modules/html_helpers.py

from gluon import DIV

class MySidebar(DIV):
def __init__(self):
# do whatever you want
DIV.__init__(self)
self.append(H1("mysidebar"))
self.append(UL(*[LI().]))

def myextramethod(self):
.

So in any cotroller I can do:

from html_helpers import MySidebar
return dict(sidebar=MySidebar(*params))


Re: [web2py] web2py 1.99.3 is OUT

2011-12-09 Thread Bruno Rocha
what does {{=MARKMIN('qr:http://web2py.com')}} ??


Re: [web2py] App sugggestion for Web2py -Lottery

2011-12-06 Thread Bruno Rocha
you can use random.org

I made something like that www.rifar.me

http://zerp.ly/rochacbruno
Em 06/12/2011 08:58, "António Ramos"  escreveu:

> Hello, i have a private business with dozens of clients.
>
> I want to offer every year a lottery for my clients.
> The winner will get an offer.
>
> How do i do this with trust?
>
>
> maybe a third party online app that i and all small/large companies could
> trust and clients too.
>
> I as a company register in the site, create the lottery and send tickets
> to my clients.
>
> It could be a usefull and winner app?
>
> Thank you
>
> António
>


Re: [web2py] Re: loading db in module -> AttributeError: 'thread._local' object has no attribute 'db'

2011-12-05 Thread Bruno Rocha
you cant assign db to current. you need to pass db to you class __init__

http://zerp.ly/rochacbruno
Em 05/12/2011 23:21, "Francisco Costa"  escreveu:

> thanks Anthony, but how can I have access to db in modules then?
>
> On Dec 6, 1:14 am, Anthony  wrote:
> > Read the callout box at the end of this
> > section:
> http://web2py.com/book/default/chapter/04#Accessing-the-API-from-Pyth
> > You're not supposed to assign items from 'current' to global variables
> > within the module, which are defined only once when the module is first
> > imported.
> >
> > Anthony
>


Re: [web2py] Bug : exec_environment vs. Auth

2011-12-05 Thread Bruno Rocha
I mean, Class based logic in modules.


-- 

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


Re: [web2py] Bug : exec_environment vs. Auth

2011-12-05 Thread Bruno Rocha
I think this is not a bug.

Auth needs 'request' to build some paths and also will need it to do other
things.

The fact is that Auth was designed to run in a server-client environment,
where server will always have a request object. if you need to run in
exec_environment or in shell mode you will need to mock some things.

you can build your own request object and populate it.

current.request = request
request.folder = 'somepath'
...

To be honest, I think exec_environment should not be used to build
applications, unless you have a very special case and are prepared to mock
every missing object needed.

Less models, Less code in controllers and more class based login in modules
and you will have a better system.



2011/12/5 Mirek Zvolský 

> 1.99.2, WinXP
>
> Model works fine from browser and from integrated shell.
> But there is problem from exec_environment, when model contains Auth:
>
> os.chdir(r'c:\python27\Lib\site-packages\web2py')
> from gluon.shell import exec_environment
> cas = exec_environment('applications/cas/models/db.py')
>
>
> Traceback (most recent call last):
>  File "", line 1, in 
>cas = exec_environment('applications/ereceipts_server/models/
> db.py')
>  File "C:\Python27\Lib\site-packages\web2py\gluon\shell.py", line 71,
> in exec_environment
>execfile(pyfile, env)
>  File "applications/ereceipts_server/models/db.py", line 36, in
> 
>auth = Auth(db, hmac_key=Auth.get_or_create_key())
>  File "C:\Python27\Lib\site-packages\web2py\gluon\tools.py", line
> 811, in get_or_create_key
>request = current.request
> AttributeError: 'thread._local' object has no attribute 'request'
>



-- 

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


[web2py] How to deploy web2py on PythonAnywhere

2011-12-05 Thread Bruno Rocha
How to deploy web2py on PythonAnywhere

http://stackoverflow.com/a/8386751/559935

-- 

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


Re: [web2py] Re: oracle error after changing password

2011-12-05 Thread Bruno Rocha
fake_migrate=True

http://zerp.ly/rochacbruno
Em 05/12/2011 10:37, "Tim Korb"  escreveu:

> Oh, I see.  Since the password is part of the connect string, the
> connection string hash used for migrations has changed.  Web2py is
> apparently trying to recreate existing tables, assuming that this is a
> different database.
>
> Correct? I guess I need to read the migration section in the manual more
> closely... :-)
>


Re: [web2py] Re: Best practices: When to use classes

2011-12-02 Thread Bruno Rocha
On Fri, Dec 2, 2011 at 5:46 PM, pbreit  wrote:

> I'm interested in this approach and these samples are very helpful but it
> seems like there is still a ways to go. Would it be possible to create some
> sort of welcome-like model-less bootstrap?


Look in to my modules here:
https://github.com/rochacbruno/Movuca/tree/master/modules

BaseModel, BaseHandler and custom DataBase and Access

-- 

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


Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
Actually you dont need even an ajax callback.

Take this example:

## models/script.py ##

db.define_table("mytable", Field("picture", "upload"))
print "models executed!"

## controllers/default.py ##

def index():
pictures = db(db.mytable).select()
return dict(pictures=pictures)

def download():
return response.download(request, db)

## views/default/index.html ##

{{for picture in pictures:}}

{{pass}}


Let's say the table has 200 records and I want to show 200 thumbnails in
the page.

Q: How many times you will see "models executed!" in terminal? and how many
times the table will be defined? the Auth, Crud, Service etc will be
instantiated?

A: 201 times. 1 for the first request and 200 for each image which calls
the 'download' function.

Now imagine a system which huge model files, too many tables and calling
long running funtions.

my tips:

1. Avoid models, use modules and import what you need in controller.

2. Avoid the download function, put uploadfolder='static' and build
URL('static') when need an image. Or put your download function in a
separate application which have access to the file system and database.
-- 

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


Re: [web2py] Re: joins across databases

2011-12-01 Thread Bruno Rocha
With two databases will work only if you have linked-servers in your
backend. I did it with MSSQL two databases linked and some views defined in
DB. so in web2py I defined the views as tables.


Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
On Thu, Dec 1, 2011 at 11:17 PM, lyn2py  wrote:

> Model files are run on every request - does that mean having a complex
> database structure would slow the entire site down?
>

Yes, if you everything you have in models will be executed even if you are
just serving a simple contact form or an small string in ajax callback.

For solving this you can use submodels (subfolders in models which maps to
the requested controller/function) or you can create your system in modules
and import only what you need explicity in every controller/function you
create.

I think submodels are for small apps because it does not permits the reuse
of submodels for multiple controllers. I prefer to code in /modules

an example of the approach:  https://github.com/rochacbruno/Movuca (the
sample app running http://labs.blouweb.com/movuca2/home/index)

Specially if the application are being created to run on Google App Engine,
where CPU costs a lot.


-- 

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


Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
On Thu, Dec 1, 2011 at 11:01 PM, Anthony  wrote:

> Also, isn't it sometimes useful to put code in a model file that you want
> to run on every (or nearly every) request without having to do an import?


Yes, some helping functions and objects i think is very useful to have in
modules, but not Auth, Crud, Mail, db and defined tables. obviously I am
talking about a large app. for small apps I see no problem on having [auth,
crud, service, db, mail, etc..] loaded in every request even if it is only
an ajax callback or another simple page.

But for large apps which uses ajax a lot, I think it is not needed to load
all that objects/instances or define all tables in every request. So in
that cases I am going to use /modules. I created a template app with
basemodels and handlers. so I call then directly in controller only what I
need and when I need to use.

For example, I dont need crud and auth for some counter functions that I
use as ajax callbacks.

Example, in a system where I have 100+ tables in DB, so I need an simple
ajax callback to return something related to only one of the tables, why I
need to define every one of them? In this ajax callback I dont need auth,
crud service or nothing more.. I only need access to one table to return a
simple string.

in controller:

def myajaxcallback():
from datamodel.myobject import MyClass
myobject = MyClass('myparams')
return myobject.counter()

in module:

from gluon import current
from basemodel import BaseModel # a place where I have code which uses
class attributes to define the tables

class MyClass(BaseModel):
def __init__(self, params):
from mydb import DataBase # a custom subclass of DAL
self.db = DataBase([theonlytableIneed])  # will return DAL instance
with only the table I need defined

def counter(self):
arg = current.request.args(0)
return self.db(self.db.theonlytableIneed.field ==
arg).select(cache=(cahe.ram, 300))


I already tried to use submodels but I find it very useful for small apps,
but large apps need more class based system to be more reusable.





-- 

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


Re: [web2py] Re: Best practices: When to use classes

2011-12-01 Thread Bruno Rocha
I have an opinion about that.

For me the /models folders should be renamed to /scripts since it has
scripts that are executed in every request. Going on this approach I am
only writing model-less (or script-less) apps.

I am now recommending to all of my students and clients to avoid the use of
models and go to class based system in modules, now with thread locals
object and custom_importer it is very easy to create an application without
using any model file.

I encourage you to learn more about O.O in Python, then after that you can
find a better way to create your web2py applications using modules and
classes.


-- 

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


Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread Bruno Rocha
Dont do it in models, do in /modules


in modules/myauth.py

from gluon.tools import Auth
form gluon import *

class MyAuth(Auth):
def __init__(self):
   #do whatever you want here
   Auth.__init__(self)


in any place of app (model, controller)

from myauth import MyAuth
auth = MyAuth()


On Wed, Nov 30, 2011 at 4:07 PM, Carlos Hanson wrote:

> Chapter 8 says, "All of the methods above can be extended or replaced by
> subclassing Auth." However, it does not give the best place to add the code
> to do so. There is mention of adding to your model, but I'm a little
> unclear about that too.
>
> It seems that the models are imported in order, since the wizard created a
> 0.py. I've created a db_accounts.py, so it comes after db.py. Since I need
> to subclass Auth, I think I need to either create a file that sorts before
> db.py or add code to db.py. My thought is to minimize the number of changes
> to db.py. I know I will need to change the line which instantiates Auth to
> use MyAuth.
>
> Does anyone have suggestions on how to organize models and customizations
> to Auth?
>
> Thanks.
>
> Carlos
>



-- 

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


Re: [web2py] Re: trunk error

2011-11-30 Thread Bruno Rocha
I just removed the {{is_mobile=request.user_agent().is_mobile}} from the
*/layout views and admin controller

it worked..

On Wed, Nov 30, 2011 at 4:03 PM, Anthony  wrote:

> Note, this is also causing 'admin' to fail. I submitted a ticket.
>
>
> On Wednesday, November 30, 2011 12:19:48 PM UTC-5, rochacbruno wrote:
>>
>> Just got the same with firefox on windows
>>
>> (dp1
>> S'output'
>> p2
>> S" invalid syntax (user_agent_parser.py,
>> line 214)
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>


-- 

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


<    3   4   5   6   7   8   9   10   11   12   >