[web2py] Re: Back link contains unexpected value

2013-07-07 Thread Niphlod
Don't know if its related, but NEVER use fixed strings as href urls  
your '../whatever/whatever' can get really messy soon (probably it just has 
^_^) real quick. Use always URL() to generate urls. If this doesn't fix it, 
please pack a minimal app to reproduce the error...

On Saturday, July 6, 2013 4:43:21 PM UTC+2, Jason Hinds wrote:
>
> I am new to web2py so what I am seeing is probably the result of going 
> about this the wrong way.
>
> What I am trying to do is have a link from the main page directly to the 
> create action of a sqlform grid - basically just a shortcut that a user can 
> use when they know they need to create a record.
>
> So in the view (index):
> {{=A('Add Device',_href='../default/add_device')}}
>
> In the controller:
> @auth.requires_login()
> def add_device():
> redirect(URL('manage_device/device/new/device',user_signature=True))
>
> This does do what I wanted it to do (right or wrong), however the issue I 
> am running into is the back link (back arrow button) that is part of the 
> generated form does not point to the page I just came from (index), but 
> rather to the last form that I used.  Hopefully that makes sense.
>
> I appreciate any advice.  Thanks.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: windows8 installation

2013-07-07 Thread Alan Etkin

>
> have tried to install web2py on a windows8 machine, and when I click on 
> web2py.exe,  the black dos-command screen flickers on for a second, then 
> closes.


I guess you could at least see the error output if you opened a cmd (start 
and type cmd in the command text field) and run the executable file from 
the console. There are some  restrictions you could also check such as the 
built-in firewall, anti-virus, UAC and the run as administrator feature

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] web2py EuroPython 2013 Talk

2013-07-07 Thread Alan Etkin

>
> At EuroPycon I only used a few slides which are a subset of that talk. The 
> rest was an interactive demo.
>

Thanks. Much shorter than PyConUS or PyConAr talks, but still worth seeing. 
I liked the interactive shell script (or wathever you've used to create the 
app).

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: LOAD gives duplicate navbar

2013-07-07 Thread Woody
That's just what I needed.  Thanks much for the help.  Web2Py is a great 
development platform, and I really appreciate all of the generous help 
provided by people on this list!

On Saturday, July 6, 2013 9:36:28 PM UTC-4, Anthony wrote:
>
> {{=LOAD('default','select_table',args=("x10_state_view", 
>> "not_editable"),ajax=True, target='table')}}
>
>
> If you don't specify an extension with LOAD(), it defaults to the usual 
> .html extension (just as the URL() function does). If you don't have a 
> specific .html view for the select_table() function, it will use the 
> generic.html view, which extends layout.html, which includes the navbar. 
> Instead, it is common to use the .load extension for LOAD() components 
> (though that's just a convention and not required). It will then use the 
> generic.load view, unless you create a custom .load view (which you should 
> do, as the generic views are disabled by default on production for security 
> reasons).
>
> Anthony
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: web2py EuroPython 2013 Talk

2013-07-07 Thread shapovalovdenis
Nice talk! Worth watching even for those who are already familiar with 
Web2Py. 
It was interesting to hear your opinion about not so big developers 
community as a major problem. But we are here to solve it, after all :)

Thanks and regards from Moldova (which is in Europe, btw :)

On Sunday, July 7, 2013 12:32:11 AM UTC+3, Massimo Di Pierro wrote:
>
> Thanks to the EuroPython organizers. It was an excellent conference. I 
> attended at the last moment and I had the opportunity to give a talk in the 
> open space. Here it is:
>
> http://www.youtube.com/watch?v=LsLgZUGM3kg
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Clarification on variables in views

2013-07-07 Thread shapovalovdenis
Hi!

This is somewhat a continuation of Conditional presence of a variable in 
view  and How 
do Global Variables 
Work?

So, what is recommended way of checking if var is defined and passed to a 
view? 
i.e. avoiding errors
 name 'foo' is not defined

I see at least 3 ways, one is using 'try ... except' in a view:

{{block content_block}} 
{{try:}} 
{{=message or ""}} 
{{except:}} Message not defined! 
{{pass}} 
{{end}}

other, using "if":
{{block content_block}} 
{{if 'message' in globals():}}
{{=message or ""}} 
{{pass}}
{{end}} 

and also we can use globals().get():
{{=globals().get('message', False)}}
which will return False if message was not returned with dict in controller.

Something like this is used in default layout along with "or" that simply 
checks if var is not empty.

And what if I have a lot of variables to return from controller?
Then returning locals seems to be simpler and cleaner way (at least in 
terms of syntax), but on the other hand I really like the idea of passing 
only selected variables (that will be used) to the view, not all I have in 
controller. 
Probably somebody can point out to other security issues with returning 
locals to all views?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: windows8 installation

2013-07-07 Thread Alex Glaros
Here is how problem was solved:

Don't click on web2py.exe from user desktop
hit windows-logo/X keys 
choose "Run" from menu option
choose "Run as admistrator"
Firewall asks: "do you want to let web2py past firewall?" select, "yes"

thanks for looking at this issue.

Alex 

On Sunday, July 7, 2013 4:44:12 AM UTC-7, Alan Etkin wrote:
>
> have tried to install web2py on a windows8 machine, and when I click on 
>> web2py.exe,  the black dos-command screen flickers on for a second, then 
>> closes.
>
>
> I guess you could at least see the error output if you opened a cmd (start 
> and type cmd in the command text field) and run the executable file from 
> the console. There are some  restrictions you could also check such as the 
> built-in firewall, anti-virus, UAC and the run as administrator feature
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Change default form error message

2013-07-07 Thread Jim S
If I have an error in my form the default error message is displayed.  It 
reads:

Errors in form, please check it out.

I want to change this globally to 'Submission failed!  Please review 
highlighted fields'.  Is there a way I can do this globally?

-Jim

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] web2py EuroPython 2013 Talk

2013-07-07 Thread Massimo Di Pierro
The interactive shell is this one: https://github.com/mdipierro/kryten
I posted it after PyCon Argentina.

Massimo

On Sunday, 7 July 2013 07:30:20 UTC-5, Alan Etkin wrote:
>
> At EuroPycon I only used a few slides which are a subset of that talk. The 
>> rest was an interactive demo.
>>
>
> Thanks. Much shorter than PyConUS or PyConAr talks, but still worth 
> seeing. I liked the interactive shell script (or wathever you've used to 
> create the app).
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Change default form error message

2013-07-07 Thread shapovalovdenis
Hi!

Try looking in languages/default.py or .py.

On Sunday, July 7, 2013 8:09:35 PM UTC+3, Jim S wrote:
>
> If I have an error in my form the default error message is displayed.  It 
> reads:
>
> Errors in form, please check it out.
>
> I want to change this globally to 'Submission failed!  Please review 
> highlighted fields'.  Is there a way I can do this globally?
>
> -Jim
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Change default form error message

2013-07-07 Thread Jim S
Dang, why didn't I think of that.  Thanks, that is exactly what I needed.

-Jim

On Sunday, July 7, 2013 12:30:14 PM UTC-5, shapova...@gmail.com wrote:
>
> Hi!
>
> Try looking in languages/default.py or .py.
>
> On Sunday, July 7, 2013 8:09:35 PM UTC+3, Jim S wrote:
>>
>> If I have an error in my form the default error message is displayed.  It 
>> reads:
>>
>> Errors in form, please check it out.
>>
>> I want to change this globally to 'Submission failed!  Please review 
>> highlighted fields'.  Is there a way I can do this globally?
>>
>> -Jim
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Use Custom Fonts

2013-07-07 Thread Hugo Costa
Hello!

I want to use a custom type of font (downloaded from dafont) in my navbar.

How can I do that? I have the .tff file.

Thanks,

Hugo

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Change default form error message

2013-07-07 Thread Alan Etkin

>
> Dang, why didn't I think of that.  Thanks, that is exactly what I needed.
>

This is better because you don't have to deal with the language files:

# process passes the kwarg to form.validate, so form.validate(message_...) 
is also valid.
form.process(message_onfailure = T("Wait a minute! This bird wouldn't voom 
if you put four million volts through it!"))

This syntax is supported by FORM and SQLFORM, and CRUD methods. For 
.smartgrid and .grid, I think you have to use the formargs kwarg (a 
dictionary like {"message_...": }

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Change default form error message

2013-07-07 Thread Jim Steil
But then wouldn't I have to alter ALL of my grids/forms to override the
message?

-Jim


On Sun, Jul 7, 2013 at 3:19 PM, Alan Etkin  wrote:

> Dang, why didn't I think of that.  Thanks, that is exactly what I needed.
>>
>
> This is better because you don't have to deal with the language files:
>
> # process passes the kwarg to form.validate, so form.validate(message_...)
> is also valid.
> form.process(message_onfailure = T("Wait a minute! This bird wouldn't voom
> if you put four million volts through it!"))
>
> This syntax is supported by FORM and SQLFORM, and CRUD methods. For
> .smartgrid and .grid, I think you have to use the formargs kwarg (a
> dictionary like {"message_...": }
>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/fUBLKVYdUZ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Jim S
Just started playing with auth.wiki today and am creating some pages.  I 
want to force line breaks (new line) in some of my text but can't seem to 
find the way to make it work.

to force a new line I've tried:

\n\n
[[newline]]


and non of these work, they just display on the page along with the other 
text.  What am I missing?

-Jim

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Change default form error message

2013-07-07 Thread Alan Etkin

>
> But then wouldn't I have to alter ALL of my grids/forms to override the 
> message?
>
 
Oops, yes. For many forms, looks like the language file approach is better.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Change default form error message

2013-07-07 Thread Alan Etkin


> But then wouldn't I have to alter ALL of my grids/forms to override the 
>> message?
>>
>  
> Oops, yes. For many forms, looks like the language file approach is better.
>

BTW. I think this is an example of why CRUD should not be deprecated. It 
could be easily modified to support something like

crud = CRUD(db)
crud.messages.on_failure = ... 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread villas
It seems that you already know how to check whether variables exist,  so 
you have already answered the question.

However,  I think the entire premise of the question seems strange.  If you 
are the developer you should know what variables you are going to be using 
in the view?  So, just make sure they always exist so you don't have to 
mess up your view with all those tests.

Maybe if you doing something unusal it is better to state the use case?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread shapovalovdenis
thanks for reply.

Yes, I've showed 3 ways of checking if var was previously defined, but the 
question was about preferred way of doing that in Web2Py, also I want to 
add 'not empty' to this check.

> If you are the developer you should know what variables you are going to 
be using in the view?

It may happen that views are written by other people, etc, isn't it better 
to introduce as much independence as possible?

Here is my case, but I guess there may be other similar. 

I keep content for my static pages in db. It is broken in parts like 
footer_block, header_block, content_block, etc. 
And I use blocks in views, so I can fill parts of view with content from 
db, or leave them with default content from extended view (i.e. my version 
of layout.html) with {{super}}. Also, some part of page can empty in db. 

So, I thought that it would be a good idea to return only non-empty parts 
to the view, and in case when some part is empty in db, it will not be 
passed to the view, and content from extended layout will be used.

Does it make sense?

On Sunday, July 7, 2013 11:52:54 PM UTC+3, villas wrote:
>
> It seems that you already know how to check whether variables exist,  so 
> you have already answered the question.
>
> However,  I think the entire premise of the question seems strange.  If 
> you are the developer you should know what variables you are going to be 
> using in the view?  So, just make sure they always exist so you don't have 
> to mess up your view with all those tests.
>
> Maybe if you doing something unusal it is better to state the use case?
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread shapovalovdenis
> There is no harm in passing all the variables to your view,  as long as 
you are only exposing the ones that you wish to expose.  

and by exposing vars you mean using them like {{=message}}, or?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Alan Etkin

>
> Just started playing with auth.wiki today and am creating some pages.  I 
> want to force line breaks (new line) in some of my text but can't seem to 
> find the way to make it work.
>

You mean you want markmin to add  tags to the output? Then you'll have 
to pump those lower case letters

>>> m = MARKMIN("ONE [[NEWLINE]] TWO [[NEWLINE]] THREE")
>>> print m
ONE  TWO  THREE
>>> m = MARKMIN("ONE [[newline]] TWO [[newline]] THREE")
>>> print m
ONE  TWO  THREE

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread villas
It seems like you are doing some complex things with the views.  That is 
fine,  but personally I find this:

1. In MVC it is more recommended to collect and prepare all your data in 
the controller and then pass all that to the view when it is ready.
2. In that way you can make sure that all the variables exist.
3. If someone else is writing a view,  you can still inform them all the 
variables which are available. You might develop your own conventions for 
that.

If your method of working does not allow that workflow,  you can still do 
what you are doing,  but I don't think there is a 'recommended' way.  The 
methods of checking whether variables exist is really a python question and 
not one specific to web2py.  You already know some methods to do that.

By 'exposing' the variables,  yes,  I meant for example {{=myvar}}.  I mean 
you can pass locals() to the view,  but you do not need to expose them all 
to the public.


On Sunday, 7 July 2013 22:15:14 UTC+1, shapova...@gmail.com wrote:
>
> thanks for reply.
>
> Yes, I've showed 3 ways of checking if var was previously defined, but the 
> question was about preferred way of doing that in Web2Py, also I want to 
> add 'not empty' to this check.
>
> > If you are the developer you should know what variables you are going to 
> be using in the view?
>
> It may happen that views are written by other people, etc, isn't it better 
> to introduce as much independence as possible?
>
> Here is my case, but I guess there may be other similar. 
>
> I keep content for my static pages in db. It is broken in parts like 
> footer_block, header_block, content_block, etc. 
> And I use blocks in views, so I can fill parts of view with content from 
> db, or leave them with default content from extended view (i.e. my version 
> of layout.html) with {{super}}. Also, some part of page can be empty in db. 
>
> So, I thought that it would be a good idea to return only non-empty parts 
> to the view, and in case when some part is empty in db, it will not be 
> passed to the view, and content from extended layout will be used.
>
> This is in the view that extends main template, this only checks if var is 
> defined, but not if it is not empty.
> {{block header_block}} {{try:}} {{=header_block or ''}} {{except:}} {{
> super}} {{pass}} {{end}}
>
> Does it make sense?
>
> On Sunday, July 7, 2013 11:52:54 PM UTC+3, villas wrote:
>>
>> It seems that you already know how to check whether variables exist,  so 
>> you have already answered the question.
>>
>> However,  I think the entire premise of the question seems strange.  If 
>> you are the developer you should know what variables you are going to be 
>> using in the view?  So, just make sure they always exist so you don't have 
>> to mess up your view with all those tests.
>>
>> Maybe if you doing something unusal it is better to state the use case?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread shapovalovdenis
villas, I agree with you on 1-3. Probably I over-complicated the workflow 
at some point.

Still, what approach do you think of, when some parts (vars) returned from 
controller (and db) have empty values and then we need to keep extended's 
layout values in that places (i.e. {{super}})?

Processing web page templates doesn't always means substituting all the 
placeholders with variables from db, sometimes it needs to be adaptive to 
the data, right? 



On Monday, July 8, 2013 12:50:01 AM UTC+3, villas wrote:
>
> It seems like you are doing some complex things with the views.  That is 
> fine,  but personally I find this:
>
> 1. In MVC it is more recommended to collect and prepare all your data in 
> the controller and then pass all that to the view when it is ready.
> 2. In that way you can make sure that all the variables exist.
> 3. If someone else is writing a view,  you can still inform them all the 
> variables which are available. You might develop your own conventions for 
> that.
>
> If your method of working does not allow that workflow,  you can still do 
> what you are doing,  but I don't think there is a 'recommended' way.  The 
> methods of checking whether variables exist is really a python question and 
> not one specific to web2py.  You already know some methods to do that.
>
> By 'exposing' the variables,  yes,  I meant for example {{=myvar}}.  I 
> mean you can pass locals() to the view,  but you do not need to expose them 
> all to the public.
>
>
> On Sunday, 7 July 2013 22:15:14 UTC+1, shapova...@gmail.com wrote:
>>
>> thanks for reply.
>>
>> Yes, I've showed 3 ways of checking if var was previously defined, but 
>> the question was about preferred way of doing that in Web2Py, also I want 
>> to add 'not empty' to this check.
>>
>> > If you are the developer you should know what variables you are going 
>> to be using in the view?
>>
>> It may happen that views are written by other people, etc, isn't it 
>> better to introduce as much independence as possible?
>>
>> Here is my case, but I guess there may be other similar. 
>>
>> I keep content for my static pages in db. It is broken in parts like 
>> footer_block, header_block, content_block, etc. 
>> And I use blocks in views, so I can fill parts of view with content from 
>> db, or leave them with default content from extended view (i.e. my version 
>> of layout.html) with {{super}}. Also, some part of page can be empty in db. 
>>
>> So, I thought that it would be a good idea to return only non-empty parts 
>> to the view, and in case when some part is empty in db, it will not be 
>> passed to the view, and content from extended layout will be used.
>>
>> This is in the view that extends main template, this only checks if var 
>> is defined, but not if it is not empty.
>> {{block header_block}} {{try:}} {{=header_block or ''}} {{except:}} {{
>> super}} {{pass}} {{end}}
>>
>> Does it make sense?
>>
>> On Sunday, July 7, 2013 11:52:54 PM UTC+3, villas wrote:
>>>
>>> It seems that you already know how to check whether variables exist,  so 
>>> you have already answered the question.
>>>
>>> However,  I think the entire premise of the question seems strange.  If 
>>> you are the developer you should know what variables you are going to be 
>>> using in the view?  So, just make sure they always exist so you don't have 
>>> to mess up your view with all those tests.
>>>
>>> Maybe if you doing something unusal it is better to state the use case?
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Jim S
I don't think I was clear enough with my description.

I'm using the default auth.wiki as follows in the default controller:

def index():
return auth.wiki()

Then, in one of the pages I created using the wiki 'create page' I'm trying 
to get a carriage return displayed.  I've tried all the think listed above, 
but can't get my address to format correctly.

I want:

John Doe
123 N Main St.
Anytown, WI  53888

When auth.wiki renders it on the page it shows up as:

John Doe 123 N Main St. Anytown, WI  53888

I can't get it to force a carriage return or new line.

I'm not running any python controller code to do anything.

-Jim




On Sunday, July 7, 2013 4:28:19 PM UTC-5, Alan Etkin wrote:
>
> Just started playing with auth.wiki today and am creating some pages.  I 
>> want to force line breaks (new line) in some of my text but can't seem to 
>> find the way to make it work.
>>
>
> You mean you want markmin to add  tags to the output? Then you'll 
> have to pump those lower case letters
>
> >>> m = MARKMIN("ONE [[NEWLINE]] TWO [[NEWLINE]] THREE")
> >>> print m
> ONE  TWO  THREE
> >>> m = MARKMIN("ONE [[newline]] TWO [[newline]] THREE")
> >>> print m
> ONE  TWO  class="anchor" id="markmin_newline"> THREE
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Use Custom Fonts

2013-07-07 Thread lesssugar
Not really a web2py thing. Check the liks below.

CSS3 font-face (general usage): 
http://www.css3.info/preview/web-fonts-with-font-face/

Webfont generator (for the font you downloaded): 
http://www.fontsquirrel.com/tools/webfont-generator

On Sunday, July 7, 2013 9:56:15 PM UTC+2, Hugo Costa wrote:
>
> Hello!
>
> I want to use a custom type of font (downloaded from dafont) in my navbar.
>
> How can I do that? I have the .tff file.
>
> Thanks,
>
> Hugo
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] FPDF add font not working

2013-07-07 Thread peibol
Hi there:

I'ts supposed we can add fonts from whatever the folder we want to FPDF. 
For example, in the static/fonts folder that I've created for this purpose:

def numbers():
class MyFPDF(FPDF, HTMLMixin):
pass
pdf=MyFPDF()
pdf.add_page()
pdf.add_font('DejaVu', '', URL('static','fonts/DejaVuSans.ttf', 
scheme=True, host=True), uni=True)
pdf.set_font('DejaVuSans','B',12)
pdf.cell(40,100,"Hello")
 response.headers['Content-Type']='application/pdf'
return pdf.output(dest='S') 

But I'm getting 
 TTF Font file not found: 
http://127.0.0.1:8083/myeducenter/static/fonts/DejaVuSans.ttf

And if I paste that URL in the browser I get the file...

Cheers
Pablo

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Alan Etkin


> Then, in one of the pages I created using the wiki 'create page' I'm 
> trying to get a carriage return displayed.  I've tried all the think listed 
> above, but can't get my address to format correctly.
>

Try adding this to a wiki document. I tested this with trunk but should 
work in any town (make sure your render engine is markmin, the default).

John Doe
[[NEWLINE]]
123 N Main St.
[[NEWLINE]]
Anytown, WI  53888

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Jim Steil
Same result, no newlines were inserted.  It all appears as one long line.


On Sun, Jul 7, 2013 at 5:48 PM, Alan Etkin  wrote:

>
> Then, in one of the pages I created using the wiki 'create page' I'm
>> trying to get a carriage return displayed.  I've tried all the think listed
>> above, but can't get my address to format correctly.
>>
>
> Try adding this to a wiki document. I tested this with trunk but should
> work in any town (make sure your render engine is markmin, the default).
>
> John Doe
> [[NEWLINE]]
> 123 N Main St.
> [[NEWLINE]]
> Anytown, WI  53888
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/T28zkNPhBf8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: FPDF add font not working

2013-07-07 Thread Alan Etkin

>
> I'ts supposed we can add fonts from whatever the folder we want to FPDF. 
> For example, in the static/fonts folder that I've created for this purpose:
>

It seems that .add_font takes an o.s. path as argument. See 
http://code.google.com/p/pyfpdf/wiki/AddFont

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Use Custom Fonts

2013-07-07 Thread Hugo Costa
Thanks!

Hugo

Domingo, 7 de Julho de 2013 23:33:59 UTC+1, lesssugar escreveu:
>
> Not really a web2py thing. Check the liks below.
>
> CSS3 font-face (general usage): 
> http://www.css3.info/preview/web-fonts-with-font-face/
>
> Webfont generator (for the font you downloaded): 
> http://www.fontsquirrel.com/tools/webfont-generator
>
> On Sunday, July 7, 2013 9:56:15 PM UTC+2, Hugo Costa wrote:
>>
>> Hello!
>>
>> I want to use a custom type of font (downloaded from dafont) in my navbar.
>>
>> How can I do that? I have the .tff file.
>>
>> Thanks,
>>
>> Hugo
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Clarification on variables in views

2013-07-07 Thread Anthony

>
> Still, what approach do you think of, when some parts (vars) returned from 
> controller (and db) have empty values and then we need to keep extended's 
> layout values in that places (i.e. {{super}})?


The other approach would be to return a value of None (or other "falsey" 
value) for the variable in question rather than excluding the value 
altogether. You'll still need a conditional in the view, but you won't have 
to check whether the variable exists at all.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Change default form error message

2013-07-07 Thread Anthony


> BTW. I think this is an example of why CRUD should not be deprecated. It 
> could be easily modified to support something like
>
> crud = CRUD(db)
> crud.messages.on_failure = ... 
>

I don't think we need CRUD just for that. We should allow something like 
that for regular forms and the grid as well.

Anthony 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Alan Etkin

>
> Same result, no newlines were inserted.  It all appears as one long line.
>

Odd, It works fine with the mercurial trunk code. what is your version of 
web2py?

Do you want to force line breaks (separating the html output with ) 
or just add newline characters to the html. For this last option, I don't 
think that markmin supports it, unless you use a custom render function.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Back link contains unexpected value

2013-07-07 Thread Anthony
The grid creates the back button links based on the URL of the grid action 
itself, but it stores the referrer URL in 
session._web2py_grid_referrer_web2py_grid (if you use a custom formname for 
the grid, that last "web2py_grid" is replaced with the formname). So, in 
your grid action, before creating the grid, you could do:

session._web2py_grid_referrer_web2py_grid = [some alternate URL]
grid = SQLFORM.grid(...)

Anthony

On Saturday, July 6, 2013 10:43:21 AM UTC-4, Jason Hinds wrote:
>
> I am new to web2py so what I am seeing is probably the result of going 
> about this the wrong way.
>
> What I am trying to do is have a link from the main page directly to the 
> create action of a sqlform grid - basically just a shortcut that a user can 
> use when they know they need to create a record.
>
> So in the view (index):
> {{=A('Add Device',_href='../default/add_device')}}
>
> In the controller:
> @auth.requires_login()
> def add_device():
> redirect(URL('manage_device/device/new/device',user_signature=True))
>
> This does do what I wanted it to do (right or wrong), however the issue I 
> am running into is the back link (back arrow button) that is part of the 
> generated form does not point to the page I just came from (index), but 
> rather to the last form that I used.  Hopefully that makes sense.
>
> I appreciate any advice.  Thanks.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: New to auth.wiki - format text as address block with markmin

2013-07-07 Thread Jim Steil
My web2py is Version 2.5.1-stable+timestamp.2013.06.17.10.41.11.

I tried adding a  and didn't see any changes.


On Sun, Jul 7, 2013 at 7:59 PM, Alan Etkin  wrote:

> Same result, no newlines were inserted.  It all appears as one long line.
>>
>
> Odd, It works fine with the mercurial trunk code. what is your version of
> web2py?
>
> Do you want to force line breaks (separating the html output with )
> or just add newline characters to the html. For this last option, I don't
> think that markmin supports it, unless you use a custom render function.
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/T28zkNPhBf8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Change default form error message

2013-07-07 Thread Jim Steil
The language file worked fine for me.  Is that not a good way to solve the
problem?

-Jim


On Sun, Jul 7, 2013 at 7:50 PM, Anthony  wrote:

>
> BTW. I think this is an example of why CRUD should not be deprecated. It
>> could be easily modified to support something like
>>
>> crud = CRUD(db)
>> crud.messages.on_failure = ...
>>
>
> I don't think we need CRUD just for that. We should allow something like
> that for regular forms and the grid as well.
>
> Anthony
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/fUBLKVYdUZ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.