[web2py] Re: Hyperlink urls in comments

2010-11-04 Thread annet
Hi Bruno,


> The easy way to render the 'http://' urls in web2py, is using markmin.
>
> lets say you have a text
>
> text = "ths is a text with a linkhttp://www.rochacbruno.com.br";
>
> To render the link as an Hyperlink you can use markmin.
>
> {{=MARKMIN(text)}}

On October 15 I posted the following message:

"While testing my cms application I found that the link in the mail
send by the request_reset_password function isn't clickable, the user
has to copy and paste the link into the browser. Am I the only one
experiencing this? Is there a way to solve this problem?"


Could this problem be solved using markmin?


Regards,

Annet


[web2py] CRUD select with autosort headers

2010-11-04 Thread baloan
Hello,

is there a way to make CRUD.select() build a table that allows to sort
(alternately ascending, descending) when clicking the column header?
In 1.87.3 the column headers are non-clickable.

Best regards, Andreas
balo...@gmail.com


[web2py] Re: validators order

2010-11-04 Thread DenesL

On Nov 3, 3:52 pm, andrej burja  wrote:
> hi
>
> why is order of validators important?
> i have
>
> db.tecaj.voditelj.requires=IS_NOT_EMPTY()
> db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s')
>
> why does putting the IS_NOT_EMPTY() at the end doesn't produce
> dropdown list?

Your code replaces one validator with another,
it does not create a list with both.

To have both and get a dropdown you need something like:
db.tecaj.voditelj.requires=[IS_NOT_EMPTY(),IS_IN_DB(...)]

> do i need the IS_NOT_EMPTY() if i have IS_IN_DB validator?

It depends on your data and model.
In your case it is superfluous because you are storing an id which can
not be empty.
But if your requires was: IS_IN_DB(db,'person.name')
and some entry in person.name was empty then you would need an
IS_NOT_EMPTY validator to avoid having an empty entry.

> andrej


[web2py] Different register procedures multiple databases.

2010-11-04 Thread annet
In an application I defined the following connection string and
tables:

db = DAL('postgres://...)

auth.settings.table_user = db.define_table('auth_user',
Field(...),
 
Field('company_id',db.company,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
Field(...))

db.define_table('company',
Field('company_name',length=54,default='',notnull=True),
Field(...),
migrate=False)


In this application the users are registered by an administrator, and
the whole cms application is auth.user.company_id driven. Now, I would
like to build a second application in which users register themselves.
Since these users can be linked to more than one company, I have to
introduce an auth_user_company table containing auth_user_id and
company_id. My first question is, can auth_user_id and company_id come
from different databases?

if so, the second application should be able to store data related to
personalizing views. e.g the first application contains a timetable.
Users query the timetable by entering activities and days in a
multiple select drop box. My second question is, can I define a table
in the second application called myTimetable which stores the
company_id and the contents of the two drop boxes and then base the
rendering of a personalized timetable on these data?


Kind regards,

Annet.


[web2py] CRON doesn't work

2010-11-04 Thread Sverre
My cron tab looking like this

#crontab
*/2 * * * * root  *sys/test_cron
@hourly  root  *applications/mm/cron/expire_sessions.py

but this doesn' work. My test cron function is

from time import ctime
def test_cron():
db.dbg.insert(dbgmsg=ctime())
db.commit()
return "ready"


If I trigger this function manually it's working. Web2Py is installed
as a Windows Service. Is someone able to help?







[web2py] Database query using regular expressions

2010-11-04 Thread Johann Spies
In order to solve inconsistent typing by either people who capture
data or people using search functions I intend to use something like
this in SQL (Postgresql):

select titel from joernaal
where
regexp_replace(lower(titel), '[ -,.:]', '', 'g') =
regexp_replace(lower('SAMj -South african Medical Journal'), '[
,.:]', '', 'g')

The last line can be handled by python using the input from a form.  I
want Postgresql to handle the second last line.

I suspect this type of query is not possible using DAL (or is it?) and
that I will have to use executesql for that?

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge
of God and of Jesus our Lord!  His divine power has given us
everything we need for life and godliness through the full knowledge
of the one who called us by his own glory and excellence.
                                                    2 Pet. 1:2b,3a


[web2py] Re: new admin layout

2010-11-04 Thread Martin.Mulone
Thanks branko look very good.

Some little things

-less rounded in title headers?
-the orange in "button edit" still killing my eyes?
-"submit" button has no margins
-Why not by default in edit => all collapsed ?
-The font color in top menu orange with green background is not
getting well, you tried with font white ?

The appadmin is going to have the same theme no?.


On 4 nov, 02:07, Jonathan Lundell  wrote:
> On Nov 3, 2010, at 8:21 PM, mdipierro wrote:
>
>
>
> > Here is the latest work by Branko (with minor edits by me):
>
> This scales up (cmd +) rather badly under Safari, the buttons especially.
>
>
>
>
>
>
>
>
>
> >  http://web2py.com/demo_admin
>
> > (also in trunk)
>
> > This is the older one
>
> >  http://web2py.com/demo_admin_halloween
>
> > My edits are:
> > 1) I have made all edit buttons orange
> > 2) links files and no longer buttons (consistently with original
> > version)
> > 3) changed order from [file,edit,delete] to [edit,delete,file] since
> > alignment is cleaner
> > 4) moved all green links to right
>
> > TODO:
> > - I would prefer no shadow under icons.
> > - Text like "No models" under design does not appear aligned properly.
>
> > I really like this new admin.


Re: [web2py] Re: new admin layout

2010-11-04 Thread Branko Vukelic
On Thu, Nov 4, 2010 at 11:33 AM, Martin.Mulone  wrote:
> Thanks branko look very good.
>
> Some little things
>
> -less rounded in title headers?

Maybe?

> -the orange in "button edit" still killing my eyes?

Maybe?

> -"submit" button has no margins

Submit button is an inline element, and it can't have margins, but
yeah, I know what you mean. I've talked to Massimo. The HTML for the
admin templates could use a lot of love. It would be nice if someone
could jump in aboard and help with that, too. I wouldn't mess with the
design any further until the HTML is completely revised and becomes
more pleasant to work with.

> -Why not by default in edit => all collapsed ?

Had the same thought, actually. The current way of closing an opening
the sections isn't very nice, and that could use some work, too.

> -The font color in top menu orange with green background is not
> getting well, you tried with font white ?

Yes, I have. It blends with the logo, so I didn't use it. Anyway,
orange with green works fine for me, so I guess this is a matter of
taste. Another "Maybe." Anyway, I guess cosmetic changes will have to
wait for HTML to be reworked.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Re: Database query using regular expressions

2010-11-04 Thread mdipierro
This may work

query="regexp_replace(lower(titel), '[ -,.:]', '', 'g') =
regexp_replace(lower('SAMj -South african Medical Journal'),
'[,.:]', '', 'g')"
db(query).select(db.joernaal.titel)

On Nov 4, 5:14 am, Johann Spies  wrote:
> In order to solve inconsistent typing by either people who capture
> data or people using search functions I intend to use something like
> this in SQL (Postgresql):
>
> select titel from joernaal
> where
> regexp_replace(lower(titel), '[ -,.:]', '', 'g') =
> regexp_replace(lower('SAMj -South     african Medical Journal'), '[
> ,.:]', '', 'g')
>
> The last line can be handled by python using the input from a form.  I
> want Postgresql to handle the second last line.
>
> I suspect this type of query is not possible using DAL (or is it?) and
> that I will have to use executesql for that?
>
> Regards
> Johann
> --
>  May grace and peace be yours in abundance through the full knowledge
> of God and of Jesus our Lord!  His divine power has given us
> everything we need for life and godliness through the full knowledge
> of the one who called us by his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] Book Edit Suggestion

2010-11-04 Thread villas
http://www.web2py.com/book/default/chapter/07#CRUD

I noticed this example in the book which does not seem correct:

def manage():
table=db[request.args(0)]
form = crud.update(table,request.args(1))
table.id.represent = lambda id: \
   A('edit:',id,_href=URL(args=(request.args(0),id)))
search, rows = crud.select(table)# <<<--
return dict(form=form,search=search,rows=rows)

May I suggest replacing the marked line:
search, rows = crud.select(table)

with these two lines:
search = crud.search(table)
rows = crud.select(table)

-D


[web2py] Wizard Feature Request

2010-11-04 Thread Seeker
Hi,

Really great work on the wizard!  It makes life a lot easier.

I don't know how useful most people will find it, but I would really
appreciate being to specify/list tables in the wizard in any order
(regardless of their dependencies) and have the wizard place them in
the correct order in the model.

It is easy to avoid dependency issues if only adding a few tables, but
if the list of tables is large then it becomes a lot harder to place
the tables in the correct order ... and a lot of tables may have to be
removed 1st and then re-added in order to place the offending table in
the correct place.

I suppose other solutions would be either having the ability to add a
new/blank table textbox below the one with focus as opposed to adding
it at the bottom of the list only
OR having a method for re-ordering tables in the list.

Thanks lots.


[web2py] Re: Wizard Feature Request

2010-11-04 Thread mdipierro
good idea. Should be easy to do. I will do it asap.

On Nov 4, 7:45 am, Seeker  wrote:
> Hi,
>
> Really great work on the wizard!  It makes life a lot easier.
>
> I don't know how useful most people will find it, but I would really
> appreciate being to specify/list tables in the wizard in any order
> (regardless of their dependencies) and have the wizard place them in
> the correct order in the model.
>
> It is easy to avoid dependency issues if only adding a few tables, but
> if the list of tables is large then it becomes a lot harder to place
> the tables in the correct order ... and a lot of tables may have to be
> removed 1st and then re-added in order to place the offending table in
> the correct place.
>
> I suppose other solutions would be either having the ability to add a
> new/blank table textbox below the one with focus as opposed to adding
> it at the bottom of the list only
> OR having a method for re-ordering tables in the list.
>
> Thanks lots.


[web2py] Re: Wizard Feature Request

2010-11-04 Thread Seeker
Great, thanks!


On Nov 4, 3:01 pm, mdipierro  wrote:
> good idea. Should be easy to do. I will do it asap.
>
> On Nov 4, 7:45 am, Seeker  wrote:
>
>
>
> > Hi,
>
> > Really great work on the wizard!  It makes life a lot easier.
>
> > I don't know how useful most people will find it, but I would really
> > appreciate being to specify/list tables in the wizard in any order
> > (regardless of their dependencies) and have the wizard place them in
> > the correct order in the model.
>
> > It is easy to avoid dependency issues if only adding a few tables, but
> > if the list of tables is large then it becomes a lot harder to place
> > the tables in the correct order ... and a lot of tables may have to be
> > removed 1st and then re-added in order to place the offending table in
> > the correct place.
>
> > I suppose other solutions would be either having the ability to add a
> > new/blank table textbox below the one with focus as opposed to adding
> > it at the bottom of the list only
> > OR having a method for re-ordering tables in the list.
>
> > Thanks lots.- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: new admin layout

2010-11-04 Thread mdipierro
This was my mistake since I had to appply Branko's patch manuallay.
Now fixed:

http://www.web2py.com/demo_admin/default/site

On Nov 4, 12:07 am, Jonathan Lundell  wrote:
> On Nov 3, 2010, at 8:21 PM, mdipierro wrote:
>
>
>
> > Here is the latest work by Branko (with minor edits by me):
>
> This scales up (cmd +) rather badly under Safari, the buttons especially.
>
>
>
>
>
>
>
> >  http://web2py.com/demo_admin
>
> > (also in trunk)
>
> > This is the older one
>
> >  http://web2py.com/demo_admin_halloween
>
> > My edits are:
> > 1) I have made all edit buttons orange
> > 2) links files and no longer buttons (consistently with original
> > version)
> > 3) changed order from [file,edit,delete] to [edit,delete,file] since
> > alignment is cleaner
> > 4) moved all green links to right
>
> > TODO:
> > - I would prefer no shadow under icons.
> > - Text like "No models" under design does not appear aligned properly.
>
> > I really like this new admin.
>
>


[web2py] \sample markmin app

2010-11-04 Thread mdipierro
http://www.web2py.com/markmin


[web2py] two FORM questions

2010-11-04 Thread Andrew Thompson
I built a FORM() object to handle data collection for multiple records 
in one swoop, but it doesn't seem to activate the widgets. Do I need 
something more than the below?


INPUT(_type='text',_name='date', requires=IS_DATE())

The validator is applied, but the widget is not.

I also was trying to do a custom form layout in my view, but I was not 
able to make form.custom. work, for FORM or SQLFORM. I must be 
missing something. Is the 'custom' in form.custom.begin defined by 
default, or do I need to define it somewhere?


Thanks.

--
Andrew Thompson
http://aktzero.com/



Re: [web2py] Re: Database query using regular expressions

2010-11-04 Thread Johann Spies
Thanks. I will try it.

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge
of God and of Jesus our Lord!  His divine power has given us
everything we need for life and godliness through the full knowledge
of the one who called us by his own glory and excellence.
                                                    2 Pet. 1:2b,3a


[web2py] Re: new admin layout

2010-11-04 Thread mdipierro
Just a tought...

How about we make ALL sounded corners 3px and we use the button colors
of stack overflow (edit in white/orange, site buttons in black/white,
other buttons in white/gray)? We can also make the top bar gray as
they do which is un-intrusive. We do not need a logo. People know
where they are.

Please no more changes to *.html (unless to fix bugs), only to
style.css.

Massimo


On Nov 4, 7:18 am, Branko Vukelic  wrote:
> On Thu, Nov 4, 2010 at 11:33 AM, Martin.Mulone  
> wrote:
> > Thanks branko look very good.
>
> > Some little things
>
> > -less rounded in title headers?
>
> Maybe?
>
> > -the orange in "button edit" still killing my eyes?
>
> Maybe?
>
> > -"submit" button has no margins
>
> Submit button is an inline element, and it can't have margins, but
> yeah, I know what you mean. I've talked to Massimo. The HTML for the
> admin templates could use a lot of love. It would be nice if someone
> could jump in aboard and help with that, too. I wouldn't mess with the
> design any further until the HTML is completely revised and becomes
> more pleasant to work with.
>
> > -Why not by default in edit => all collapsed ?
>
> Had the same thought, actually. The current way of closing an opening
> the sections isn't very nice, and that could use some work, too.
>
> > -The font color in top menu orange with green background is not
> > getting well, you tried with font white ?
>
> Yes, I have. It blends with the logo, so I didn't use it. Anyway,
> orange with green works fine for me, so I guess this is a matter of
> taste. Another "Maybe." Anyway, I guess cosmetic changes will have to
> wait for HTML to be reworked.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


[web2py] Re: two FORM questions

2010-11-04 Thread mdipierro
If you use INPUT than you want an  No widgets.

I suggest you use SQLFORM.factory(Field(.)) instead.

On Nov 4, 8:20 am, Andrew Thompson  wrote:
> I built a FORM() object to handle data collection for multiple records
> in one swoop, but it doesn't seem to activate the widgets. Do I need
> something more than the below?
>
> INPUT(_type='text',_name='date', requires=IS_DATE())
>
> The validator is applied, but the widget is not.
>
> I also was trying to do a custom form layout in my view, but I was not
> able to make form.custom. work, for FORM or SQLFORM. I must be
> missing something. Is the 'custom' in form.custom.begin defined by
> default, or do I need to define it somewhere?
>
> Thanks.
>
> --
> Andrew Thompsonhttp://aktzero.com/


Re: [web2py] Re: new admin layout

2010-11-04 Thread Jonathan Lundell
On Nov 4, 2010, at 6:07 AM, mdipierro wrote:
> 
> This was my mistake since I had to appply Branko's patch manuallay.
> Now fixed:
> 
> http://www.web2py.com/demo_admin/default/site

The scale of the buttons is good now. That's a lot better than it was.

But expand the page in Mac Safari (cmd+) and watch what happens to the compile 
button.

> 
> On Nov 4, 12:07 am, Jonathan Lundell  wrote:
>> On Nov 3, 2010, at 8:21 PM, mdipierro wrote:
>> 
>> 
>> 
>>> Here is the latest work by Branko (with minor edits by me):
>> 
>> This scales up (cmd +) rather badly under Safari, the buttons especially.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>>  http://web2py.com/demo_admin
>> 
>>> (also in trunk)
>> 
>>> This is the older one
>> 
>>>  http://web2py.com/demo_admin_halloween
>> 
>>> My edits are:
>>> 1) I have made all edit buttons orange
>>> 2) links files and no longer buttons (consistently with original
>>> version)
>>> 3) changed order from [file,edit,delete] to [edit,delete,file] since
>>> alignment is cleaner
>>> 4) moved all green links to right
>> 
>>> TODO:
>>> - I would prefer no shadow under icons.
>>> - Text like "No models" under design does not appear aligned properly.
>> 
>>> I really like this new admin.
>> 
>> 




[web2py] Error in trunk with admin layout?

2010-11-04 Thread Seeker
Hi,

In trunk:
Not sure if i have done something wrong, but admin seems to be without
a layout ...
Anyone else experiencing this?

Thanks.


Re: [web2py] Re: new admin layout

2010-11-04 Thread Martín Mulone
+1 I just remove the header background with firebug, look very good without
the green.

For the submit button you can also use how is in the new welcome

input[type=submit], input[type=button], button {
margin: 0px;
/*width: 85px;*/
height: 22px;
background: #eaeaea;
color: #555;
border: 1px solid #dedede;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
}


2010/11/4 mdipierro 

> Just a tought...
>
> How about we make ALL sounded corners 3px and we use the button colors
> of stack overflow (edit in white/orange, site buttons in black/white,
> other buttons in white/gray)? We can also make the top bar gray as
> they do which is un-intrusive. We do not need a logo. People know
> where they are.
>
> Please no more changes to *.html (unless to fix bugs), only to
> style.css.
>
> Massimo
>
>
> On Nov 4, 7:18 am, Branko Vukelic  wrote:
> > On Thu, Nov 4, 2010 at 11:33 AM, Martin.Mulone 
> wrote:
> > > Thanks branko look very good.
> >
> > > Some little things
> >
> > > -less rounded in title headers?
> >
> > Maybe?
> >
> > > -the orange in "button edit" still killing my eyes?
> >
> > Maybe?
> >
> > > -"submit" button has no margins
> >
> > Submit button is an inline element, and it can't have margins, but
> > yeah, I know what you mean. I've talked to Massimo. The HTML for the
> > admin templates could use a lot of love. It would be nice if someone
> > could jump in aboard and help with that, too. I wouldn't mess with the
> > design any further until the HTML is completely revised and becomes
> > more pleasant to work with.
> >
> > > -Why not by default in edit => all collapsed ?
> >
> > Had the same thought, actually. The current way of closing an opening
> > the sections isn't very nice, and that could use some work, too.
> >
> > > -The font color in top menu orange with green background is not
> > > getting well, you tried with font white ?
> >
> > Yes, I have. It blends with the logo, so I didn't use it. Anyway,
> > orange with green works fine for me, so I guess this is a matter of
> > taste. Another "Maybe." Anyway, I guess cosmetic changes will have to
> > wait for HTML to be reworked.
> >
> > --
> > Branko Vukelić
> >
> > bg.bra...@gmail.com
> > stu...@brankovukelic.com
> >
> > Check out my blog:http://www.brankovukelic.com/
> > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > Registered Linux user #438078 (http://counter.li.org/)
> > I hang out on identi.ca:http://identi.ca/foxbunny
> >
> > Gimp Brushmakers Guildhttp://bit.ly/gbg-group
>



-- 
My blog: http://martin.tecnodoc.com.ar
My portfolio *spanish*: http://www.tecnodoc.com.ar
Checkout my last proyect instant-press: http://www.instant2press.com


[web2py] linked tables and dropdown display

2010-11-04 Thread andrej burja
hi

i have

db.define.table('basic'
Field('name1')
...)

db.define.table('advanced'
Field('name2',db.basic)
...)

db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')

db.define.table('data'
Field('something',db.advanced)
...)

db.data.something.requires=IS_IN_DB(db,'advanced.id','%(name2)s')


In the dropdown for data (in appadmin) i don't see name2, i see id
i would like to see name2, which is identical to name1
is this possible?


Re: [web2py] cron ignores PYTHONPATH

2010-11-04 Thread Jonathan Lundell
On Nov 3, 2010, at 10:34 PM, Jonathan Lundell wrote:
> 
> On Nov 3, 2010, at 8:45 PM, Leo wrote:
>> 
>> I am running web2py 1.88.2.
>> 
>> I have some modules I import that are not under the application's
>> directory. These are moduled developed for other projects.
>> 
>> Accessing the modules works fine within the app itself, since they are
>> on the PYTHONPATH. However, running the following cron command:
>> 
>> @reboot username **default/function
>> 
>> I get an ImportError:
>> 
>> ImportError: No module named mymodule.
>> 
>> Is this by design? Is there a workaround?
> 
> Did this ever work?
> 
> Are you using hardcron?
> 
> Conjecture: PYTHONPATH isn't in the environment of the shell that cron 
> launches.
> 
> Possible workaround: create a directory site-packages in the web2py root 
> (sibling of gluon) and create a link from site-packages/mymodule to the 
> actual location of mymodule.

Another possible workaround. Instead of putting PYTHONPATH directly into the 
environment, put PYTHONSTARTUP in the environment and do your path additions in 
the python startup (rc) file. 

Re: [web2py] Error in trunk with admin layout?

2010-11-04 Thread rochacbruno
+1

Enviado via iPhone

Em 04/11/2010, às 11:33, Seeker  escreveu:

> Hi,
> 
> In trunk:
> Not sure if i have done something wrong, but admin seems to be without
> a layout ...
> Anyone else experiencing this?
> 
> Thanks.


[web2py] Re: new admin layout

2010-11-04 Thread Anthony
Looks good. A few comments:
- At least on my screen, the orange text on white background is a bit
too light for comfortable reading (the same text actually looks a bit
too dark in the header, though sounds like we might change that
anyway).
- Need to work on the behavior and labeling of the "collapse" button.
It currently works as a toggle that reverses the current state of each
section (i.e., whichever sections are expanded collapse, and whichever
are collapsed expand). It would probably be better to have "collapse
all" and "expand all" behavior instead (i.e., regardless of the
current state of each section). In that case, the button text should
switch from "collapse" to "expand".
- When I click one of the buttons at the top of the design view for a
section that is not currently expanded, I expect it to expand (and
jump to) that section -- but it doesn't do the expanding, which makes
it appear to be non-functional.
- The "test" icon looks like a "danger" icon. Is that icon commonly
used to indicate testing? Maybe consider alternatives, or at least
include a tooltip to make it clear.
- That's a lot of bold red X's. What about replacing the delete and
test icons with small light-background text buttons (i.e., smaller
than the edit button)? Might look a little lighter.
- In the file lists, maybe consider listing all the subfolders either
at the top or the bottom (i.e., like a typical file explorer) rather
than interspersed alphabetically with the files. Also, when expanded,
maybe indent a bit to make it easier to see which files are in the
subfolder.

Thanks.

Anthony


On Nov 3, 11:21 pm, mdipierro  wrote:
> Here is the latest work by Branko (with minor edits by me):
>
>    http://web2py.com/demo_admin
>
> (also in trunk)
>
> This is the older one
>
>    http://web2py.com/demo_admin_halloween
>
> My edits are:
> 1) I have made all edit buttons orange
> 2) links files and no longer buttons (consistently with original
> version)
> 3) changed order from [file,edit,delete] to [edit,delete,file] since
> alignment is cleaner
> 4) moved all green links to right
>
> TODO:
> - I would prefer no shadow under icons.
> - Text like "No models" under design does not appear aligned properly.
>
> I really like this new admin.


[web2py] Re: linked tables and dropdown display

2010-11-04 Thread mdipierro
do this:

db.define.table('basic'
Field('name1')
...,format='%(name1)s')

db.define.table('advanced'
Field('name2',db.basic)
...,format='%(name2)s')

# db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s')

db.define.table('data'
Field('something',db.advanced)
...)


[web2py] Re: Error in trunk with admin layout?

2010-11-04 Thread mdipierro
Check if fixed.

On Nov 4, 9:17 am, rochacbruno  wrote:
> +1
>
> Enviado via iPhone
>
> Em 04/11/2010, às 11:33, Seeker  escreveu:
>
> > Hi,
>
> > In trunk:
> > Not sure if i have done something wrong, but admin seems to be without
> > a layout ...
> > Anyone else experiencing this?
>
> > Thanks.
>
>


Re: [web2py] CRON doesn't work

2010-11-04 Thread Vinicius Assef
Sverre, I think you must use your own application crontab, located at
applications/your_app/cron

I suggest you create a python script without any functions inside it,
to isolate your cron job, and put it in
applications/your_app/private/.
I do this here and it works nice.

Following my advice, your crontab would be like it:
*/2 * * * * root  *applications/your_app/private/test_cron.py

And your test_cron.py will have no def inside it.

--
Vinicius Assef.



On Thu, Nov 4, 2010 at 8:10 AM, Sverre  wrote:
> My cron tab looking like this
>
> #crontab
> */2 * * * *     root  *sys/test_cron
> @hourly          root  *applications/mm/cron/expire_sessions.py
>
> but this doesn' work. My test cron function is
>
> from time import ctime
> def test_cron():
>    db.dbg.insert(dbgmsg=ctime())
>    db.commit()
>    return "ready"
>
>
> If I trigger this function manually it's working. Web2Py is installed
> as a Windows Service. Is someone able to help?
>
>
>
>
>
>


[web2py] no-WWW in routes

2010-11-04 Thread Francisco Costa
Is there a way that we can route a website so that http://www.domain.com
redirect to http://domain.com
If you can't do this with routes how you can do it?


[web2py] Re: no-WWW in routes

2010-11-04 Thread mdipierro
Not with routes. Apache mod_rewrite

On Nov 4, 10:49 am, Francisco Costa  wrote:
> Is there a way that we can route a website so thathttp://www.domain.com
> redirect tohttp://domain.com
> If you can't do this with routes how you can do it?


[web2py] Re: CRON doesn't work

2010-11-04 Thread mdipierro
You can have a function but the script must call it:

from time import ctime
def test_cron():
db.dbg.insert(dbgmsg=ctime())
db.commit()
return "ready"
test_cron() #<<

On Nov 4, 10:24 am, Vinicius Assef  wrote:
> Sverre, I think you must use your own application crontab, located at
> applications/your_app/cron
>
> I suggest you create a python script without any functions inside it,
> to isolate your cron job, and put it in
> applications/your_app/private/.
> I do this here and it works nice.
>
> Following my advice, your crontab would be like it:
> */2 * * * *     root  *applications/your_app/private/test_cron.py
>
> And your test_cron.py will have no def inside it.
>
> --
> Vinicius Assef.
>
> On Thu, Nov 4, 2010 at 8:10 AM, Sverre  wrote:
> > My cron tab looking like this
>
> > #crontab
> > */2 * * * *     root  *sys/test_cron
> > @hourly          root  *applications/mm/cron/expire_sessions.py
>
> > but this doesn' work. My test cron function is
>
> > from time import ctime
> > def test_cron():
> >    db.dbg.insert(dbgmsg=ctime())
> >    db.commit()
> >    return "ready"
>
> > If I trigger this function manually it's working. Web2Py is installed
> > as a Windows Service. Is someone able to help?
>
>


[web2py] list:reference issue

2010-11-04 Thread Richard Vézina
Hello,

I get this error... I have no clue why I get it. I think it not coming from
my app :

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 188, in restricted
exec ccode in environment
  File "/home/www-data/web2py/applications/init/views/appadmin.html"
, line
192, in 
{{=form}}
  File "/home/www-data/web2py/gluon/sqlhtml.py", line 1273, in __init__
r = field.represent(r)
  File "/home/www-data/web2py/gluon/sql.py", line 518, in 
(ids and ', '.join(f(r,id) for id in ids) or '')
TypeError: sequence item 0: expected string, int found

Error snapshot*Detailed traceback description*

   - Exception: (sequence item 0: expected
   string, int found)
   - Python 2.6.4: /usr/bin/python

File /home/www-data/web2py/gluon/restricted.py in restricted at line 188[
code | arguments | variables ]File
/home/www-data/web2py/applications/init/views/appadmin.html in  at
line 192[ code | arguments | variables ]File
/home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 1273[ code |
arguments | variables ]File /home/www-data/web2py/gluon/sql.py in 
at line 518[ code | arguments | variables ]
*Function argument list: (ids=[9, 4], r=}>, f=)*

513.
514.
515.
516.
517.
518.

519.
520.
521.
522.

elif field._db and field_type.startswith('list:reference') and \
field_type.find('.') < 0 and \
field_type[15:] in field._db.tables:
referenced = field._db[field_type[15:]]
field.represent = lambda ids, r=referenced, f=ff: \
(ids and ', '.join(f(r,id) for id in ids) or '')

if hasattr(referenced, '_format') and referenced._format:
requires = validators.IS_IN_DB(field._db,referenced.id,
   referenced._format,multiple=True)
if field.unique:

*
*

*Richard*

*
*


Re: [web2py] Re: new admin layout

2010-11-04 Thread Branko Vukelic
There are always new cool ideas, and I'm sure all of us have more than
just a few of those. And I would LOVE to try all of them and see what
works. But then again, we could do it until we all die and never
finish. Why? Because there is no such thing as finished in graphic
design. Someone says "Wouldn't A be greater than B?" And we do A. Then
someone else comes along and says "I liked B better than A." Yet
another person comes up with "But have you guys seen C?" And we get a
few "Let's do X like Z does!" Rinse, repeat. And it's all good. The
product evolves. But not all at once! At some point you HAVE to
release. And not at the cost of sacrificing valuable time that can be
used for other issues...

...like the HTML?

The current version needs a lot of love. It is repetitive. The file
lists all work the same way, but we currently don't have much
abstraction in that area. It's not structured very well from time to
time.  For example, you have H1 and H2 used for both header AND the
in-page headings, no selectors for individual pages (like how do you
tell a difference between the  in tickets section, and the 
within the design section? Style-wize, it lacks some important bits
that enables me to work with sane amount of CSS. For example, most
block elements are omitted, and  is used for spacing. That's
just PITA. Heading levels are consistent, but consistently
inconsistent. So, those things need to be cleaned up, and I can do
much more once HTML starts to make more sense.

I'm not pointing fingers. I can and I will do the HTML myself. Point
is, I'd rather have it done next thing than later or never. And then
we can talk more design.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Re: new admin layout

2010-11-04 Thread Richard Vézina
Since we are in this process.

I would propose something, just a basic rule in design. I am not defending a
point here.

Having side by side edit and delete buttons is a bad design.

2 solutions :

1) Put a validation question on delete clic (ex.: would you really delete
the file XX).
2) No validation = put the delete button somewhere else where the user will
go just for this purpose.

So no risk to delete a file inadvertently.

I know there is the file.bak.

Richard


[web2py] Re: \sample markmin app

2010-11-04 Thread villas
That looks like a great combination with the editor!
Is Markitup going to be included as standard?

-D


[web2py] Re: no-WWW in routes

2010-11-04 Thread Francisco Costa
ok
I've added the following to my virtual-host

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


On 4 Nov, 16:22, mdipierro  wrote:
> Not with routes. Apache mod_rewrite
>
> On Nov 4, 10:49 am, Francisco Costa  wrote:
>
> > Is there a way that we can route a website so thathttp://www.domain.com
> > redirect tohttp://domain.com
> > If you can't do this with routes how you can do it?
>
>


[web2py] Re: list:reference issue

2010-11-04 Thread Richard Vézina
Ok I know what the problem has cause :

It seems that the new version is splitting id into single number :

35 = |3|5|
94 = |9|4|

Instead of :

94 = |94|

Richard

On Thu, Nov 4, 2010 at 12:33 PM, Richard Vézina  wrote:

> Hello,
>
> I get this error... I have no clue why I get it. I think it not coming from
> my app :
>
>  Traceback (most recent call last):
>
>   File "/home/www-data/web2py/gluon/restricted.py", line 188, in restricted
>
> exec ccode in environment
>
>   File "/home/www-data/web2py/applications/init/views/appadmin.html" 
> , line 192, in 
> 
>
> {{=form}}
>
>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1273, in __init__
>
> r = field.represent(r)
>
>   File "/home/www-data/web2py/gluon/sql.py", line 518, in 
>
> (ids and ', '.join(f(r,id) for id in ids) or '')
> TypeError: sequence item 0: expected string, int found
>
> Error snapshot*Detailed traceback description*
>
>- Exception: (sequence item 0: expected
>string, int found)
>- Python 2.6.4: /usr/bin/python
>
>  File /home/www-data/web2py/gluon/restricted.py in restricted at line 188
> [ code | arguments | variables ] File
> /home/www-data/web2py/applications/init/views/appadmin.html in  at
> line 192[ code | arguments | variables ] File
> /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 1273[ code |
> arguments | variables ] File /home/www-data/web2py/gluon/sql.py in
>  at line 518[ code | arguments | variables ]
> *Function argument list: (ids=[9, 4], r=  0xbb52a50c>}>, f=)*
>
> 513.
> 514.
>
> 515.
> 516.
>
> 517.
>
> 518.
>
> 519.
>
> 520.
> 521.
>
> 522.
>
> elif field._db and field_type.startswith('list:reference') and \
>
> field_type.find('.') < 0 and \
>
> field_type[15:] in field._db.tables:
>
> referenced = field._db[field_type[15:]]
>
> field.represent = lambda ids, r=referenced, f=ff: \
> (ids and ', '.join(f(r,id) for id in ids) or '')
>
> if hasattr(referenced, '_format') and referenced._format:
>
> requires = validators.IS_IN_DB(field._db,referenced.id,
>
>referenced._format,multiple=True)
>
> if field.unique:
>
> *
> *
>
> *Richard*
>
> *
> *
>
>


[web2py] How to make a dropbox in a create.form with IS_IN_DB and an join of multiple tables

2010-11-04 Thread demetrio
Hi everyone!

I'm doing an app with fullcalendar (http://arshaw.com/fullcalendar/)
and now i'm with all the events and calendar cruds.

Its time to add some logic to the crud.create() of the events, an only
let the user to add events in his/her calendars, not in ALL the
calendars.

I have this:

db.define_table('calendars',
Field('name', 'string', required=True, notnull=True),
#Field('project_id', 'reference', default=None, required=True),
format='%(name)s')

db.define_table('events',
Field('title', 'string', required=True, notnull=True,
label=T('Title')),
Field('place', 'string', label=T('Place')),
Field('description', 'text', label=T('Description')),
Field('init_date', 'datetime', required=True, label=T('Init
date')),
Field('end_date', 'datetime', required=True, label=T('End date')),
Field('calendar_id', 'reference calendars', label=T('Calendar')),
Field('all_day', 'boolean', default=False, required=True,
label=T('All day')),
format='%(title)s'
)


db.define_table('user_calendars',
Field('calendar', 'reference calendars', required=True,
notnull=True, label=T('Calendar')),
Field('color', 'string', default="blue", required=True,
label=T('Color')),
Field('fullcalendar_class', 'string', required=True,
writable=False, readable=False),
Field('permissions', 'string', required=True,
label=T('Permissions'), requires=IS_IN_SET(['r', 'rw', 'owner'],
zero=None)),
Field('user_id', 'reference auth_user', required=True,
notnull=True, label=T('User')),
format='')



With that model defined, in the events crud, will appear ALL the
calendars, so i have tried to do something like this:

def create():
query = ((db.user_calendars.calendar == db.calendars.id)  &
(db.user_calendars.user_id == auth.user.id)  &
((db.user_calendars.permissions =="owner") |
(db.user_calendars.permissions=="rw")))
db.events.calendar_id.requires =IS_IN_DB(db, query, zero=None )
return dict(form=crud.create(db.events))

And i found that the IS_IN_DB doesn't admit SQL queries xD

the query is something like: "give me all my calendars and the ones
where i can write"

Is there any "quick" and optimal solution to make all of this in the
controller? or i have to customize the crud form in the view?.

Thanks in advance!


[web2py] Re: new admin layout

2010-11-04 Thread mdipierro
There is a validation check but on a separate page. We can turn it
into a popup.

On Nov 4, 12:28 pm, Richard Vézina 
wrote:
> Since we are in this process.
>
> I would propose something, just a basic rule in design. I am not defending a
> point here.
>
> Having side by side edit and delete buttons is a bad design.
>
> 2 solutions :
>
> 1) Put a validation question on delete clic (ex.: would you really delete
> the file XX).
> 2) No validation = put the delete button somewhere else where the user will
> go just for this purpose.
>
> So no risk to delete a file inadvertently.
>
> I know there is the file.bak.
>
> Richard


[web2py] Re: \sample markmin app

2010-11-04 Thread mdipierro
it has been included for some time. You can use it via the MARKMIN
helper.

On Nov 4, 12:34 pm, villas  wrote:
> That looks like a great combination with the editor!
> Is Markitup going to be included as standard?
>
> -D


Re: [web2py] Re: new admin layout

2010-11-04 Thread Branko Vukelic
On Thu, Nov 4, 2010 at 7:22 PM, mdipierro  wrote:
> Point taken. If you feel you have the time to work a better html, I
> fully support that.

Great. :)

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


[web2py] Logical Delete instead of true delete of a record using crud.update

2010-11-04 Thread ggivler
I have a crud.update form that is deletable, I use the ondelete
callback function to mark the records as nonvalid, is there a way to
keep the record from being deleted after this?


[web2py] Re: \sample markmin app

2010-11-04 Thread Luther Goh Lu Feng
Very nice. How can one embed videos from youtube, vimeo, using
markmin?

On Nov 5, 2:25 am, mdipierro  wrote:
> it has been included for some time. You can use it via the MARKMIN
> helper.
>
> On Nov 4, 12:34 pm, villas  wrote:
>
>
>
>
>
>
>
> > That looks like a great combination with the editor!
> > Is Markitup going to be included as standard?
>
> > -D


[web2py] Re: new admin layout

2010-11-04 Thread mdipierro
Point taken. If you feel you have the time to work a better html, I
fully support that.

On Nov 4, 11:36 am, Branko Vukelic  wrote:
> There are always new cool ideas, and I'm sure all of us have more than
> just a few of those. And I would LOVE to try all of them and see what
> works. But then again, we could do it until we all die and never
> finish. Why? Because there is no such thing as finished in graphic
> design. Someone says "Wouldn't A be greater than B?" And we do A. Then
> someone else comes along and says "I liked B better than A." Yet
> another person comes up with "But have you guys seen C?" And we get a
> few "Let's do X like Z does!" Rinse, repeat. And it's all good. The
> product evolves. But not all at once! At some point you HAVE to
> release. And not at the cost of sacrificing valuable time that can be
> used for other issues...
>
> ...like the HTML?
>
> The current version needs a lot of love. It is repetitive. The file
> lists all work the same way, but we currently don't have much
> abstraction in that area. It's not structured very well from time to
> time.  For example, you have H1 and H2 used for both header AND the
> in-page headings, no selectors for individual pages (like how do you
> tell a difference between the  in tickets section, and the 
> within the design section? Style-wize, it lacks some important bits
> that enables me to work with sane amount of CSS. For example, most
> block elements are omitted, and  is used for spacing. That's
> just PITA. Heading levels are consistent, but consistently
> inconsistent. So, those things need to be cleaned up, and I can do
> much more once HTML starts to make more sense.
>
> I'm not pointing fingers. I can and I will do the HTML myself. Point
> is, I'd rather have it done next thing than later or never. And then
> we can talk more design.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


Re: [web2py] Re: Custom Authentication Template

2010-11-04 Thread Andrew Evans
hey ty very much :-)

On Wed, Nov 3, 2010 at 6:23 PM, mdipierro  wrote:

> errata
>
> views/default/user.html
>
> On Nov 3, 6:51 pm, Andrew Evans  wrote:
> > How can I implement my own html template for the authentication/login to
> use
> > throughout my site. I thought about redirecting it but that doesn't make
> > sense... any ideas
>


[web2py] Re: Logical Delete instead of true delete of a record using crud.update

2010-11-04 Thread mdipierro
hm. that breaks the workflow.

You should expose the nonvalid field (field.writable=True) and do a
crud.update(,deletable=False)

On Nov 4, 1:31 pm, ggivler  wrote:
> I have a crud.update form that is deletable, I use the ondelete
> callback function to mark the records as nonvalid, is there a way to
> keep the record from being deleted after this?


[web2py] Re: new admin layout

2010-11-04 Thread Anthony
Branko,

Again, thanks for all your efforts improving the Admin interface. Your
points are well taken, and I don't think anyone expects that all of
this feedback will be incorporated immediately (or even ever). We've
already made some very nice improvements over the old Admin, so
anything further is just icing on the cake.

Note, because we don't really have any structured process in place, I
think the tendency is to just chime in with any seemingly relevant
feedback while the topic is hot (i.e., while there's an active thread
going on the list) -- there will be no cue to do so, say, a week or a
month from now after something is released. I suppose this could
change, but we'd have to be more deliberate about it.

Anthony

On Nov 4, 12:36 pm, Branko Vukelic  wrote:
> There are always new cool ideas, and I'm sure all of us have more than
> just a few of those. And I would LOVE to try all of them and see what
> works. But then again, we could do it until we all die and never
> finish. Why? Because there is no such thing as finished in graphic
> design. Someone says "Wouldn't A be greater than B?" And we do A. Then
> someone else comes along and says "I liked B better than A." Yet
> another person comes up with "But have you guys seen C?" And we get a
> few "Let's do X like Z does!" Rinse, repeat. And it's all good. The
> product evolves. But not all at once! At some point you HAVE to
> release. And not at the cost of sacrificing valuable time that can be
> used for other issues...
>
> ...like the HTML?
>
> The current version needs a lot of love. It is repetitive. The file
> lists all work the same way, but we currently don't have much
> abstraction in that area. It's not structured very well from time to
> time.  For example, you have H1 and H2 used for both header AND the
> in-page headings, no selectors for individual pages (like how do you
> tell a difference between the  in tickets section, and the 
> within the design section? Style-wize, it lacks some important bits
> that enables me to work with sane amount of CSS. For example, most
> block elements are omitted, and  is used for spacing. That's
> just PITA. Heading levels are consistent, but consistently
> inconsistent. So, those things need to be cleaned up, and I can do
> much more once HTML starts to make more sense.
>
> I'm not pointing fingers. I can and I will do the HTML myself. Point
> is, I'd rather have it done next thing than later or never. And then
> we can talk more design.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


[web2py] Re: \sample markmin app

2010-11-04 Thread mdipierro
you can use plugin_wiki instead.
Of you can use markmin and define your own syntax. For example you can
do

extra = {'youtube': lambda code: "http://www.youtube.com/v/%s?
fs=1&hl=en_US">http://www.youtube.com/v/%s?fs=1&hl=en_US";
type="application/x-shockwave-flash" allowscriptaccess="always"
allowfullscreen="true" width="640" height="385">" %
(code,code)}

text = """

# here is a video

``l7AWnfFRc7g``:youtube

"""

html=MARMIN(text,extra)




On Nov 4, 1:31 pm, Luther Goh Lu Feng  wrote:
> Very nice. How can one embed videos from youtube, vimeo, using
> markmin?
>
> On Nov 5, 2:25 am, mdipierro  wrote:
>
> > it has been included for some time. You can use it via the MARKMIN
> > helper.
>
> > On Nov 4, 12:34 pm, villas  wrote:
>
> > > That looks like a great combination with the editor!
> > > Is Markitup going to be included as standard?
>
> > > -D
>
>


Re: [web2py] How to make a dropbox in a create.form with IS_IN_DB and an join of multiple tables

2010-11-04 Thread Richard Vézina
Hello!

I am very interresting in your dev.

I would like to help if possible.

Richard

On Thu, Nov 4, 2010 at 2:16 PM, demetrio  wrote:

> Hi everyone!
>
> I'm doing an app with fullcalendar (http://arshaw.com/fullcalendar/)
> and now i'm with all the events and calendar cruds.
>
> Its time to add some logic to the crud.create() of the events, an only
> let the user to add events in his/her calendars, not in ALL the
> calendars.
>
> I have this:
>
> db.define_table('calendars',
>Field('name', 'string', required=True, notnull=True),
>#Field('project_id', 'reference', default=None, required=True),
>format='%(name)s')
>
> db.define_table('events',
>Field('title', 'string', required=True, notnull=True,
> label=T('Title')),
>Field('place', 'string', label=T('Place')),
>Field('description', 'text', label=T('Description')),
>Field('init_date', 'datetime', required=True, label=T('Init
> date')),
>Field('end_date', 'datetime', required=True, label=T('End date')),
>Field('calendar_id', 'reference calendars', label=T('Calendar')),
>Field('all_day', 'boolean', default=False, required=True,
> label=T('All day')),
>format='%(title)s'
>)
>
>
> db.define_table('user_calendars',
>Field('calendar', 'reference calendars', required=True,
> notnull=True, label=T('Calendar')),
>Field('color', 'string', default="blue", required=True,
> label=T('Color')),
>Field('fullcalendar_class', 'string', required=True,
> writable=False, readable=False),
>Field('permissions', 'string', required=True,
> label=T('Permissions'), requires=IS_IN_SET(['r', 'rw', 'owner'],
> zero=None)),
>Field('user_id', 'reference auth_user', required=True,
> notnull=True, label=T('User')),
>format='')
>
>
>
> With that model defined, in the events crud, will appear ALL the
> calendars, so i have tried to do something like this:
>
> def create():
>query = ((db.user_calendars.calendar == db.calendars.id)  &
> (db.user_calendars.user_id == auth.user.id)  &
> ((db.user_calendars.permissions =="owner") |
> (db.user_calendars.permissions=="rw")))
>db.events.calendar_id.requires =IS_IN_DB(db, query, zero=None )
>return dict(form=crud.create(db.events))
>
> And i found that the IS_IN_DB doesn't admit SQL queries xD
>
> the query is something like: "give me all my calendars and the ones
> where i can write"
>
> Is there any "quick" and optimal solution to make all of this in the
> controller? or i have to customize the crud form in the view?.
>
> Thanks in advance!


[web2py] Re: \sample markmin app

2010-11-04 Thread David Marko
I cant download  the app using the provided link:
http://www.web2py.com/markmin/static/web2py.app.markmin.w2p

David

On 4 lis, 20:02, mdipierro  wrote:
> you can use plugin_wiki instead.
> Of you can use markmin and define your own syntax. For example you can
> do
>
> extra = {'youtube': lambda code: " height="385">http://www.youtube.com/v/%s?
> fs=1&hl=en_US"> value="true"> param>http://www.youtube.com/v/%s?fs=1&hl=en_US";
> type="application/x-shockwave-flash" allowscriptaccess="always"
> allowfullscreen="true" width="640" height="385">" %
> (code,code)}
>
> text = """
>
> # here is a video
>
> ``l7AWnfFRc7g``:youtube
>
> """
>
> html=MARMIN(text,extra)
>
> On Nov 4, 1:31 pm, Luther Goh Lu Feng  wrote:
>
>
>
>
>
>
>
> > Very nice. How can one embed videos from youtube, vimeo, using
> > markmin?
>
> > On Nov 5, 2:25 am, mdipierro  wrote:
>
> > > it has been included for some time. You can use it via the MARKMIN
> > > helper.
>
> > > On Nov 4, 12:34 pm, villas  wrote:
>
> > > > That looks like a great combination with the editor!
> > > > Is Markitup going to be included as standard?
>
> > > > -D


[web2py] Re: \sample markmin app

2010-11-04 Thread Luther Goh Lu Feng
This is an an excellent tip! I did not read this in the online book.
If it is not already in the book, please include it!

On Nov 5, 3:02 am, mdipierro  wrote:
> you can use plugin_wiki instead.
> Of you can use markmin and define your own syntax. For example you can
> do
>
> extra = {'youtube': lambda code: " height="385">http://www.youtube.com/v/%s?
> fs=1&hl=en_US"> value="true"> param>http://www.youtube.com/v/%s?fs=1&hl=en_US";
> type="application/x-shockwave-flash" allowscriptaccess="always"
> allowfullscreen="true" width="640" height="385">" %
> (code,code)}
>
> text = """
>
> # here is a video
>
> ``l7AWnfFRc7g``:youtube
>
> """
>
> html=MARMIN(text,extra)
>
> On Nov 4, 1:31 pm, Luther Goh Lu Feng  wrote:
>
>
>
>
>
>
>
> > Very nice. How can one embed videos from youtube, vimeo, using
> > markmin?
>
> > On Nov 5, 2:25 am, mdipierro  wrote:
>
> > > it has been included for some time. You can use it via the MARKMIN
> > > helper.
>
> > > On Nov 4, 12:34 pm, villas  wrote:
>
> > > > That looks like a great combination with the editor!
> > > > Is Markitup going to be included as standard?
>
> > > > -D


[web2py] Re: \sample markmin app

2010-11-04 Thread DenesL

Nice.

One problem with one of the menu icons though,
pressing on the numeric list produces a '+'
and it should be '+ '
otherwise you have to add the space manually
for the list to work.

The bulleted list does it right: '- '

On Nov 4, 8:09 am, mdipierro  wrote:
> http://www.web2py.com/markmin


[web2py] Straw poll on the learning curve of markmin for the layman

2010-11-04 Thread Luther Goh Lu Feng
Has anyone had experience implementing markin as part of text area
input? Do end users find markmin difficult? Personally, I find it very
user friendly, especially with http://www.web2py.com/markmin But then
again, I am a biased developer.

Any feedback on this?


Re: [web2py] Re: new admin layout

2010-11-04 Thread Branko Vukelic
On Thu, Nov 4, 2010 at 8:00 PM, Anthony  wrote:
> Branko,
>
> Again, thanks for all your efforts improving the Admin interface. Your
> points are well taken, and I don't think anyone expects that all of
> this feedback will be incorporated immediately (or even ever). We've
> already made some very nice improvements over the old Admin, so
> anything further is just icing on the cake.

I've got word from Massimo that this has to be ready for the
superocmputing 2010 presentation, so I won't go into anything
intricate unless it's needed. I'll discuss with Massimo what the goals
for the conference-worthiness might be. Cleaning up the HTML will be
my primary goal, and then we'll get something done for the show.

I've bookmarked this topic, and I'll most certainly come back to
review it once we are done with superocmputing 2010. :)

> Note, because we don't really have any structured process in place, I

Well, yeah. The structured process would involve using the app for a
while, and start with fixing the real problems. It's just like trying
to develop something in web2py in order to see if everything works. If
something really itches, ask for it to be scratched. If you can get
used to it, and it works, then it's probably not a problem to begin
with. And THEN we can talk about icing.

For example, if you find yourself clicking the delete button over and
over again, then you know for sure it's in a bad location. If it just
doesn't agree with your sense of aesthetics, well, I'll make it
prettier after the conference. :)

> think the tendency is to just chime in with any seemingly relevant
> feedback while the topic is hot (i.e., while there's an active thread
> going on the list) -- there will be no cue to do so, say, a week or a
> month from now after something is released. I suppose this could
> change, but we'd have to be more deliberate about it.

Yes, we can think of a way, sure. Gimp guys have an UI brainstorm
site, so we could probably make something like that for web2py.
Collecting user stories (descriptions of how people use the app) would
be most welcome, too. I've asked a few questions earlier in one of the
topics, but never got a reply.

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Re: \sample markmin app

2010-11-04 Thread rochacbruno
Very Nice!

I am a markmin fan

Would be good to render it live with ajax. 

Enviado via iPhone

Em 04/11/2010, às 17:35, mdipierro  escreveu:

> oops. please try againa.
> 
> On Nov 4, 2:10 pm, David Marko  wrote:
>> I cant download  the app using the provided 
>> link:http://www.web2py.com/markmin/static/web2py.app.markmin.w2p
>> 
>> David
>> 
>> On 4 lis, 20:02, mdipierro  wrote:
>> 
>>> you can use plugin_wiki instead.
>>> Of you can use markmin and define your own syntax. For example you can
>>> do
>> 
>>> extra = {'youtube': lambda code: ">> height="385">http://www.youtube.com/v/%s?
>>> fs=1&hl=en_US">>> value="true">>> param>http://www.youtube.com/v/%s?fs=1&hl=en_US";
>>> type="application/x-shockwave-flash" allowscriptaccess="always"
>>> allowfullscreen="true" width="640" height="385">" %
>>> (code,code)}
>> 
>>> text = """
>> 
>>> # here is a video
>> 
>>> ``l7AWnfFRc7g``:youtube
>> 
>>> """
>> 
>>> html=MARMIN(text,extra)
>> 
>>> On Nov 4, 1:31 pm, Luther Goh Lu Feng  wrote:
>> 
 Very nice. How can one embed videos from youtube, vimeo, using
 markmin?
>> 
 On Nov 5, 2:25 am, mdipierro  wrote:
>> 
> it has been included for some time. You can use it via the MARKMIN
> helper.
>> 
> On Nov 4, 12:34 pm, villas  wrote:
>> 
>> That looks like a great combination with the editor!
>> Is Markitup going to be included as standard?
>> 
>> -D
>> 
>> 


[web2py] Re: new admin layout

2010-11-04 Thread mdipierro
The conference talk is not on web2py but I will run examples using
web2py. Because of that I would like to release 1.89.1 next week. That
does not prevent us from making any more changes later. Yet, I would
not like to release something that is very different from the previous
version and too far from definitive. It will confuse new users.

On Nov 4, 2:38 pm, Branko Vukelic  wrote:
> On Thu, Nov 4, 2010 at 8:00 PM, Anthony  wrote:
> > Branko,
>
> > Again, thanks for all your efforts improving the Admin interface. Your
> > points are well taken, and I don't think anyone expects that all of
> > this feedback will be incorporated immediately (or even ever). We've
> > already made some very nice improvements over the old Admin, so
> > anything further is just icing on the cake.
>
> I've got word from Massimo that this has to be ready for the
> superocmputing 2010 presentation, so I won't go into anything
> intricate unless it's needed. I'll discuss with Massimo what the goals
> for the conference-worthiness might be. Cleaning up the HTML will be
> my primary goal, and then we'll get something done for the show.
>
> I've bookmarked this topic, and I'll most certainly come back to
> review it once we are done with superocmputing 2010. :)
>
> > Note, because we don't really have any structured process in place, I
>
> Well, yeah. The structured process would involve using the app for a
> while, and start with fixing the real problems. It's just like trying
> to develop something in web2py in order to see if everything works. If
> something really itches, ask for it to be scratched. If you can get
> used to it, and it works, then it's probably not a problem to begin
> with. And THEN we can talk about icing.
>
> For example, if you find yourself clicking the delete button over and
> over again, then you know for sure it's in a bad location. If it just
> doesn't agree with your sense of aesthetics, well, I'll make it
> prettier after the conference. :)
>
> > think the tendency is to just chime in with any seemingly relevant
> > feedback while the topic is hot (i.e., while there's an active thread
> > going on the list) -- there will be no cue to do so, say, a week or a
> > month from now after something is released. I suppose this could
> > change, but we'd have to be more deliberate about it.
>
> Yes, we can think of a way, sure. Gimp guys have an UI brainstorm
> site, so we could probably make something like that for web2py.
> Collecting user stories (descriptions of how people use the app) would
> be most welcome, too. I've asked a few questions earlier in one of the
> topics, but never got a reply.
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog:http://www.brankovukelic.com/
> Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca:http://identi.ca/foxbunny
>
> Gimp Brushmakers Guildhttp://bit.ly/gbg-group


[web2py] Re: \sample markmin app

2010-11-04 Thread mdipierro
oops. please try againa.

On Nov 4, 2:10 pm, David Marko  wrote:
> I cant download  the app using the provided 
> link:http://www.web2py.com/markmin/static/web2py.app.markmin.w2p
>
> David
>
> On 4 lis, 20:02, mdipierro  wrote:
>
> > you can use plugin_wiki instead.
> > Of you can use markmin and define your own syntax. For example you can
> > do
>
> > extra = {'youtube': lambda code: " > height="385">http://www.youtube.com/v/%s?
> > fs=1&hl=en_US"> > value="true"> > param>http://www.youtube.com/v/%s?fs=1&hl=en_US";
> > type="application/x-shockwave-flash" allowscriptaccess="always"
> > allowfullscreen="true" width="640" height="385">" %
> > (code,code)}
>
> > text = """
>
> > # here is a video
>
> > ``l7AWnfFRc7g``:youtube
>
> > """
>
> > html=MARMIN(text,extra)
>
> > On Nov 4, 1:31 pm, Luther Goh Lu Feng  wrote:
>
> > > Very nice. How can one embed videos from youtube, vimeo, using
> > > markmin?
>
> > > On Nov 5, 2:25 am, mdipierro  wrote:
>
> > > > it has been included for some time. You can use it via the MARKMIN
> > > > helper.
>
> > > > On Nov 4, 12:34 pm, villas  wrote:
>
> > > > > That looks like a great combination with the editor!
> > > > > Is Markitup going to be included as standard?
>
> > > > > -D
>
>


Re: [web2py] Re: new web2py appliance: File Manager

2010-11-04 Thread Massimiliano
Done.
Has been a good exercise.

How can I publish it?


-- 
Massimiliano

On Thu, Nov 4, 2010 at 2:22 AM, mdipierro  wrote:

> It should be easy to turn it into a plugin. Any takers?
>
> On Nov 3, 6:20 pm, yamandu  wrote:
> > Is there a way to integrate into my app?
> >
> > On Nov 3, 8:39 pm, mdipierro  wrote:
> >
> > > I just posted it. User Jeevan did it.
> >
> > > On Nov 3, 4:24 pm, Christopher Steel  wrote:
> >
> > > > Wow, this seems to work really well!
> >
> > > > Thanks!!! Great work
> >
> > > > On Nov 2, 6:09 pm, mdipierro  wrote:
> >
> > > > > This is CoreFive's Filemanager integrated with web2py. Also
> included
> > > > > ckeditor to edit text and html files.
> >
> > > > > Developed by Jeevan
> >
> > > > > License: BSD
> >
> > > > >http://web2py.com/appliances/default/show/70
> >
> >
>


[web2py] CRUD delete with user confirmation

2010-11-04 Thread baloan
Hello,

crud.delete(table, id) in 1.87.3 deletes the record right away. I'd
like to implement a view of the record (as produced by
crud.read(table, id) with a delete button in the bottom.

How would I implement this?

Regards, Andreas
balo...@gmail.com


[web2py] Re: list:reference issue

2010-11-04 Thread mdipierro
Can you please post the model, the controller and the steps to
reproduce the problem?

Massimo

On Nov 4, 3:29 pm, Richard Vézina  wrote:
> More input on the problem.
>
> It happen when the date validator is activated. The refresh form not expose
> the normal list field. I reproduce the problem with Chrome and Firefox
> systematically when the date is forgot and required by the model.
>
> I attach screenshot of the problem :
>
> Capture.png = when date validator is activated
>
> Capature-1.png = normal list selector field
>
> The main problem is that the id is splited.
>
> Richard
>
> On Thu, Nov 4, 2010 at 1:57 PM, Richard Vézina
> wrote:
>
> > Ok I know what the problem has cause :
>
> > It seems that the new version is splitting id into single number :
>
> > 35 = |3|5|
> > 94 = |9|4|
>
> > Instead of :
>
> > 94 = |94|
>
> > Richard
>
> > On Thu, Nov 4, 2010 at 12:33 PM, Richard Vézina <
> > ml.richard.vez...@gmail.com> wrote:
>
> >> Hello,
>
> >> I get this error... I have no clue why I get it. I think it not coming
> >> from my app :
>
> >>  Traceback (most recent call last):
>
> >>   File "/home/www-data/web2py/gluon/restricted.py", line 188, in restricted
>
> >>     exec ccode in environment
>
> >>   File "/home/www-data/web2py/applications/init/views/appadmin.html" 
> >> , line 192, 
> >> in 
>
> >>     {{=form}}
>
> >>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1273, in __init__
>
> >>     r = field.represent(r)
>
> >>   File "/home/www-data/web2py/gluon/sql.py", line 518, in 
>
> >>     (ids and ', '.join(f(r,id) for id in ids) or '')
>
> >> TypeError: sequence item 0: expected string, int found
>
> >>  Error snapshot*Detailed traceback description*
>
> >>    - Exception: (sequence item 0: expected
> >>    string, int found)
> >>    - Python 2.6.4: /usr/bin/python
>
> >>  File /home/www-data/web2py/gluon/restricted.py in restricted at line 188
> >> [ code | arguments | variables ] File
> >> /home/www-data/web2py/applications/init/views/appadmin.html in  at
> >> line 192[ code | arguments | variables ] File
> >> /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 1273[ code |
> >> arguments | variables ] File /home/www-data/web2py/gluon/sql.py in
> >>  at line 518[ code | arguments | variables ]
> >> *Function argument list: (ids=[9, 4], r= >>  >> 0xbb52a50c>}>, f=)*
>
> >> 513.
> >> 514.
>
> >> 515.
> >> 516.
>
> >> 517.
>
> >> 518.
>
> >> 519.
>
> >> 520.
> >> 521.
>
> >> 522.
>
> >>     elif field._db and field_type.startswith('list:reference') and \
>
> >>             field_type.find('.') < 0 and \
>
> >>             field_type[15:] in field._db.tables:
>
> >>         referenced = field._db[field_type[15:]]
>
> >>         field.represent = lambda ids, r=referenced, f=ff: \
>
> >>             (ids and ', '.join(f(r,id) for id in ids) or '')
>
> >>         if hasattr(referenced, '_format') and referenced._format:
>
> >>             requires = validators.IS_IN_DB(field._db,referenced.id,
>
> >>                                            
> >> referenced._format,multiple=True)
>
> >>             if field.unique:
>
> >> *
> >> *
>
> >> *Richard*
>
> >> *
> >> *
>
>
>
>  Capture.png
> 10KViewDownload
>
>  Capture-1.png
> 12KViewDownload


[web2py] Re: new web2py appliance: File Manager

2010-11-04 Thread mdipierro
email email email. :-)

On Nov 4, 3:20 pm, Massimiliano  wrote:
> Done.
> Has been a good exercise.
>
> How can I publish it?
>
> --
> Massimiliano
>
> On Thu, Nov 4, 2010 at 2:22 AM, mdipierro  wrote:
> > It should be easy to turn it into a plugin. Any takers?
>
> > On Nov 3, 6:20 pm, yamandu  wrote:
> > > Is there a way to integrate into my app?
>
> > > On Nov 3, 8:39 pm, mdipierro  wrote:
>
> > > > I just posted it. User Jeevan did it.
>
> > > > On Nov 3, 4:24 pm, Christopher Steel  wrote:
>
> > > > > Wow, this seems to work really well!
>
> > > > > Thanks!!! Great work
>
> > > > > On Nov 2, 6:09 pm, mdipierro  wrote:
>
> > > > > > This is CoreFive's Filemanager integrated with web2py. Also
> > included
> > > > > > ckeditor to edit text and html files.
>
> > > > > > Developed by Jeevan
>
> > > > > > License: BSD
>
> > > > > >http://web2py.com/appliances/default/show/70
>
>


[web2py] Re: CRUD delete with user confirmation

2010-11-04 Thread mdipierro
for field in table: field.writable=False
form = crud.update(table, id)

On Nov 4, 3:28 pm, baloan  wrote:
> Hello,
>
> crud.delete(table, id) in 1.87.3 deletes the record right away. I'd
> like to implement a view of the record (as produced by
> crud.read(table, id) with a delete button in the bottom.
>
> How would I implement this?
>
> Regards, Andreas
> balo...@gmail.com


[web2py] Re: Hyperlink urls in comments

2010-11-04 Thread howesc
Annet,

I suspect that this problem has more to do with HTML email, or how
your email client guesses what are links in text based email.  i
believe that by default the request_reset_password sends a text-only
email with no HTML markup.  though most clients will recognize http://
as a URL and highlight it as such (i know thunderbird does, and i'm
pretty sure pine does, though clicking on a link in pine is hard. -
i'm way old skool and read all of my mail as text only)

i have not yet tried to send HTML formated mail for the auth methods,
but i suspect that is what you are looking to do.

cfh

On Nov 4, 12:49 am, annet  wrote:
> Hi Bruno,
>
> > The easy way to render the 'http://' urls in web2py, is using markmin.
>
> > lets say you have a text
>
> > text = "ths is a text with a linkhttp://www.rochacbruno.com.br";
>
> > To render the link as an Hyperlink you can use markmin.
>
> > {{=MARKMIN(text)}}
>
> On October 15 I posted the following message:
>
> "While testing my cms application I found that the link in the mail
> send by the request_reset_password function isn't clickable, the user
> has to copy and paste the link into the browser. Am I the only one
> experiencing this? Is there a way to solve this problem?"
>
> Could this problem be solved using markmin?
>
> Regards,
>
> Annet


[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
This is my feeble attempt at the problem - but it does the job:

def index():
add_submenu()
headers = {'email.id': A('Id',
_href=URL(vars=dict(orderby='id'))),
   'email.email': A('Email address',
_href=URL(vars=dict(orderby='email'))),
   'email.active':A('Active',
_href=URL(vars=dict(orderby='active'))),
   'email.expires':A('Expires',
_href=URL(vars=dict(orderby='expires'))),
   'email.change_user':A('Changed by',
_href=URL(vars=dict(orderby='change_user'))),
   'email.change_date':A('Changed on',
_href=URL(vars=dict(orderby='change_date'))),
}
if 'email_orderby' not in session:
session.email_orderby = ['asc', 'email']
if 'orderby' in request.vars:
if session.email_orderby[1] == request.vars.orderby:
if session.email_orderby[0] == 'asc':
session.email_orderby[0] = 'desc'
else:
session.email_orderby[0] = 'asc'
else:
session.email_orderby = ['asc', request.vars.orderby]
key = db.email[session.email_orderby[1]]
if session.email_orderby[0] == 'asc':
emails = crud.select(db.email, headers=headers, orderby=key)
else:
emails = crud.select(db.email, headers=headers, orderby= ~key)
return dict(emails=emails)

I don't like it - it looks ugly. Who can make it look more elegant?

Best regards, Andreas
balo...@gmail.com


[web2py] Re: How to make a dropbox in a create.form with IS_IN_DB and an join of multiple tables

2010-11-04 Thread howesc
your problem is where you put the query in the IS_IN_DB.  try
modifying to put the query in the first spot.  something like:

 requires=IS_IN_DB(db((db.file_asset.type ==
db.file_asset_type.id) &
 
(db.file_asset_type.name=='Album Art')),
   db.file_asset.id, '%
(name)s')),

(no that is not from your example, but a clipping from one of my
models)

cfh


On Nov 4, 11:16 am, demetrio  wrote:
> Hi everyone!
>
> I'm doing an app with fullcalendar (http://arshaw.com/fullcalendar/)
> and now i'm with all the events and calendar cruds.
>
> Its time to add some logic to the crud.create() of the events, an only
> let the user to add events in his/her calendars, not in ALL the
> calendars.
>
> I have this:
>
> db.define_table('calendars',
>     Field('name', 'string', required=True, notnull=True),
>     #Field('project_id', 'reference', default=None, required=True),
>     format='%(name)s')
>
> db.define_table('events',
>     Field('title', 'string', required=True, notnull=True,
> label=T('Title')),
>     Field('place', 'string', label=T('Place')),
>     Field('description', 'text', label=T('Description')),
>     Field('init_date', 'datetime', required=True, label=T('Init
> date')),
>     Field('end_date', 'datetime', required=True, label=T('End date')),
>     Field('calendar_id', 'reference calendars', label=T('Calendar')),
>     Field('all_day', 'boolean', default=False, required=True,
> label=T('All day')),
>     format='%(title)s'
>     )
>
> db.define_table('user_calendars',
>     Field('calendar', 'reference calendars', required=True,
> notnull=True, label=T('Calendar')),
>     Field('color', 'string', default="blue", required=True,
> label=T('Color')),
>     Field('fullcalendar_class', 'string', required=True,
> writable=False, readable=False),
>     Field('permissions', 'string', required=True,
> label=T('Permissions'), requires=IS_IN_SET(['r', 'rw', 'owner'],
> zero=None)),
>     Field('user_id', 'reference auth_user', required=True,
> notnull=True, label=T('User')),
>     format='')
>
> With that model defined, in the events crud, will appear ALL the
> calendars, so i have tried to do something like this:
>
> def create():
>     query = ((db.user_calendars.calendar == db.calendars.id)  &
> (db.user_calendars.user_id == auth.user.id)  &
> ((db.user_calendars.permissions =="owner") |
> (db.user_calendars.permissions=="rw")))
>     db.events.calendar_id.requires =IS_IN_DB(db, query, zero=None )
>     return dict(form=crud.create(db.events))
>
> And i found that the IS_IN_DB doesn't admit SQL queries xD
>
> the query is something like: "give me all my calendars and the ones
> where i can write"
>
> Is there any "quick" and optimal solution to make all of this in the
> controller? or i have to customize the crud form in the view?.
>
> Thanks in advance!


[web2py] Re: CRUD delete with user confirmation

2010-11-04 Thread baloan
I am using crud.update() as well. The next time I use crud.update() I
have to restore the original settings for all field.writeable in
table. Correct?

Regards, Andreas

On Nov 4, 9:34 pm, mdipierro  wrote:
> for field in table: field.writable=False
> form = crud.update(table, id)
>
> On Nov 4, 3:28 pm, baloan  wrote:
>
> > Hello,
>
> > crud.delete(table, id) in 1.87.3 deletes the record right away. I'd
> > like to implement a view of the record (as produced by
> > crud.read(table, id) with a delete button in the bottom.
>
> > How would I implement this?
>
> > Regards, Andreas
> > balo...@gmail.com
>
>


[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
When I say ugly I mean:
1. too much duplication,
2. too much boilerplate code.

Just imagine what happens if I apply my solution to more than a few
tables.

Regards, Andreas

On Nov 4, 10:00 pm, baloan  wrote:
> This is my feeble attempt at the problem - but it does the job:
>
> def index():
>     add_submenu()
>     headers = {'email.id': A('Id',
> _href=URL(vars=dict(orderby='id'))),
>                'email.email': A('Email address',
> _href=URL(vars=dict(orderby='email'))),
>                'email.active':A('Active',
> _href=URL(vars=dict(orderby='active'))),
>                'email.expires':A('Expires',
> _href=URL(vars=dict(orderby='expires'))),
>                'email.change_user':A('Changed by',
> _href=URL(vars=dict(orderby='change_user'))),
>                'email.change_date':A('Changed on',
> _href=URL(vars=dict(orderby='change_date'))),
>     }
>     if 'email_orderby' not in session:
>         session.email_orderby = ['asc', 'email']
>     if 'orderby' in request.vars:
>         if session.email_orderby[1] == request.vars.orderby:
>             if session.email_orderby[0] == 'asc':
>                 session.email_orderby[0] = 'desc'
>             else:
>                 session.email_orderby[0] = 'asc'
>         else:
>             session.email_orderby = ['asc', request.vars.orderby]
>     key = db.email[session.email_orderby[1]]
>     if session.email_orderby[0] == 'asc':
>         emails = crud.select(db.email, headers=headers, orderby=key)
>     else:
>         emails = crud.select(db.email, headers=headers, orderby= ~key)
>     return dict(emails=emails)
>
> I don't like it - it looks ugly. Who can make it look more elegant?
>
> Best regards, Andreas
> balo...@gmail.com


[web2py] TAG colon problem

2010-11-04 Thread Francisco Costa
I'm trying to do a sitemap for my site.
The thing is that when I set

sitemap=TAG.urlset(_xmlns='http://www.sitemaps.org/schemas/sitemap/
0.9', _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";)

the xmlns:xsi gives error because of the colon (:)
Is there any way that i can change this?


[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
An updated attempt:

def index():
# create header column links
headers = dict()
for col in db.email_archive.fields:
headers['email_archive.' + col] = A(col,
_href=URL(vars=dict(orderby=col)))
# manage sort order
if 'email_archive_orderby' not in session:
session.email_archive_orderby = ['desc', 'id']
if 'orderby' in request.vars:
if session.email_archive_orderby[1] == request.vars.orderby:
if session.email_archive_orderby[0] == 'asc':
session.email_archive_orderby[0] = 'desc'
else:
session.email_archive_orderby[0] = 'asc'
else:
session.email_archive_orderby = ['asc',
request.vars.orderby]
# convert to DAL orderby
key = db.email_archive[session.email_archive_orderby[1]]
if session.email_archive_orderby[0] == 'desc':
key = ~key
emails = crud.select(db.email_archive, headers=headers,
orderby=key)
return dict(emails=emails)

On Nov 4, 10:06 pm, baloan  wrote:
> When I say ugly I mean:
> 1. too much duplication,
> 2. too much boilerplate code.
>
> Just imagine what happens if I apply my solution to more than a few
> tables.
>
> Regards, Andreas
>
> On Nov 4, 10:00 pm, baloan  wrote:
>
> > This is my feeble attempt at the problem - but it does the job:
>
> > def index():
> >     add_submenu()
> >     headers = {'email.id': A('Id',
> > _href=URL(vars=dict(orderby='id'))),
> >                'email.email': A('Email address',
> > _href=URL(vars=dict(orderby='email'))),
> >                'email.active':A('Active',
> > _href=URL(vars=dict(orderby='active'))),
> >                'email.expires':A('Expires',
> > _href=URL(vars=dict(orderby='expires'))),
> >                'email.change_user':A('Changed by',
> > _href=URL(vars=dict(orderby='change_user'))),
> >                'email.change_date':A('Changed on',
> > _href=URL(vars=dict(orderby='change_date'))),
> >     }
> >     if 'email_orderby' not in session:
> >         session.email_orderby = ['asc', 'email']
> >     if 'orderby' in request.vars:
> >         if session.email_orderby[1] == request.vars.orderby:
> >             if session.email_orderby[0] == 'asc':
> >                 session.email_orderby[0] = 'desc'
> >             else:
> >                 session.email_orderby[0] = 'asc'
> >         else:
> >             session.email_orderby = ['asc', request.vars.orderby]
> >     key = db.email[session.email_orderby[1]]
> >     if session.email_orderby[0] == 'asc':
> >         emails = crud.select(db.email, headers=headers, orderby=key)
> >     else:
> >         emails = crud.select(db.email, headers=headers, orderby= ~key)
> >     return dict(emails=emails)
>
> > I don't like it - it looks ugly. Who can make it look more elegant?
>
> > Best regards, Andreas
> > balo...@gmail.com
>
>


[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread baloan
Final attempt. Much better now. web2py is cool!

def history():
headers, key = auto_orderby(db.email_archive,
default_order=('desc', 'id'))
emails = crud.select(db.email_archive, headers=headers,
orderby=key, limitby=(0, 50))
return dict(emails=emails)

def auto_orderby(dal_table, default_order=None):
'''
Creates headers and key for crud.select() tables.

@param tablename:  dal table
@param default_order:  ('asc'|'desc', column_name)
'''
tablename = dal_table._tablename
orderby_key = tablename + '_orderby'
if default_order is None:
default_order = ('asc', 'id')
# create header column links
headers = dict()
for col in dal_table.fields:
headers[tablename + '.' + col] = A(col,
_href=URL(vars=dict(orderby=col)))
# manage sort order
if orderby_key not in session:
session[orderby_key] = list(default_order)
if 'orderby' in request.vars:
if session[orderby_key][1] == request.vars.orderby:
if session[orderby_key][0] == 'asc':
session[orderby_key][0] = 'desc'
else:
session[orderby_key][0] = 'asc'
else:
session[orderby_key] = ['asc', request.vars.orderby]
# convert to DAL orderby
key = db.email_archive[session[orderby_key][1]]
if session[orderby_key][0] == 'desc':
key = ~key
return (headers, key)

Any suggestions for improvement?

Regards, Andreas


On Nov 4, 10:19 pm, baloan  wrote:
> An updated attempt:
>
> def index():
>     # create header column links
>     headers = dict()
>     for col in db.email_archive.fields:
>         headers['email_archive.' + col] = A(col,
> _href=URL(vars=dict(orderby=col)))
>     # manage sort order
>     if 'email_archive_orderby' not in session:
>         session.email_archive_orderby = ['desc', 'id']
>     if 'orderby' in request.vars:
>         if session.email_archive_orderby[1] == request.vars.orderby:
>             if session.email_archive_orderby[0] == 'asc':
>                 session.email_archive_orderby[0] = 'desc'
>             else:
>                 session.email_archive_orderby[0] = 'asc'
>         else:
>             session.email_archive_orderby = ['asc',
> request.vars.orderby]
>     # convert to DAL orderby
>     key = db.email_archive[session.email_archive_orderby[1]]
>     if session.email_archive_orderby[0] == 'desc':
>         key = ~key
>     emails = crud.select(db.email_archive, headers=headers,
> orderby=key)
>     return dict(emails=emails)
>
> On Nov 4, 10:06 pm, baloan  wrote:
>
> > When I say ugly I mean:
> > 1. too much duplication,
> > 2. too much boilerplate code.
>
> > Just imagine what happens if I apply my solution to more than a few
> > tables.
>
> > Regards, Andreas
>
> > On Nov 4, 10:00 pm, baloan  wrote:
>
> > > This is my feeble attempt at the problem - but it does the job:
>
> > > def index():
> > >     add_submenu()
> > >     headers = {'email.id': A('Id',
> > > _href=URL(vars=dict(orderby='id'))),
> > >                'email.email': A('Email address',
> > > _href=URL(vars=dict(orderby='email'))),
> > >                'email.active':A('Active',
> > > _href=URL(vars=dict(orderby='active'))),
> > >                'email.expires':A('Expires',
> > > _href=URL(vars=dict(orderby='expires'))),
> > >                'email.change_user':A('Changed by',
> > > _href=URL(vars=dict(orderby='change_user'))),
> > >                'email.change_date':A('Changed on',
> > > _href=URL(vars=dict(orderby='change_date'))),
> > >     }
> > >     if 'email_orderby' not in session:
> > >         session.email_orderby = ['asc', 'email']
> > >     if 'orderby' in request.vars:
> > >         if session.email_orderby[1] == request.vars.orderby:
> > >             if session.email_orderby[0] == 'asc':
> > >                 session.email_orderby[0] = 'desc'
> > >             else:
> > >                 session.email_orderby[0] = 'asc'
> > >         else:
> > >             session.email_orderby = ['asc', request.vars.orderby]
> > >     key = db.email[session.email_orderby[1]]
> > >     if session.email_orderby[0] == 'asc':
> > >         emails = crud.select(db.email, headers=headers, orderby=key)
> > >     else:
> > >         emails = crud.select(db.email, headers=headers, orderby= ~key)
> > >     return dict(emails=emails)
>
> > > I don't like it - it looks ugly. Who can make it look more elegant?
>
> > > Best regards, Andreas
> > > balo...@gmail.com
>
>


[web2py] Re: new admin layout

2010-11-04 Thread Christopher Steel
Nice work, looks great!

I really like the flow that is starting to happen when resizing the
browser window. Makes me want to try it from my iphone...

Chris


On Nov 1, 10:12 pm, mdipierro  wrote:
> I can make this stable tomorrow if no objections.
>
> Massimo
>
> On Nov 1, 9:10 pm, "mr.freeze"  wrote:
>
> > Looks more Ubuntu than Halloween to me. I like it.
>
> > On Nov 1, 8:46 pm, mdipierro  wrote:
>
> > > For now I am putting this in. I like the logic of it. I made some
> > > minor changes. I am not so sure about the Halloween colors. What do
> > > other people think?
>
> > > Massimo
>
> > > On Nov 1, 5:25 pm, Branko Vukelic  wrote:
>
> > > > Massimo,
>
> > > > So I've cloned the HG repo and I've done my magic on the files. Would
> > > > the contents of ``hg diff`` be useful to you? Anyway, it's attached,
> > > > so please tell me if that's what you need. Also, some binary assets
> > > > (icons).
>
> > > > It's not complete. I'm sure some sections could use more work. I'll do
> > > > that some other time, though. Too tired now.
>
> > > > On Mon, Nov 1, 2010 at 10:11 PM, Branko Vukelic  
> > > > wrote:
> > > > > On Mon, Nov 1, 2010 at 10:10 PM, Branko Vukelic  
> > > > > wrote:
> > > > >> how to style the browser button. Does anyone have an idea? Failing
>
> > > > > I meant the 'Browse' button.
>
> > > > > --
> > > > > Branko Vukelić
>
> > > > > bg.bra...@gmail.com
> > > > > stu...@brankovukelic.com
>
> > > > > Check out my blog:http://www.brankovukelic.com/
> > > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > > I hang out on identi.ca:http://identi.ca/foxbunny
>
> > > > > Gimp Brushmakers Guild
> > > > >http://bit.ly/gbg-group
>
> > > > --
> > > > Branko Vukelić
>
> > > > bg.bra...@gmail.com
> > > > stu...@brankovukelic.com
>
> > > > Check out my blog:http://www.brankovukelic.com/
> > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > I hang out on identi.ca:http://identi.ca/foxbunny
>
> > > > Gimp Brushmakers Guildhttp://bit.ly/gbg-group
>
> > > >  folder.gif
> > > > < 1KViewDownload
>
> > > >  folder_current.gif
> > > > < 1KViewDownload
>
> > > >  folder_sm.gif
> > > > < 1KViewDownload
>
> > > >  heading_bg.png
> > > > < 1KViewDownload
>
> > > >  new_admin.diff
> > > > 21KViewDownload
>
>


[web2py] Re: \sample markmin app

2010-11-04 Thread mikech
++
DZoned it!

On Nov 4, 6:09 am, mdipierro  wrote:
> http://www.web2py.com/markmin


[web2py] Re: Straw poll on the learning curve of markmin for the layman

2010-11-04 Thread Christopher Steel
We love Markmin. It is tiny, easy to use and logical. It is similar to
Markdown which is pretty nice, but Markmin covers what people actually
use in a way that makes markup look good in itself.

As an added bonus it is totally readable as a text file so everyone,
including one of our board members who happens to be blind, can edit,
create and update markmin documents.

I think it has world changing possibilities...

and Massimo(?) just posted an example app -> http://www.web2py.com/markmin


On Nov 4, 3:20 pm, Luther Goh Lu Feng  wrote:
> Has anyone had experience implementing markin as part of text area
> input? Do end users find markmin difficult? Personally, I find it very
> user friendly, especially withhttp://www.web2py.com/markminBut then
> again, I am a biased developer.
>
> Any feedback on this?


[web2py] Re: web2py as a cross-platform mobile application platform

2010-11-04 Thread Christopher Steel
Sweet! Thanks Martin. I am going to check it out!

Chris.

On Nov 3, 6:49 pm, Martín Mulone  wrote:
> Yes, the new welcome is based in htmlboilerplate and has some things for
> mobile but you have to test and make proper changes to
> static/css/handheld.css and not all mobiles support media="handheld". Other
> thing is the new jquery has improvements for mobile. Also there are a new
> project in alphahttp://jquerymobile.com.
>
> 2010/11/3 mdipierro 
>
>
>
> > There is something in the new welcome in trunk. Martin did it. I am
> > not sure what it does thou.
>
> > On Nov 3, 4:16 pm, Christopher Steel  wrote:
> > > Anyone know if someone has setup Web2py with device detection and/or
> > > created a mobile.css for web2py display on small displays?
>
> > > Chris
>
> > > On Nov 3, 2:21 am, Johann Spies  wrote:
>
> > > > It runs on the Nokia N900.
>
> > > > Regards
> > > > Johann
> > > > --
> > > >  May grace and peace be yours in abundance through the full knowledge
> > > > of God and of Jesus our Lord!  His divine power has given us
> > > > everything we need for life and godliness through the full knowledge
> > > > of the one who called us by his own glory and excellence.
> > > >                                                     2 Pet. 1:2b,3a
>
> --
> My blog:http://martin.tecnodoc.com.ar
> My portfolio *spanish*:http://www.tecnodoc.com.ar
> Checkout my last proyect instant-press:http://www.instant2press.com


Re: [web2py] Re: Straw poll on the learning curve of markmin for the layman

2010-11-04 Thread rochacbruno
I am a markmin fan, I wrote An. Entire book in markmin. 

Very rapid 

Enviado via iPhone

Em 04/11/2010, às 20:15, Christopher Steel  escreveu:

> We love Markmin. It is tiny, easy to use and logical. It is similar to
> Markdown which is pretty nice, but Markmin covers what people actually
> use in a way that makes markup look good in itself.
> 
> As an added bonus it is totally readable as a text file so everyone,
> including one of our board members who happens to be blind, can edit,
> create and update markmin documents.
> 
> I think it has world changing possibilities...
> 
> and Massimo(?) just posted an example app -> http://www.web2py.com/markmin
> 
> 
> On Nov 4, 3:20 pm, Luther Goh Lu Feng  wrote:
>> Has anyone had experience implementing markin as part of text area
>> input? Do end users find markmin difficult? Personally, I find it very
>> user friendly, especially withhttp://www.web2py.com/markminBut then
>> again, I am a biased developer.
>> 
>> Any feedback on this?


[web2py] SQLFORM submission issue

2010-11-04 Thread Vidul Petrov
Hi all,

I am trying to use a form which does not redirect after its
acceptance.
However after the submit the new form does not pass through:

 if form.accepts(request.vars, session):
   ...
 elsif form.errors:
   ...
unless the page is reloaded.
Is this the expected behavior?


[web2py] Re: TAG colon problem

2010-11-04 Thread Francisco Costa
is this a bug or a python issue?

On 4 Nov, 21:12, Francisco Costa  wrote:
> I'm trying to do a sitemap for my site.
> The thing is that when I set
>
> sitemap=TAG.urlset(_xmlns='http://www.sitemaps.org/schemas/sitemap/
> 0.9', _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";)
>
> the xmlns:xsi gives error because of the colon (:)
> Is there any way that i can change this?


[web2py] Re: GAE GQL count patch

2010-11-04 Thread Richard
my only concern would be timeouts for large tables


On Nov 4, 11:39 am, howesc  wrote:
> Massimo and others,
>
> Google claims that count() does not have an enforced limit, though
> they have mis-documented the feature.  
> seehttp://code.google.com/p/googleappengine/issues/detail?id=4001if you
> are curious.  in order to get count to be truly limitless, you need to
> pass limit=None to count.  Now, i like my count to really be my count
> so i would like to change line 772 of gql.py from:
>             return items.count()
> to:
>             return items.count(limit=None)
>
> I know that when my count is greater than the default limit of 1000
> that google says it might be slow, but i think an accurate count is
> more correct than a fast one.
>
> thoughts?  if you agree do you mind updating gql.py?
>
> thanks,
>
> christian


[web2py] Re: SQLFORM submission issue

2010-11-04 Thread Vidul Petrov
It was my error, which have nothing to do with Web2py.
There is no such issue.

On Nov 5, 12:36 am, Vidul Petrov  wrote:
> Hi all,
>
> I am trying to use a form which does not redirect after its
> acceptance.
> However after the submit the new form does not pass through:
>
>  if form.accepts(request.vars, session):
>    ...
>  elsif form.errors:
>    ...
> unless the page is reloaded.
> Is this the expected behavior?


[web2py] Re: new welcome app in trunk but minor problem...

2010-11-04 Thread Richard
Love the new welcome app design.


Instead of developing flash further how about just using jgrowl
instead.

> It requires downloading 3 more files and the advantages are minimal.

I think the advantages are worthwhile and the extra files do not
matter if they are stored in sub-folders to avoid clutter.



On Nov 4, 5:27 am, mdipierro  wrote:
> One thing we can do is a FLASH helper that allows:
>
> response.flash=flash('test',mode='warn')
>
> This is already in the new welcome app but we could promote flash to a
> FLASH helper.  Pros? Cons?
> It would link a helper to some image static files that may not be
> there.
>
> We could add some JS code insider that can reposition it but I do not
> think that is a good idea. The position should be fixed and determined
> by the CSS.
>
> Massimo
>
> On Nov 3, 12:09 pm, rochacbruno  wrote:
>
> > Would be a good idea to have more options for flash.
>
> > I.e: response.flash('hello world',position='top-right')
>
> > Enviado via iPhone
>
> > Em 03/11/2010, às 14:56, Martín Mulone  escreveu:
>
> > > Massimo I think welcome is broken in trunk, there no files in views/ :O
>
> > > Often the user does not notice that something has just appeared in the 
> > > flash box
>
> > > Perhaps a variation of flash 'silen', that goes like an application 
> > > statusbar, on bottom and thin.
>
> > > 2010/11/3 mdipierro 
> > > I think this is fixed and layouts now work with both old welcome and
> > > new welcome.
>
> > > Can somebody try it please?
>
> > > Just install one random layout (old welcome and new welcome) and use
> > > firebug to make sure superfish.js is found.
>
> > > Massimo
>
> > > On Nov 3, 4:37 am, Branko Vukelic  wrote:
> > > > On Wed, Nov 3, 2010 at 6:00 AM, mdipierro  
> > > > wrote:
> > > > > We have two solutions:
> > > > > 1) change all layouts w2p files to look for superfish in static/ or in
> > > > > static/js
> > > > > 2) move all the current static files in static/ and our of static/css,
> > > > > static/js, static/images/.
>
> > > > > Probably 1) is a better option.
>
> > > > If you can customize it anyway you want in a custom template, I really
> > > > see no problem with 1).
>
> > > > --
> > > > Branko Vukelić
>
> > > > bg.bra...@gmail.com
> > > > stu...@brankovukelic.com
>
> > > > Check out my blog:http://www.brankovukelic.com/
> > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > I hang out on identi.ca:http://identi.ca/foxbunny
>
> > > > Gimp Brushmakers Guildhttp://bit.ly/gbg-group
>
> > > --
> > > My blog:http://martin.tecnodoc.com.ar
> > > My portfolio *spanish*:http://www.tecnodoc.com.ar
> > > Checkout my last proyect instant-press:http://www.instant2press.com
>
>


[web2py] Problem accessing admin interface after upgrade

2010-11-04 Thread Argher
Hello,

I recently upgraded from 1.76.5 to 1.88.2 via the one-click upgrade
button.  After a restart of web2py.py, followed by a server restart,
the admin interface mentioned that it was disabled due to no
password.  I checked the parameters_8000 etc, which corroborated that,
and said password=None.  I manually edited that to have password =
the password used prior for admin purposes, and started seeing
internal tickets issued when trying to access the admin interface
instead of the "disabled due to no password" error.

This is actually two questions -

1) What in what I did could have caused this error / how do I fix that
and get admin working properly again (the sites work fine themselves,
just not the admin interface).

2) Is there a way to view the generated tickets for self-
troubleshooting on the server itself, via ssh/vim and so forth, even
if you can't access the admin page to view them?  I'd rather fix my
problems myself before bothering others :).

Thanks!

Robert


[web2py] disable xml, json renders

2010-11-04 Thread john
Maybe my google-fu is a bit rusty, but for the life of me, I couldn't
find anything about disabling unused renders in web2py.

For example:
http://127.0.0.1:8000/app/default/index
http://127.0.0.1:8000/app/default/index.xml
http://127.0.0.1:8000/app/default/index.json
http://127.0.0.1:8000/app/default/index.rss

is there a way I can disable .xml and .json and .rss?

I've already deleted views/generic.rss, views/generic.xml, views/
generic.json...
and commented in models/db.py:
#service = Service(globals())


I'm running web2py through mod_wsgi on Apache, if that helps any...


Any hints? or would I have to modify the web2py source on my
deployment?  :(

John


[web2py] Dynamic Onclick Button Based on Python Return Values

2010-11-04 Thread karl simon
Hello,

I'm a new to web2py and web programming, so bear with me if this is a
basic question.  I'm trying to figure out how to dynamically update a
button based on a return value from a python function.

Here's a little more background on my project.  I'm trying to create
an instrument panel that has a single button which controls power on/
off to a remote device on my local network.  Without going into too
much detail, when the button is pressed it passes a '1' to a python
function which ultimately turns the device on through tcp modbus.  The
remote device then responds with a '1' indicating power is on and I
pass this value back from the controller to the view.  When I press
the same button again, it sends a '0' out which turns off the device
and it responds with a '0'.  Now how do I use this '1' or '0' response
to either update the button color or refresh the entire page so the
button gets updated.  Currently, I have to manually refresh the page
as can seen below.

Everything is working except for the dynamic button refresh.  I am use
button colors to indicate the instrument status as follows green=on,
red=off.  Here is my code so far:

CSS

[web2py] Re: TAG colon problem

2010-11-04 Thread DenesL
sitemap=TAG.urlset(**{'_xmlns':'http://www.sitemaps.org/schemas/
sitemap/0.9', '_xmlns:xsi':"http://www.w3.org/2001/XMLSchema-
instance"})


On Nov 4, 7:08 pm, Francisco Costa  wrote:
> is this a bug or a python issue?
>
> On 4 Nov, 21:12, Francisco Costa  wrote:
>
> > I'm trying to do a sitemap for my site.
> > The thing is that when I set
>
> > sitemap=TAG.urlset(_xmlns='http://www.sitemaps.org/schemas/sitemap/
> > 0.9', _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";)
>
> > the xmlns:xsi gives error because of the colon (:)
> > Is there any way that i can change this?
>
>


Re: [web2py] disable xml, json renders

2010-11-04 Thread Bruno Rocha
May be not the best approach, but

in any model or controller you can check for extension with

*request.extension*
*
*
***so, *
*
*
if request.extension in ['rss','json','xml','rss']: raise HTTP(400, "Not
Found")



2010/11/4 john 

> Maybe my google-fu is a bit rusty, but for the life of me, I couldn't
> find anything about disabling unused renders in web2py.
>
> For example:
> http://127.0.0.1:8000/app/default/index
> http://127.0.0.1:8000/app/default/index.xml
> http://127.0.0.1:8000/app/default/index.json
> http://127.0.0.1:8000/app/default/index.rss
>
> is there a way I can disable .xml and .json and .rss?
>
> I've already deleted views/generic.rss, views/generic.xml, views/
> generic.json...
> and commented in models/db.py:
> #service = Service(globals())
>
>
> I'm running web2py through mod_wsgi on Apache, if that helps any...
>
>
> Any hints? or would I have to modify the web2py source on my
> deployment?  :(
>
> John




-- 

http://rochacbruno.com.br


Re: [web2py] Re: new admin layout

2010-11-04 Thread Thadeus Burgess
The corners are way too rounded. Looks good!

--
Thadeus




On Thu, Nov 4, 2010 at 4:57 PM, Christopher Steel wrote:

> Nice work, looks great!
>
> I really like the flow that is starting to happen when resizing the
> browser window. Makes me want to try it from my iphone...
>
> Chris
>
>
> On Nov 1, 10:12 pm, mdipierro  wrote:
> > I can make this stable tomorrow if no objections.
> >
> > Massimo
> >
> > On Nov 1, 9:10 pm, "mr.freeze"  wrote:
> >
> > > Looks more Ubuntu than Halloween to me. I like it.
> >
> > > On Nov 1, 8:46 pm, mdipierro  wrote:
> >
> > > > For now I am putting this in. I like the logic of it. I made some
> > > > minor changes. I am not so sure about the Halloween colors. What do
> > > > other people think?
> >
> > > > Massimo
> >
> > > > On Nov 1, 5:25 pm, Branko Vukelic  wrote:
> >
> > > > > Massimo,
> >
> > > > > So I've cloned the HG repo and I've done my magic on the files.
> Would
> > > > > the contents of ``hg diff`` be useful to you? Anyway, it's
> attached,
> > > > > so please tell me if that's what you need. Also, some binary assets
> > > > > (icons).
> >
> > > > > It's not complete. I'm sure some sections could use more work. I'll
> do
> > > > > that some other time, though. Too tired now.
> >
> > > > > On Mon, Nov 1, 2010 at 10:11 PM, Branko Vukelic <
> bg.bra...@gmail.com> wrote:
> > > > > > On Mon, Nov 1, 2010 at 10:10 PM, Branko Vukelic <
> bg.bra...@gmail.com> wrote:
> > > > > >> how to style the browser button. Does anyone have an idea?
> Failing
> >
> > > > > > I meant the 'Browse' button.
> >
> > > > > > --
> > > > > > Branko Vukelić
> >
> > > > > > bg.bra...@gmail.com
> > > > > > stu...@brankovukelic.com
> >
> > > > > > Check out my blog:http://www.brankovukelic.com/
> > > > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > > > I hang out on identi.ca:http://identi.ca/foxbunny
> >
> > > > > > Gimp Brushmakers Guild
> > > > > >http://bit.ly/gbg-group
> >
> > > > > --
> > > > > Branko Vukelić
> >
> > > > > bg.bra...@gmail.com
> > > > > stu...@brankovukelic.com
> >
> > > > > Check out my blog:http://www.brankovukelic.com/
> > > > > Check out my portfolio:http://www.flickr.com/photos/foxbunny/
> > > > > Registered Linux user #438078 (http://counter.li.org/)
> > > > > I hang out on identi.ca:http://identi.ca/foxbunny
> >
> > > > > Gimp Brushmakers Guildhttp://bit.ly/gbg-group
> >
> > > > >  folder.gif
> > > > > < 1KViewDownload
> >
> > > > >  folder_current.gif
> > > > > < 1KViewDownload
> >
> > > > >  folder_sm.gif
> > > > > < 1KViewDownload
> >
> > > > >  heading_bg.png
> > > > > < 1KViewDownload
> >
> > > > >  new_admin.diff
> > > > > 21KViewDownload
> >
> >
>


[web2py] Re: \sample markmin app

2010-11-04 Thread mart
I really like this. And I really like to use your cook book app, "as
is", because I deal with too many groups of people and interests
@work. The cook book has that "compartiment" feature built-in :)
(although if I did have any kind of time to myself, I would look into
adding sub-categories) I mostly use it in meetings/and  conference
calls to write a few notes. I create a new category for new subjects,
meeting topic, etc.., type a few notes, then "save" & I'm done. Then I
can find what I need days later if need be and pull out the bits that
matter. - anyways, works well for me

So for the cookBook, Is there an easy way to switch the text input box
for that very cool markmin editor you have in your new app?  with that
I can do the formatting as I go, and have the text/display all nice
and pretty.

Tanks,

Mart :)

On Nov 4, 6:13 pm, mikech  wrote:
> ++
> DZoned it!
>
> On Nov 4, 6:09 am, mdipierro  wrote:
>
> >http://www.web2py.com/markmin
>
>


Re: [web2py] Book Edit Suggestion

2010-11-04 Thread Bruno Rocha
It is ok to do

search, rows = crud.search(table), crud.select(table)

Edited!

2010/11/4 villas 

> http://www.web2py.com/book/default/chapter/07#CRUD
>
> I noticed this example in the book which does not seem correct:
>
> def manage():
>table=db[request.args(0)]
>form = crud.update(table,request.args(1))
>table.id.represent = lambda id: \
>   A('edit:',id,_href=URL(args=(request.args(0),id)))
>search, rows = crud.select(table)# <<<--
>return dict(form=form,search=search,rows=rows)
>
> May I suggest replacing the marked line:
>search, rows = crud.select(table)
>
> with these two lines:
>search = crud.search(table)
>rows = crud.select(table)
>
> -D




-- 

http://rochacbruno.com.br


[web2py] Re: CRUD select with autosort headers

2010-11-04 Thread mdipierro
Good work. You also have the option to do

{{=plugin_wiki.widget('jqgrid',table)}}

which is sortable, searchable, resizable, can reorder columns, ajax
pagination, etc.

On Nov 4, 4:38 pm, baloan  wrote:
> Final attempt. Much better now. web2py is cool!
>
> def history():
>     headers, key = auto_orderby(db.email_archive,
> default_order=('desc', 'id'))
>     emails = crud.select(db.email_archive, headers=headers,
> orderby=key, limitby=(0, 50))
>     return dict(emails=emails)
>
> def auto_orderby(dal_table, default_order=None):
>     '''
>     Creates headers and key for crud.select() tables.
>
>     @param tablename:      dal table
>     @param default_order:  ('asc'|'desc', column_name)
>     '''
>     tablename = dal_table._tablename
>     orderby_key = tablename + '_orderby'
>     if default_order is None:
>         default_order = ('asc', 'id')
>     # create header column links
>     headers = dict()
>     for col in dal_table.fields:
>         headers[tablename + '.' + col] = A(col,
> _href=URL(vars=dict(orderby=col)))
>     # manage sort order
>     if orderby_key not in session:
>         session[orderby_key] = list(default_order)
>     if 'orderby' in request.vars:
>         if session[orderby_key][1] == request.vars.orderby:
>             if session[orderby_key][0] == 'asc':
>                 session[orderby_key][0] = 'desc'
>             else:
>                 session[orderby_key][0] = 'asc'
>         else:
>             session[orderby_key] = ['asc', request.vars.orderby]
>     # convert to DAL orderby
>     key = db.email_archive[session[orderby_key][1]]
>     if session[orderby_key][0] == 'desc':
>         key = ~key
>     return (headers, key)
>
> Any suggestions for improvement?
>
> Regards, Andreas
>
> On Nov 4, 10:19 pm, baloan  wrote:
>
> > An updated attempt:
>
> > def index():
> >     # create header column links
> >     headers = dict()
> >     for col in db.email_archive.fields:
> >         headers['email_archive.' + col] = A(col,
> > _href=URL(vars=dict(orderby=col)))
> >     # manage sort order
> >     if 'email_archive_orderby' not in session:
> >         session.email_archive_orderby = ['desc', 'id']
> >     if 'orderby' in request.vars:
> >         if session.email_archive_orderby[1] == request.vars.orderby:
> >             if session.email_archive_orderby[0] == 'asc':
> >                 session.email_archive_orderby[0] = 'desc'
> >             else:
> >                 session.email_archive_orderby[0] = 'asc'
> >         else:
> >             session.email_archive_orderby = ['asc',
> > request.vars.orderby]
> >     # convert to DAL orderby
> >     key = db.email_archive[session.email_archive_orderby[1]]
> >     if session.email_archive_orderby[0] == 'desc':
> >         key = ~key
> >     emails = crud.select(db.email_archive, headers=headers,
> > orderby=key)
> >     return dict(emails=emails)
>
> > On Nov 4, 10:06 pm, baloan  wrote:
>
> > > When I say ugly I mean:
> > > 1. too much duplication,
> > > 2. too much boilerplate code.
>
> > > Just imagine what happens if I apply my solution to more than a few
> > > tables.
>
> > > Regards, Andreas
>
> > > On Nov 4, 10:00 pm, baloan  wrote:
>
> > > > This is my feeble attempt at the problem - but it does the job:
>
> > > > def index():
> > > >     add_submenu()
> > > >     headers = {'email.id': A('Id',
> > > > _href=URL(vars=dict(orderby='id'))),
> > > >                'email.email': A('Email address',
> > > > _href=URL(vars=dict(orderby='email'))),
> > > >                'email.active':A('Active',
> > > > _href=URL(vars=dict(orderby='active'))),
> > > >                'email.expires':A('Expires',
> > > > _href=URL(vars=dict(orderby='expires'))),
> > > >                'email.change_user':A('Changed by',
> > > > _href=URL(vars=dict(orderby='change_user'))),
> > > >                'email.change_date':A('Changed on',
> > > > _href=URL(vars=dict(orderby='change_date'))),
> > > >     }
> > > >     if 'email_orderby' not in session:
> > > >         session.email_orderby = ['asc', 'email']
> > > >     if 'orderby' in request.vars:
> > > >         if session.email_orderby[1] == request.vars.orderby:
> > > >             if session.email_orderby[0] == 'asc':
> > > >                 session.email_orderby[0] = 'desc'
> > > >             else:
> > > >                 session.email_orderby[0] = 'asc'
> > > >         else:
> > > >             session.email_orderby = ['asc', request.vars.orderby]
> > > >     key = db.email[session.email_orderby[1]]
> > > >     if session.email_orderby[0] == 'asc':
> > > >         emails = crud.select(db.email, headers=headers, orderby=key)
> > > >     else:
> > > >         emails = crud.select(db.email, headers=headers, orderby= ~key)
> > > >     return dict(emails=emails)
>
> > > > I don't like it - it looks ugly. Who can make it look more elegant?
>
> > > > Best regards, Andreas
> > > > balo...@gmail.com
>
>


[web2py] Re: Problem accessing admin interface after upgrade

2010-11-04 Thread mdipierro
Somehow your parameters_*.py files are corrupted. I hope all your
files were updated and not some of them. I suggest:

0) close web2py
1) Delete parameters_*.py
2) unzip new web2py again over old one
3) start web2py with -a 'password' option and let it create the
parameters_*.py files.



On Nov 4, 3:39 pm, Argher  wrote:
> Hello,
>
> I recently upgraded from 1.76.5 to 1.88.2 via the one-click upgrade
> button.  After a restart of web2py.py, followed by a server restart,
> the admin interface mentioned that it was disabled due to no
> password.  I checked the parameters_8000 etc, which corroborated that,
> and said password=None.  I manually edited that to have password =
> the password used prior for admin purposes, and started seeing
> internal tickets issued when trying to access the admin interface
> instead of the "disabled due to no password" error.
>
> This is actually two questions -
>
> 1) What in what I did could have caused this error / how do I fix that
> and get admin working properly again (the sites work fine themselves,
> just not the admin interface).
>
> 2) Is there a way to view the generated tickets for self-
> troubleshooting on the server itself, via ssh/vim and so forth, even
> if you can't access the admin page to view them?  I'd rather fix my
> problems myself before bothering others :).
>
> Thanks!
>
> Robert


[web2py] Re: disable xml, json renders

2010-11-04 Thread mdipierro
Or delete the view/generic.* files.

On Nov 4, 9:30 pm, Bruno Rocha  wrote:
> May be not the best approach, but
>
> in any model or controller you can check for extension with
>
> *request.extension*
> *
> *
> ***so, *
> *
> *
> if request.extension in ['rss','json','xml','rss']: raise HTTP(400, "Not
> Found")
>
> 2010/11/4 john 
>
>
>
> > Maybe my google-fu is a bit rusty, but for the life of me, I couldn't
> > find anything about disabling unused renders in web2py.
>
> > For example:
> >http://127.0.0.1:8000/app/default/index
> >http://127.0.0.1:8000/app/default/index.xml
> >http://127.0.0.1:8000/app/default/index.json
> >http://127.0.0.1:8000/app/default/index.rss
>
> > is there a way I can disable .xml and .json and .rss?
>
> > I've already deleted views/generic.rss, views/generic.xml, views/
> > generic.json...
> > and commented in models/db.py:
> > #service = Service(globals())
>
> > I'm running web2py through mod_wsgi on Apache, if that helps any...
>
> > Any hints? or would I have to modify the web2py source on my
> > deployment?  :(
>
> > John
>
> --
>
> http://rochacbruno.com.br


[web2py] Re: Book Edit Suggestion

2010-11-04 Thread mdipierro
Just:

search, rows = crud.search(table)

search returns a tuple.

On Nov 4, 10:29 pm, Bruno Rocha  wrote:
> It is ok to do
>
> search, rows = crud.search(table), crud.select(table)
>
> Edited!
>
> 2010/11/4 villas 
>
>
>
> >http://www.web2py.com/book/default/chapter/07#CRUD
>
> > I noticed this example in the book which does not seem correct:
>
> > def manage():
> >    table=db[request.args(0)]
> >    form = crud.update(table,request.args(1))
> >    table.id.represent = lambda id: \
> >       A('edit:',id,_href=URL(args=(request.args(0),id)))
> >    search, rows = crud.select(table)    # <<<--
> >    return dict(form=form,search=search,rows=rows)
>
> > May I suggest replacing the marked line:
> >    search, rows = crud.select(table)
>
> > with these two lines:
> >    search = crud.search(table)
> >    rows = crud.select(table)
>
> > -D
>
> --
>
> http://rochacbruno.com.br


[web2py] How do you create custom form feilds?

2010-11-04 Thread Jason Brower
I understand how to actually do it in the database.  But what if I
wanted to know if there is a proper way to do it when I let specific
roles in my site create fields of their own.
For example: (I am building a conference software.)
John is using my site to create an event to attend.  
He has the usual fields already: username, password, first name last
name, email...
But he want to add more fields.  For example "school affiliation".
How would you best handle this situation?
I was thinking of creating many to many table...
Users that log into my system can attend more than one conference/event
so we have the basics like shown above.
Then people can attend various events and fill in more data.
So:

T:field
conference_id
field_name
field_type
field_required

T:user_conference_field
conference_id
user_id
field_id
data

And then I would have to create customer forms for these as they are
certainly not conventional.
That second table here is like a 3 way cosmic convergence of craziness
and I wonder if there is a better way.
---
Best Regards,
Jason Brower




Re: [web2py] Re: Book Edit Suggestion

2010-11-04 Thread rochacbruno
Sorry I didnt test this way. 

I also didnt know that search returns a select. 

Enviado via iPhone

Em 05/11/2010, às 01:58, mdipierro  escreveu:

> Just:
> 
> search, rows = crud.search(table)
> 
> search returns a tuple.
> 
> On Nov 4, 10:29 pm, Bruno Rocha  wrote:
>> It is ok to do
>> 
>> search, rows = crud.search(table), crud.select(table)
>> 
>> Edited!
>> 
>> 2010/11/4 villas 
>> 
>> 
>> 
>>> http://www.web2py.com/book/default/chapter/07#CRUD
>> 
>>> I noticed this example in the book which does not seem correct:
>> 
>>> def manage():
>>>table=db[request.args(0)]
>>>form = crud.update(table,request.args(1))
>>>table.id.represent = lambda id: \
>>>   A('edit:',id,_href=URL(args=(request.args(0),id)))
>>>search, rows = crud.select(table)# <<<--
>>>return dict(form=form,search=search,rows=rows)
>> 
>>> May I suggest replacing the marked line:
>>>search, rows = crud.select(table)
>> 
>>> with these two lines:
>>>search = crud.search(table)
>>>rows = crud.select(table)
>> 
>>> -D
>> 
>> --
>> 
>> http://rochacbruno.com.br


[web2py] Where's the applications directory on OSX filesystem?

2010-11-04 Thread Tom Campbell
I'm changing to OSX from Windows and can't browse to the applications
directory.  If I search for the view file customer.html from the
command line I see it easily:


$ find . -name customer.html
./osx/1.88.2/web2py/web2py.app/Contents/Resources/applications/
scheduler/views/customer.html

However I can't see my Web2py applications folder in the Finder. (And
therefore can't copy my old Windows project there.) web2py.app seems
to be the application that launches web2py, and it's not clear to me
how it's a containing directory as well.


[web2py] Re: Where's the applications directory on OSX filesystem?

2010-11-04 Thread Tom Campbell
Of course I figured this out moments after I posted, even though I'd
pondered it for some time before. Sorry for wasting your intellectual
bandwidth.


Re: [web2py] Where's the applications directory on OSX filesystem?

2010-11-04 Thread rochacbruno
.app are packages, right click or command click on that and select "show 
content" or something like this 

Enviado via iPhone

Em 05/11/2010, às 02:43, Tom  Campbell  escreveu:

> I'm changing to OSX from Windows and can't browse to the applications
> directory.  If I search for the view file customer.html from the
> command line I see it easily:
> 
> 
> $ find . -name customer.html
> ./osx/1.88.2/web2py/web2py.app/Contents/Resources/applications/
> scheduler/views/customer.html
> 
> However I can't see my Web2py applications folder in the Finder. (And
> therefore can't copy my old Windows project there.) web2py.app seems
> to be the application that launches web2py, and it's not clear to me
> how it's a containing directory as well.


Re: [web2py] Where's the applications directory on OSX filesystem?

2010-11-04 Thread Jonathan Lundell
On Nov 4, 2010, at 9:49 PM, rochacbruno wrote:
> 
> .app are packages, right click or command click on that and select "show 
> content" or something like this 

right or control click, Show Package Contents.

On the command line, in (say) Terminal, web2py.app looks like just another 
folder; the package illusion happens at the GUI level.

> 
> Enviado via iPhone
> 
> Em 05/11/2010, às 02:43, Tom  Campbell  escreveu:
> 
>> I'm changing to OSX from Windows and can't browse to the applications
>> directory.  If I search for the view file customer.html from the
>> command line I see it easily:
>> 
>> 
>> $ find . -name customer.html
>> ./osx/1.88.2/web2py/web2py.app/Contents/Resources/applications/
>> scheduler/views/customer.html
>> 
>> However I can't see my Web2py applications folder in the Finder. (And
>> therefore can't copy my old Windows project there.) web2py.app seems
>> to be the application that launches web2py, and it's not clear to me
>> how it's a containing directory as well.




[web2py] Re: Error in trunk with admin layout?

2010-11-04 Thread Seeker
Thanks lots.  All fixed.


On Nov 4, 5:01 pm, mdipierro  wrote:
> Check if fixed.
>
> On Nov 4, 9:17 am, rochacbruno  wrote:
>
>
>
> > +1
>
> > Enviado via iPhone
>
> > Em 04/11/2010, às 11:33, Seeker  escreveu:
>
> > > Hi,
>
> > > In trunk:
> > > Not sure if i have done something wrong, but admin seems to be without
> > > a layout ...
> > > Anyone else experiencing this?
>
> > > Thanks.- Hide quoted text -
>
> - Show quoted text -


  1   2   >