You are going to love this

26 views
Skip to first unread message

mdipierro

unread,
Nov 5, 2009, 11:56:11 PM11/5/09
to web2py-users
http://web2py.com/layouts/plugin_layouts/index?apply=EfflorescenceOrange

- Try it online first.
- Then download the plugin (it is 30MB and it includes 408 layouts
already customized for web2py, sort of, + images and css).
- Apply the plugin on top of an existing app using admin (requires
1.71.2 or higher)

From a distribution point of view it would be better to distribute one
layout at the time, but from the user point of view, it is cool to
have all of them together.

Sebastian Brandt

unread,
Nov 6, 2009, 12:01:26 AM11/6/09
to web2py-users
very awesome, thanks!

Graham Dumpleton

unread,
Nov 6, 2009, 12:03:15 AM11/6/09
to web2py-users
For the curious, would you like to explain the procedure you, or
whoever, went about to generate this.

Ie., where were original layouts/stylesheets obtained from, what
script or whatever was used to convert/package them into form
understood by web2py.

Sorry if the answer is obvious but I am ignorant of what web2py does
internally and so as an outsider would like short dumb persons
explanation.

Thanks.

Graham

mdipierro

unread,
Nov 6, 2009, 12:09:16 AM11/6/09
to web2py-users
I downloaded multiple layouts from the web with a free Artistic
License and used a script in BeautifulSoup to replace the header, menu
and content with web2py tags. Then I rearranged the files in the
proper web2py locations and stuck everything under one app.

It took about 2hrs. One can do better with more time. About 50% of the
layouts would need some manual tweaks. I have another 1000 layouts
that I did not process.

Massimo


On Nov 5, 11:03 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:

mdipierro

unread,
Nov 6, 2009, 12:11:55 AM11/6/09
to web2py-users
It would be nice is somebody where to go over the list and decide
which ones are worth keeping and which ones not. I have not looked at
all of them.

DenesL

unread,
Nov 6, 2009, 12:38:52 AM11/6/09
to web2py-users
Wow!
A slice with the procedure and code perhaps? It would encourage more
layouts.
Now we are going to need a layout repository too...

mr.freeze

unread,
Nov 6, 2009, 12:41:56 AM11/6/09
to web2py-users
I'm starting to be sold on the new plugin system. This is very cool.

On Nov 5, 11:09 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:

Richard

unread,
Nov 6, 2009, 12:52:04 AM11/6/09
to web2py-users
all the ones I looked at were nicer than the default layout -
fantastic!

mdipierro

unread,
Nov 6, 2009, 1:11:33 AM11/6/09
to web2py-users
The plugin action should have some reserved actions like

_on_install
_on_unistall
_configure
(what else)

That can only be called by the administrator and exposed via admin
only. The on_install for example could register a service with cron or
append translated string to a language file.
The plugin could be listed in admin with a button that says
[configure] and the plugin itself generates a configuration interface
depending on what it does like in this case.

mdipierro

unread,
Nov 6, 2009, 1:18:59 AM11/6/09
to web2py-users
It needs cleanup.

import glob
import os
import zipfile
import sys

def find_path(files):
files2 = [x for x in files if not x.endswith('/')]
paths2 = set([x[:x.rfind('/')+1] for x in files2])
ell = min([len(x) for x in paths2])
path = list(set([x for x in paths2 if len(x)==ell]))[0]
return path

def head(name,styles):
title = '<title>{{=response.title or request.application}}</
title>'
items = '\n'.join(["{{response.files.append(URL
(request.application,'static','p\
lugin_layouts/layouts/%s/%s'))}}" % (name,style) for style in styles])

loc="""<style>
.flash
{
z-index:
2;
position:
absolute;
top:
0px;
right:
20%;
width:
60%;
height:
50px;
opacity:
0.75;
margin: 0
auto;
text-align:
center;
clear:
both;
border: 1px #000000
solid;
color:
black;
font-size:
12pt;
padding: 100px 10px 10px
10px;
cursor:
pointer;
background:
white;

}
div.error
{
background-color:
red;
color:
white;
padding:
3px;
}
</style>"""
return "\n%s\n%s\n{{include 'web2py_ajax.html'}}\n%s" %
(title,items,loc)

def content():
return """<div class="flash">{{=response.flash or ''}}</div>
{{include}}"""

for file in glob.glob('layouts/*'):
name=file[9:]
print name
folder='layouts/%s/' % name
try:
from BeautifulSoup import BeautifulSoup as BS
soup = BS(open(folder+'index.html','rb').read())
styles = [x['href'] for x in soup.findAll('link')]
soup.find('head').contents=BS(head(name,styles))
try:
soup.find('h1').contents=BS('{{=response.title or
request.application}}')
soup.find('h2').contents=BS("{{=response.subtitle or
'=response.subtitle'}}")
except:
pass
for x in (soup.find('div',id='menu'),
soup.find('div',{'class':'menu'}),
soup.find('div',id='nav'),
soup.find('div',{'class':'nav'})):
if x:
x.contents=BS('{{=MENU(response.menu)}}')
break
done=False
for x in (soup.find('div',id='content'),
soup.find('div',{'class':'content'}),
soup.find('div',id='main'),
soup.find('div',{'class':'main'})):
if x:
x.contents=BS(content())
done=True
break
if done:
page = soup.prettify()
page = re.compile("\s*\{\{=response\.flash or ''\}\}
\s*",re.MULTILINE).sub("{{=response.flash or ''}}",page)
open('layouts/'+name+'.html','wb').write(page)
print 'DONE'
else:
raise Exception
except Exception, e:
print e
continue

salingrosso

unread,
Nov 6, 2009, 4:16:13 AM11/6/09
to web...@googlegroups.com
The script to convert layouts is available somewhere? I could be more interested in converting the template I like than
to search thousands of layouts selected by someone else.
But, anyway, this is a very useful resource, if we release it better this could be something like the wordpress theme directory!
I think also that a select could be better than a list of thousands links, do you?

2009/11/6 mdipierro <mdip...@cs.depaul.edu>

Johann Spies

unread,
Nov 7, 2009, 3:41:54 PM11/7/09
to web...@googlegroups.com
2009/11/6 mdipierro <mdip...@cs.depaul.edu>:

>
> http://web2py.com/layouts/plugin_layouts/index?apply=EfflorescenceOrange
>
> - Try it online first.
> - Then download the plugin (it is 30MB and it includes 408 layouts
> already customized for web2py, sort of, + images and css).
> - Apply the plugin on top of an existing app using admin (requires
> 1.71.2 or higher)

I am sorry, but I don't know what "apply the plugin on top of an
existing app" means. Do you load it as what when you have the
applications "design" page open. I have 1.71.2 but I don't see a
"plugin" button.

Regards
Johann

villas

unread,
Nov 7, 2009, 3:54:37 PM11/7/09
to web2py-users
On Nov 7, 8:41 pm, Johann Spies <johann.sp...@gmail.com> wrote:
> I have 1.71.2  but I don't see a "plugin" button.

At the very bottom of the design page, under modules.

mdipierro

unread,
Nov 7, 2009, 4:54:00 PM11/7/09
to web2py-users
And if you do not see that it is because you must upgrade the admin
interface.

guruyaya

unread,
Nov 7, 2009, 6:23:58 PM11/7/09
to web2py-users
On another topic: Your server returns "text/plain" content type on
these plugins. Is there a chance you can find a way to change w2p file
to return an "application/zip" content type?

mdipierro

unread,
Nov 7, 2009, 8:06:45 PM11/7/09
to web2py-users
That is easy to do but, it were to return application/zip then your
web browser would try unzip them while it should not. web2py should
unzip them.

Wiiboy

unread,
Nov 7, 2009, 10:00:19 PM11/7/09
to web2py-users
Umm, how exactly do I apply them? Copy and paste?

Wiiboy

unread,
Nov 7, 2009, 10:01:15 PM11/7/09
to web2py-users
I'm using revision 1392.

Zoom.Quiet

unread,
Nov 7, 2009, 10:11:08 PM11/7/09
to web...@googlegroups.com
On Fri, Nov 6, 2009 at 12:56, mdipierro <mdip...@cs.depaul.edu> wrote:
>
> http://web2py.com/layouts/plugin_layouts/index?apply=EfflorescenceOrange
>
cheering !
wonderful collection! help people easy make web2py beautful !

> - Try it online first.
> - Then download the plugin (it is 30MB and it includes 408 layouts
> already customized for web2py, sort of, + images and css).
> - Apply the plugin on top of an existing app using admin (requires
> 1.71.2 or higher)
>
> From a distribution point of view it would be better to distribute one
> layout at the time, but from the user point of view, it is cool to
> have all of them together.
> >
>



--
http://zoomquiet.org 人生苦短? Pythonic!
工作的层次(依靠谱程度从低到高)=有做->做完->做对->做好->帮助他人做好

Wiiboy

unread,
Nov 7, 2009, 10:33:36 PM11/7/09
to web2py-users
Ah, strike that. Found it by going to my app's homepage.

Johann Spies

unread,
Nov 8, 2009, 2:46:47 AM11/8/09
to web...@googlegroups.com
2009/11/7 mdipierro <mdip...@cs.depaul.edu>:

>
> And if you do not see that it is because you must upgrade the admin
> interface.
>

No it is not there.

This is confusing. I have unzipped the new web2py_src.zip and thought
this is the way to upgrade. Is upgrading the amin interface then
another process?

It seems to me I must export the application, delete my web2py
installation, install the new package and then import my application.

Regards
Johann

mdipierro

unread,
Nov 8, 2009, 2:58:18 AM11/8/09
to web2py-users
you must run web2py with --upgrade=yes this will upgrade admin/welcome/
examples

or manually

cd applications/admin
tar zxvf ../../admin.w2p

A lot of people seem to complain about this process. It is there
because I always thought people were going to modify admin. This never
happened. Should we make admin upgrade by default?

On Nov 8, 1:46 am, Johann Spies <johann.sp...@gmail.com> wrote:
> 2009/11/7 mdipierro <mdipie...@cs.depaul.edu>:

salingrosso

unread,
Nov 8, 2009, 4:10:29 AM11/8/09
to web...@googlegroups.com
A lot of people seem to complain about this process. It is there
because I always thought people were going to modify admin. This never
happened. Should we make admin upgrade by default?


No, I think the manual method is better. Perhaps we could
insert an advise similar to the one used on the right to
annouce  the availability of new versions of web2py.

Peterle

unread,
Nov 8, 2009, 4:33:36 AM11/8/09
to web2py-users
these things are welcome.

-----------------

Johann Spies

unread,
Nov 8, 2009, 10:23:24 AM11/8/09
to web...@googlegroups.com
2009/11/8 mdipierro <mdip...@cs.depaul.edu>:

>
> you must run web2py with --upgrade=yes this will upgrade admin/welcome/
> examples
>
> or manually
>
> cd applications/admin
> tar zxvf ../../admin.w2p
>

Thanks. I missed that somehow in my reading of the manual/documentation.

Regards
Johann

Christopher Steel

unread,
Nov 8, 2009, 11:56:34 AM11/8/09
to web2py-users
I am starting to get the impression that it is raining candy here...

; )



On Nov 8, 10:23 am, Johann Spies <johann.sp...@gmail.com> wrote:
> 2009/11/8 mdipierro <mdipie...@cs.depaul.edu>:
Reply all
Reply to author
Forward
0 new messages