[web2py] Stupid translation question

2010-01-28 Thread weheh
I haven't really worked with translation, yet. But I'm going to be
getting into it in a big way. I have

db.define_table('content',Field('title'),Field('body'))

I want to enter title and body in English, but then translate to other
languages.
Let's say I do this:

rows=db(db.content.id>0).select()
for row in rows:
  trans_title=T(row.title)
  trans_body=T(row.body)

Will something like that work?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py] input title attribute

2010-01-28 Thread vihang
Any idea how I can access or add 'title' attribute for input elements?
Cannot see it anywhere in the html.py.

'title' is used for tooltips text.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] wmd

2010-01-28 Thread Johann Spies
Thadeus mentioned that he used WMD on his blog.

I have tried to get it working by putting the following in layout.hml:


  // to set WMD's options programatically, define a "wmd_options"
object with whatever settings
  // you want to override.  Here are the defaults:
  wmd_options = {
  // format sent to the server.  Use "Markdown" to return the markdown source.
  output: "HTML",

  // line wrapping length for lists, blockquotes, etc.
  lineLength: 40,

  // toolbar buttons.  Undo and redo get appended automatically.
  buttons: "bold italic | link blockquote code image | ol ul heading hr",

  // option to automatically add WMD to the first textarea found.  See
apiExample.html for usage.
  autostart: true
  };





But this seems to be ignored.

As I understand the instructions this should be just before 
so I cannot see where else to put it.

What am I doing wrong?

Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Postgresql interface buggy

2010-01-28 Thread Johann Spies
On 28 January 2010 00:15, Thadeus Burgess  wrote:
> This is most likely a bug, would you be willing to provide more
> information on the matter?

Example.  I have changed the type of a field from string (1024) to 'text'.
>
> For simplicities sake, drop your tables with the DAL by doing
>
> db.table.drop()

If I remember correctly I have tried then and then get an "Invalid
query" from the appamin interface afterwards.

>
> Then you will have a fresh start when you remove this command.

I have restarted web2py after the "drop" but in the end had to
recreate the table using psql.

Regards
Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] state of documentation: why pdf?

2010-01-28 Thread pistacchio
hi to all,
after a long session of web2py coding, i feel now a bit frustrated by
the documentation. i don't think that .pdf is the best format for
documenting an opensource project.

every time you need to look up something you have to search the whole
document for a keyword and read through the found pages or go back to
the beginning of the document for the summary, scroll looking for what
you're after (or do the same with the glossary on the last pages).
then scroll to the page number or input it to go there. of course the
_pdf_ page number doesn't match with the _document_ number, so there's
some additional scrolling for some 5 - 10 pages.
using a pdf as reference is really buggy. when i have a doubt like
"what's that parameter?" or "how's that example?" i don't really feel
scrolling between pages, i want to click links and get answers.

now, i find the scribd thing really annoying, so i bought the pdf from
lulu. i mostly did it to fund the project, indeed. it is, of course,
not updated. for example i imported some modules  with "import
applications.myapp.modules.mymodule as mymodule", as the manual said.
i changed the project name and it broke. a search in the newsgroup
pointed me to local_import. local_import is nowhere referred to in the
pdf.
other example. i'm now aware of the urlify method found in the latest
revision because i'm now actively following the newsgroup and mostly
because i contributed it, but i wonder how many useful modules and
amazing functions are there that i'm not aware of because of this lack
in the documentation. i think it is scattered and not well organized.

i moved away from django and i'm really happy of having found web2py
but honestly this page http://docs.djangoproject.com/en/1.1/contents/
(django documentation) is something to copy from, all indexed,
organized, always up-to-date and full of examples. there are multiple
entry points, from the "getting started" tutorial if you're now, to
the "using django" that is more complete and in-depth to the api for a
quick reference. mind you, this api http://docs.djangoproject.com/en/1.1/ref/
is really different from this 
http://www.web2py.com/examples/static/epydoc/index.html
because, being human-written, is full of examples, caveats,
suggestions and multiple references to other sections of the
documentation where the subject is explained.

the choice of the pdf format seems really money-driven and, sorry to
say, this works really bad with an open source project. if really
money is the key problem here (eg: selling the pdf is used to pay the
hosting), i'd be happy to fund the initial shift of the documentation
to a more maintainable format.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Translations stopped working in 1.74.8

2010-01-28 Thread ls1
Hello,

I recently upgraded web2py from 1.62.2 to 1.74.8 and have following
problem.
The applications (even 'welcome' which comes with web2py) are not
translated according to web browser language preferences.

If I have set language preferences in web browser like:
 'pl','en' -> I got all messages in english
 'pl', 'it' -> I got all messages untranslated (in english)
 'pl' only -> I got all messages correctly translated (in polish)
 'it' only -> I got all messages correctly translated (in italian)

Variable 'request.env.http_accept_language' looks to be correct in
each case.
I tried solutions from web2py internationalization tutorial posted on
vimeo, but it didn't work.

I test it with FF3.5 and IE8 and on different platforms: linux/apache
and windows/built-in CherryPy.
Same results.

any ideas? bug or feature?


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: wmd

2010-01-28 Thread selecta
i showed in a slice that using a wysiwyg editor for markup is
possible, why not use that instead of wysiwym

On Jan 28, 9:52 am, Johann Spies  wrote:
> Thadeus mentioned that he used WMD on his blog.
>
> I have tried to get it working by putting the following in layout.hml:
>
> 
>   // to set WMD's options programatically, define a "wmd_options"
> object with whatever settings
>   // you want to override.  Here are the defaults:
>   wmd_options = {
>   // format sent to the server.  Use "Markdown" to return the markdown source.
>   output: "HTML",
>
>   // line wrapping length for lists, blockquotes, etc.
>   lineLength: 40,
>
>   // toolbar buttons.  Undo and redo get appended automatically.
>   buttons: "bold italic | link blockquote code image | ol ul heading hr",
>
>   // option to automatically add WMD to the first textarea found.  See
> apiExample.html for usage.
>   autostart: true
>   };
> 
> 
> 
> 
>
> But this seems to be ignored.
>
> As I understand the instructions this should be just before 
> so I cannot see where else to put it.
>
> What am I doing wrong?
>
> Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Using AS in DAL

2010-01-28 Thread Khaled ElAdawy
I just want to map this simple query to DAL syntax:
"SELECT field_name FROM table_name AS my_name"

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] input title attribute

2010-01-28 Thread tiago almeida
Have you tried using the optional parameter _title when building your INPUT
object?

INPUT( ..., _title="my Title", ...)

---

On Thu, Jan 28, 2010 at 8:33 AM, vihang  wrote:

> Any idea how I can access or add 'title' attribute for input elements?
> Cannot see it anywhere in the html.py.
>
> 'title' is used for tooltips text.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: state of documentation: why pdf?

2010-01-28 Thread Richard
I totally agree - the manual is a great resource but the PDF format
makes it hard to traverse and doesn't keep up with new features.
Django docs are excellent.

This was brought up previously and the main obstacle (IIRC) is Massimo
needs publications to justify working on web2py for his university.
Hopefully a compromise can be reached.


On Jan 28, 9:00 pm, pistacchio  wrote:
> hi to all,
> after a long session of web2py coding, i feel now a bit frustrated by
> the documentation. i don't think that .pdf is the best format for
> documenting an opensource project.
>
> every time you need to look up something you have to search the whole
> document for a keyword and read through the found pages or go back to
> the beginning of the document for the summary, scroll looking for what
> you're after (or do the same with the glossary on the last pages).
> then scroll to the page number or input it to go there. of course the
> _pdf_ page number doesn't match with the _document_ number, so there's
> some additional scrolling for some 5 - 10 pages.
> using a pdf as reference is really buggy. when i have a doubt like
> "what's that parameter?" or "how's that example?" i don't really feel
> scrolling between pages, i want to click links and get answers.
>
> now, i find the scribd thing really annoying, so i bought the pdf from
> lulu. i mostly did it to fund the project, indeed. it is, of course,
> not updated. for example i imported some modules  with "import
> applications.myapp.modules.mymodule as mymodule", as the manual said.
> i changed the project name and it broke. a search in the newsgroup
> pointed me to local_import. local_import is nowhere referred to in the
> pdf.
> other example. i'm now aware of the urlify method found in the latest
> revision because i'm now actively following the newsgroup and mostly
> because i contributed it, but i wonder how many useful modules and
> amazing functions are there that i'm not aware of because of this lack
> in the documentation. i think it is scattered and not well organized.
>
> i moved away from django and i'm really happy of having found web2py
> but honestly this pagehttp://docs.djangoproject.com/en/1.1/contents/
> (django documentation) is something to copy from, all indexed,
> organized, always up-to-date and full of examples. there are multiple
> entry points, from the "getting started" tutorial if you're now, to
> the "using django" that is more complete and in-depth to the api for a
> quick reference. mind you, this apihttp://docs.djangoproject.com/en/1.1/ref/
> is really different from 
> thishttp://www.web2py.com/examples/static/epydoc/index.html
> because, being human-written, is full of examples, caveats,
> suggestions and multiple references to other sections of the
> documentation where the subject is explained.
>
> the choice of the pdf format seems really money-driven and, sorry to
> say, this works really bad with an open source project. if really
> money is the key problem here (eg: selling the pdf is used to pay the
> hosting), i'd be happy to fund the initial shift of the documentation
> to a more maintainable format.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Couldn't we just ahve a / after everything address?

2010-01-28 Thread Jason Brower
I wonder if we could have the server always redirect to a / after all
address.
This makes it so our extra values can always work without having to use
a long URL(bla) string.
Having it different all the time can be a bit annoying.  There may be
better examples. :)
So:
www.jason.com/default/part
would always redirect to:
www.jason.com/default/part/

Is there anything wrong with that?
Best Regards,
Jason Brower


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Mobile devices + web2py

2010-01-28 Thread tiago almeida
Hello,
does web2py have any mechanism for dealing with mobile devices? I'm talking
about *determining if the user is on a mobile device* so that pages can be
tailored for those screens.

I've searched in the book and in web2pyslices and don't see anything like
that.

Thanks a lot in advance,
Tiago Almeida

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] dynamic content with jquery trigger/bind?

2010-01-28 Thread selecta
Does anybody have some experiences with creating dynamic content with
jquery?
I know the signal/slot system from qt and I have the feeling that
trigger/bind from jquery can do the same thing in web2py

My idea is to have e.g. a list view (controller list) and a form
(controller form). Both are loaded via ajax onto the same page, when
the form is submitted (via ajax) and it has the right content the
controller form will return the trigger that updates the list view
(calls controller list).
Is this possible? Am I thinking in the right direction?

Please help or guide me into the right direction.

If I am to unclear please tell me and I will try to find a better
example

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] get or insert shortcut

2010-01-28 Thread Richard
I want to get the ID of a record with certain fields, and create it if
not already existing. Is there a shortcut for this common operation?
In Django it is called "get_or_create()"

Also, is there a shortcut for update_or_create()?

Thanks,
Richard

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: state of documentation: why pdf?

2010-01-28 Thread pistacchio


On Jan 28, 12:48 pm, Richard  wrote:

> This was brought up previously and the main obstacle (IIRC) is Massimo
> needs publications to justify working on web2py for his university.
> Hopefully a compromise can be reached.

if this is the reason (and it is indeed a valid one), than nobody
would keep us from having both a pdf and a html version. to start off,
the internet version could a reorganization / htmlized version of the
pdf, than we can expand it with examples, cross references, and keep
it up to date with the changes made in various revisions. the
university pdf, on the other hand, could expand and be kept updated
with the material from the html version. my 2 cents.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: validator that creates select with options from list of tuples?

2010-01-28 Thread selecta
ok one more improvement but then it works perfectly
 if theset and len(theset[0])==2 and (isinstance(theset[0], list) or
isinstance(theset[0], tuple)):
should be
 if theset and  (isinstance(theset[0], list) or isinstance(theset[0],
tuple)) and len(theset[0])==2:

On Jan 27, 2:25 am, selecta  wrote:
> sry just realized that mr web2py himself is called massimo, I should
> really go and sleep now
>
> On Jan 27, 2:20 am, selecta  wrote:
>
>
>
> > IGNORE THE POST ABOVE
> > NOW TRULY SOLVED
>
> > The problem with the post above was that the validator was not order
> > preserving, I added some lines to the IS_IN_SET constructor, not it
> > truly works
>
> >      
> >        >>> IS_IN_SET([('a','max'), ('b','john')])('max')
> >         ('a', None)
> >     """
>
> >     def __init__(
> >         self,
> >         theset,
> >         labels=None,
> >         error_message='value not allowed',
> >         multiple=False,
> >         zero='',
> >         sort=False,
> >         ):
> >         self.multiple = multiple
> >         self.labels = labels
> >         if theset and len(theset[0])==2 and (isinstance(theset[0],
> > list) or isinstance(theset[0], tuple)):
> >             self.theset = [str(item) for item,label in theset]
> >             self.labels = [str(label) for item,label in theset]
> >         else:
> >             self.theset = [str(item) for item in theset]
> >         if isinstance(theset, dict):
> >             self.labels = theset.values()
> >         self.error_message = error_message
> >         self.zero = zero
> >         self.sort = sort
> > 
> > contrutor ends there
>
> > maximo if you could add this code to the trunk it would be very nice
>
> > On Jan 27, 12:07 am, selecta  wrote:
>
> > > SOLVED
>
> > > i thought i have to write my own validator, looking into IS_IN_SET i
> > > stumbeled upon the following code in the first few lines
>
> > >  if isinstance(theset, dict):
> > >             self.labels = theset.values()
>
> > > hmmm, lets try
>
> > > folders = dict(folders)
> > > db_webfolder.parent.requires = IS_IN_SET(folders)
> > > form_file = SQLFORM(db_webfolder)
>
> > > and it works!!!
>
> > > maybe this should be documented somewhere, e.g. in the docstring of
> > > IS_IN_SET! would make it at least a bit easier to find out
>
> > > On Jan 26, 11:23 pm, selecta  wrote:
>
> > > > oh it can ?:) sounds good, but still it solves only part of my
> > > > problem, I also want to change what is shown to the user in option, I
> > > > better show you what I want to do
>
> > > >     def getfolders(root = 0, spaces = '-'):
> > > >         folders = []
> > > >         for f in db(db_webfolder.id>0)(db_webfolder.parent==root)
> > > > (db_webfolder.file==None).select():
> > > >             folders.append((f.id,spaces+f.name))
> > > >             folders += getfolders(f.id, '-'+spaces)
> > > >         return folders
>
> > > >     folders = [(0,'root')]+getfolders()
> > > >     form_folder = FORM(SELECT([OPTION(name,_value=id) for id,name in
> > > > folders],_name='parent'),INPUT(_name='name'),INPUT
> > > > (_type='submit',_value="create"))
>
> > > > it should return something like
> > > > 
> > > > root
> > > > -test
> > > > --subfolder of test
> > > > --another sub of test
> > > > --another one
> > > > -another folder
> > > > -yet another
> > > > -okok
> > > > --tesing still
> > > > 
>
> > > > On Jan 26, 10:59 pm, Thadeus Burgess  wrote:
>
> > > > > IS_IN_DB can use a query can't it?
>
> > > > > -Thadeus
>
> > > > > On Tue, Jan 26, 2010 at 3:46 PM, selecta  
> > > > > wrote:
> > > > > > Is there a validator that creates a select with options from a list 
> > > > > > of
> > > > > > tuples
>
> > > > > > what I want do do is
> > > > > > Field("folder","integer",requires = 
> > > > > > IS_IN_TUPLELIST([('myfolder',12),
> > > > > > ('subfoler',23)]))
>
> > > > > > so that is creates
> > > > > > SELECT([OPTION(name,_value=id) for name,id in [('myfolder',12),
> > > > > > ('subfoler',23)] ],_name='parent'),INPUT(_name='name')
>
> > > > > > in this case I cannot use IS_IN_DB because i need to filter the
> > > > > > results from the table
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google 
> > > > > > Groups "web2py-users" group.
> > > > > > To post to this group, send email to web...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to 
> > > > > > web2py+unsubscr...@googlegroups.com.
> > > > > > For more options, visit this group 
> > > > > > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Custom form doesn't submit

2010-01-28 Thread Adi
Update: I think I found a web2py bug.

form.custom.inpval.filename is generating bad html code. The first
option label of the html is this:

JokerRiddlerTwoface">
Joker
RiddlerTwoface


Basically the first  has nested inside itself what should be
the actual  code. If I remove this in Firebug, the form
submits. Am I using form.custom.inpval wrongly? Or is this a bug?


On Jan 27, 9:58 am, Adi  wrote:
> Hi Denes/Massimo,
>
> Any inputs?
>
> On Jan 25, 8:20 pm, Adi  wrote:
>
>
>
> > Sorry I was posting the other reply so missed this: Responses inline.
>
> > > You are appending to form1 so check:
> > > 1) An INPUT named 'name', is it the only 'name' field in form1?
>
> > Yes. names of all fields are different.
>
> > > 2) Same for the SELECT, is there another 'gender' field?
>
> > No. All fields are different.
>
> > > 3) A second button named 'Add another' which will submit to the
> > > controller that generated form1 (self-submission), is that what you
> > > want?.
>
> > A button in the same row as the insertedformwhich says "Add another"
> > & submits the data to the same controller and function. So, Yes.
>
> > > Denes.
>
> > On Jan 25, 8:15 pm, DenesL  wrote:
>
> > > On Jan 25, 6:35 am, Adi  wrote:
>
> > > > Hi all,
>
> > > > I'm trying to build acustomformin this fashion:
>
> > > > There's a parent table and a child table (many one relationship). I've
> > > > created a read-only SQLFORM for a record of the parent, and then I'm
> > > > trying this:
>
> > > > form1 = SQLFORM(db.parent, readonly=True)
>
> > > > form2 = SQLFORM(db.child, keepopts=['gender'])
>
> > > > form1[0].append(TR(INPUT(_type='text', name='name',
> > > > requires=IS_NOT_EMPTY()), \
> > > > SELECT(form2.custom.inpval.gender, name='gender'),\
> > > > INPUT(_type='submit', _value='Add another'))
>
> > > > This gives me the appearance of theformas I want, i.e., parent read-
> > > > only record in aform, with additional single row of updateable child
> > > >formwith "Add another" button. The secondformis to provide a drop-
> > > > down list for 'gender'. However, in this case the "Add another" button
> > > > doesn't submit, i.e, I can't get control in form1.accepts or
> > > > form2.accepts.
>
> > > > What am I doing wrong?
>
> > > You are appending to form1 so check:
> > > 1) An INPUT named 'name', is it the only 'name' field in form1?
> > > 2) Same for the SELECT, is there another 'gender' field?
> > > 3) A second button named 'Add another' which will submit to the
> > > controller that generated form1 (self-submission), is that what you
> > > want?.
>
> > > Denes.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: input title attribute

2010-01-28 Thread vihang
I am building the form directly from SQLFORM. But I tried many
combinations using form.element and accessing the form array directly,
but does not work. Supposedly 'title' is not there in the input helper
(html.py) on the first place.

On Jan 28, 4:37 pm, tiago almeida  wrote:
> Have you tried using the optional parameter _title when building your INPUT
> object?
>
> INPUT( ..., _title="my Title", ...)
>
> ---
>
> On Thu, Jan 28, 2010 at 8:33 AM, vihang  wrote:
> > Any idea how I can access or add 'title' attribute for input elements?
> > Cannot see it anywhere in the html.py.
>
> > 'title' is used for tooltips text.
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Two domains, two web2py instances, two apps, same database

2010-01-28 Thread Alexandre Andrade
I think your proposed setup is good, with two virtual hosts.

I just recomend append "migrate=false" to tables that appear in
example.com(accounts, or auth_user)

Could be also just apps in one installation of web2py, if you adjust one of
your virtual hosts.



2010/1/28 Thadeus Burgess 

> Here are my needs.
>
> example.com = public portion of the website. This includes anything
> publicly accessible, and allows new accounts to be created. Only needs
> access to one table, accounts table.
> dashboard.example.com = internal portion of the website, which
> includes all account management functions, but of course linked to the
> same database, but has access to many more tables.
>
> In this setup, I would run two apache virtualhosts, and two
> installations of web2py. I will define my models in a module that they
> can be imported to each app.
>
> Each app will of course have a different set of
> controllers/views/static etc etc.
>
> And dashboard.example.com will be force https, IP restricted (by
> apache), htpasswd, web2py passwd, etc.. etc..
>
> Is this an appropriate setup for this? Would having one app that
> checks request.env.http_host and route based on this a better
> solution?
>
> What would be the correct way to design the models so they can be
> imported instead of "exectued", like Admin but I need them to unpack
> into the web2py global namespace. Since I am on linux, would symlinks
> be a better approach I could store just the accounts table in one
> file, and symlink that to both apps from a central "projects" folder.
>
> Thoughts, suggestions, ideas?
>
> -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>


-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Stupid translation question

2010-01-28 Thread Alexandre Andrade
everything is passed by T('anything') go to languages/my_ln.py (like
en_us.py).

So you have to manually translate the strings on that file.



2010/1/28 weheh 

> I haven't really worked with translation, yet. But I'm going to be
> getting into it in a big way. I have
>
> db.define_table('content',Field('title'),Field('body'))
>
> I want to enter title and body in English, but then translate to other
> languages.
> Let's say I do this:
>
> rows=db(db.content.id>0).select()
> for row in rows:
>  trans_title=T(row.title)
>  trans_body=T(row.body)
>
> Will something like that work?
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>


-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: bug in SQLFORM.factory?

2010-01-28 Thread mdipierro
Let me try reproduce this.

On Jan 28, 1:06 am, Frederik Wagner  wrote:
> Hi,
>
> both version do save a None (actually all form.accepts, FORM.accepts,
> SQLFORM.accepts do).
>
> Wouldn't be the correct behavior to consistently and always convert a
> False value to 'F'? Am I missing something?
>
> Thanks a lot!
> Frederik
>
> On Wed, Jan 27, 2010 at 4:59 PM, mdipierro  wrote:
> > On a second look I believe FORM.accepts behave correctly. Since it is
> > not supposed to convert None to 'F'. Only SQLFORM.accepts does that.
>
> > On Jan 27, 8:24 am, mdipierro  wrote:
> >> Why
>
> >> def test1():
> >>     form=SQLFORM.factory(Field("bool","boolean"))
>
> >>     if FORM.accepts(form, request.vars, session, keepvalues=True):
> >>         db.test.insert(bool=request.vars.bool)
>
> >>     return dict(form=form,list=db().select(db.test.ALL))
>
> >> and not
>
> >> def test1():
> >>     form=SQLFORM.factory(Field("bool","boolean"))
>
> >>     if form.accepts(request.vars, session, keepvalues=True):
> >>         db.test.insert(bool=request.vars.bool)
>
> >>     return dict(form=form,list=db().select(db.test.ALL))
>
> >> ?
>
> >> Please check the latter, it should work fine. I check why the former
> >> does not.
>
> >> On Jan 27, 1:50 am, Frederik Wagner  wrote:
>
> >> > Hi .*,
>
> >> > it seems to me that there is a bug saving boolean fields with
> >> > SQLFORM.factory forms.
> >> > If I define a boolean field in a table and use the standard SQLFORM to
> >> > make an input form, the accept function will save 'T' of 'F' to the
> >> > DB.
> >> > Whereas in the case where I create a form with SQLFORM.factory, do a
> >> > FORM.accept and an explicit db.insert, instead of 'F' there will be a
> >> > NULL on the DB.
>
> >> > Here a test setup:
>
> >> > DB:
> >> > db.define_table('test',Field('bool','boolean'))
>
> >> > CONTROLLER:
> >> > def test1():
> >> >     form=SQLFORM.factory(Field("bool","boolean"))
>
> >> >     if FORM.accepts(form, request.vars, session, keepvalues=True):
> >> >         db.test.insert(bool=request.vars.bool)
>
> >> >     return dict(form=form,list=db().select(db.test.ALL))
>
> >> > def test2():
> >> >     form=SQLFORM(db.test)
>
> >> >     if form.accepts(request.vars, session, keepvalues=True):
> >> >         response.flash = 'done'
>
> >> >     return dict(form=form,list=db().select(db.test.ALL))
>
> >> > test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
> >> > 'False' ('F').
>
> >> > A bug or my problem? :-)
>
> >> > Bye
> >> > Frederik
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
form = crud.update(db.person, request.args(0), ...)

this will do an update if you have http://.../action/[id] and a create
if http://.../action


On Jan 28, 1:53 am, weheh  wrote:
> changing subject line

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Postgresql interface buggy

2010-01-28 Thread mdipierro
I will give this a try. This type of conversion should work unless
there is a problem with transactions that holds it up and timesout.

On Jan 28, 3:02 am, Johann Spies  wrote:
> On 28 January 2010 00:15, Thadeus Burgess  wrote:
>
> > This is most likely a bug, would you be willing to provide more
> > information on the matter?
>
> Example.  I have changed the type of a field from string (1024) to 'text'.
>
>
>
> > For simplicities sake, drop your tables with the DAL by doing
>
> > db.table.drop()
>
> If I remember correctly I have tried then and then get an "Invalid
> query" from the appamin interface afterwards.
>
>
>
> > Then you will have a fresh start when you remove this command.
>
> I have restarted web2py after the "drop" but in the end had to
> recreate the table using psql.
>
> Regards
> Johann

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Translations stopped working in 1.74.8

2010-01-28 Thread mdipierro
In which language is your app written in (pl, en, it)?
Do you have a:

T.current_language=['en']
T.force(request.env.http_accept_language)

in your code? We did change the behavior of languages at some point
from no default to default to english (we had a long discussions about
this here). This means if your app is not in english but you do not
explicitly declare the language, web2py thinks it is english and will
not translate it.

Massimo


On Jan 28, 4:14 am, ls1  wrote:
> Hello,
>
> I recently upgraded web2py from 1.62.2 to 1.74.8 and have following
> problem.
> The applications (even 'welcome' which comes with web2py) are not
> translated according to web browser language preferences.
>
> If I have set language preferences in web browser like:
>  'pl','en' -> I got all messages in english
>  'pl', 'it' -> I got all messages untranslated (in english)
>  'pl' only -> I got all messages correctly translated (in polish)
>  'it' only -> I got all messages correctly translated (in italian)
>
> Variable 'request.env.http_accept_language' looks to be correct in
> each case.
> I tried solutions from web2py internationalization tutorial posted on
> vimeo, but it didn't work.
>
> I test it with FF3.5 and IE8 and on different platforms: linux/apache
> and windows/built-in CherryPy.
> Same results.
>
> any ideas? bug or feature?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Using AS in DAL

2010-01-28 Thread mdipierro
the DAL allows you to use AS only for the purpose of renaming tables
in left joins, not for the purpose or renaming field names. The reason
it does not is that it would introduce a lot of complexity but not
necessarily provide a useful functionality. The new DAL will have the
ability to do he re-naming at the DAL level.

Perhaps I miss something? Why do you need this?

On Jan 28, 5:04 am, Khaled ElAdawy  wrote:
> I just want to map this simple query to DAL syntax:
> "SELECT field_name FROM table_name AS my_name"
>
> Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Mobile devices + web2py

2010-01-28 Thread mdipierro
http://www.web2py.com/examples/static/mobile_device_detect.py

On Jan 28, 6:01 am, tiago almeida  wrote:
> Hello,
> does web2py have any mechanism for dealing with mobile devices? I'm talking
> about *determining if the user is on a mobile device* so that pages can be
> tailored for those screens.
>
> I've searched in the book and in web2pyslices and don't see anything like
> that.
>
> Thanks a lot in advance,
> Tiago Almeida

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: dynamic content with jquery trigger/bind?

2010-01-28 Thread mdipierro
Yes. I have not tried it but something like this:

#IN default.py
def index(): return dict()
def a_form():
if request.env.request_method=='POST':
response.headers['web2py-component-command'] = \
'web2py_ajax_page("GET","%s","","a_list")' \
% URL(r=request,f='a_list')
return crud.create(db.table)
def a_list():
return SQLTABLE(db(db.table.id>0).select())

#IN views/default/index.html
{{extend 'layout.html'}}
loading form ...
{{=LOAD('default','a_form',ajax=True,target="my_form")}}
loading list ...
{{=LOAD('default','a_list',ajax=True,target="my_list")}}


The {{=LOAD(..)}} embeds the components (a_list, a_form) via ajax and
capture the response so that only components get updated on
submission). The code:

if request.env.request_method=='POST':
response.headers['web2py-component-command'] = \
'web2py_ajax_page("GET","%s","","a_list")' \
% URL(r=request,f='a_list')

returns instructions to the page when a form is submitted. It tells
the form to trigger an ajax call to the a_list component.

You may need to debug this a little.



On Jan 28, 6:07 am, selecta  wrote:
> Does anybody have some experiences with creating dynamic content with
> jquery?
> I know the signal/slot system from qt and I have the feeling that
> trigger/bind from jquery can do the same thing in web2py
>
> My idea is to have e.g. a list view (controller list) and a form
> (controller form). Both are loaded via ajax onto the same page, when
> the form is submitted (via ajax) and it has the right content the
> controller form will return the trigger that updates the list view
> (calls controller list).
> Is this possible? Am I thinking in the right direction?
>
> Please help or guide me into the right direction.
>
> If I am to unclear please tell me and I will try to find a better
> example

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Mobile devices + web2py

2010-01-28 Thread tiago almeida
Great! I missed that one.

Thank you very much,
Tiago
-
On Thu, Jan 28, 2010 at 3:15 PM, mdipierro  wrote:

> http://www.web2py.com/examples/static/mobile_device_detect.py
>
> On Jan 28, 6:01 am, tiago almeida  wrote:
> > Hello,
> > does web2py have any mechanism for dealing with mobile devices? I'm
> talking
> > about *determining if the user is on a mobile device* so that pages can
> be
> > tailored for those screens.
> >
> > I've searched in the book and in web2pyslices and don't see anything like
> > that.
> >
> > Thanks a lot in advance,
> > Tiago Almeida
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: state of documentation: why pdf?

2010-01-28 Thread mdipierro
In the Django world there are books (for sale) and there are other
forms of documentations (html, etc).
Nobody prevents you to write any documentation you like.

My job is write the book and I will concentrate on it. That is how can
justify the time I spend on web2py.

Massimo


On Jan 28, 6:49 am, pistacchio  wrote:
> On Jan 28, 12:48 pm, Richard  wrote:
>
> > This was brought up previously and the main obstacle (IIRC) is Massimo
> > needs publications to justify working on web2py for his university.
> > Hopefully a compromise can be reached.
>
> if this is the reason (and it is indeed a valid one), than nobody
> would keep us from having both a pdf and a html version. to start off,
> the internet version could a reorganization / htmlized version of the
> pdf, than we can expand it with examples, cross references, and keep
> it up to date with the changes made in various revisions. the
> university pdf, on the other hand, could expand and be kept updated
> with the material from the html version. my 2 cents.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: validator that creates select with options from list of tuples?

2010-01-28 Thread mdipierro
Could you please email this to me? The email reader messes up the
indentation.
Thank you.

P.S No problem with the name. I have been called Mr.Di which is
worse. ;-)

On Jan 26, 7:20 pm, selecta  wrote:
> IGNORE THE POST ABOVE
> NOW TRULY SOLVED
>
> The problem with the post above was that the validator was not order
> preserving, I added some lines to the IS_IN_SET constructor, not it
> truly works
>
>      
>        >>> IS_IN_SET([('a','max'), ('b','john')])('max')
>         ('a', None)
>     """
>
>     def __init__(
>         self,
>         theset,
>         labels=None,
>         error_message='value not allowed',
>         multiple=False,
>         zero='',
>         sort=False,
>         ):
>         self.multiple = multiple
>         self.labels = labels
>         if theset and len(theset[0])==2 and (isinstance(theset[0],
> list) or isinstance(theset[0], tuple)):
>             self.theset = [str(item) for item,label in theset]
>             self.labels = [str(label) for item,label in theset]
>         else:
>             self.theset = [str(item) for item in theset]
>         if isinstance(theset, dict):
>             self.labels = theset.values()
>         self.error_message = error_message
>         self.zero = zero
>         self.sort = sort
> 
> contrutor ends there
>
> maximo if you could add this code to the trunk it would be very nice
>
> On Jan 27, 12:07 am, selecta  wrote:
>
> > SOLVED
>
> > i thought i have to write my own validator, looking into IS_IN_SET i
> > stumbeled upon the following code in the first few lines
>
> >  if isinstance(theset, dict):
> >             self.labels = theset.values()
>
> > hmmm, lets try
>
> > folders = dict(folders)
> > db_webfolder.parent.requires = IS_IN_SET(folders)
> > form_file = SQLFORM(db_webfolder)
>
> > and it works!!!
>
> > maybe this should be documented somewhere, e.g. in the docstring of
> > IS_IN_SET! would make it at least a bit easier to find out
>
> > On Jan 26, 11:23 pm, selecta  wrote:
>
> > > oh it can ?:) sounds good, but still it solves only part of my
> > > problem, I also want to change what is shown to the user in option, I
> > > better show you what I want to do
>
> > >     def getfolders(root = 0, spaces = '-'):
> > >         folders = []
> > >         for f in db(db_webfolder.id>0)(db_webfolder.parent==root)
> > > (db_webfolder.file==None).select():
> > >             folders.append((f.id,spaces+f.name))
> > >             folders += getfolders(f.id, '-'+spaces)
> > >         return folders
>
> > >     folders = [(0,'root')]+getfolders()
> > >     form_folder = FORM(SELECT([OPTION(name,_value=id) for id,name in
> > > folders],_name='parent'),INPUT(_name='name'),INPUT
> > > (_type='submit',_value="create"))
>
> > > it should return something like
> > > 
> > > root
> > > -test
> > > --subfolder of test
> > > --another sub of test
> > > --another one
> > > -another folder
> > > -yet another
> > > -okok
> > > --tesing still
> > > 
>
> > > On Jan 26, 10:59 pm, Thadeus Burgess  wrote:
>
> > > > IS_IN_DB can use a query can't it?
>
> > > > -Thadeus
>
> > > > On Tue, Jan 26, 2010 at 3:46 PM, selecta  
> > > > wrote:
> > > > > Is there a validator that creates a select with options from a list of
> > > > > tuples
>
> > > > > what I want do do is
> > > > > Field("folder","integer",requires = IS_IN_TUPLELIST([('myfolder',12),
> > > > > ('subfoler',23)]))
>
> > > > > so that is creates
> > > > > SELECT([OPTION(name,_value=id) for name,id in [('myfolder',12),
> > > > > ('subfoler',23)] ],_name='parent'),INPUT(_name='name')
>
> > > > > in this case I cannot use IS_IN_DB because i need to filter the
> > > > > results from the table
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "web2py-users" group.
> > > > > To post to this group, send email to web...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to 
> > > > > web2py+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group 
> > > > > athttp://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Custom form doesn't submit

2010-01-28 Thread mdipierro
This is not a bug. Somehow your code is passing helpers instead of a
value. This is the wrong line:

SELECT(form.custom.inpval.filename,)

The arguments of select should be option items. They cannot be custom
widgets.

On Jan 28, 7:08 am, Adi  wrote:
> Update: I think I found a web2py bug.
>
> form.custom.inpval.filename is generating bad html code. The first
> option label of the html is this:
> 
>  value="Joker">JokerRiddler option>Twoface">
> Joker
> Riddler value="Twoface">Twoface
>
> 
>
> Basically the first  has nested inside itself what should be
> the actual  code. If I remove this in Firebug, the form
> submits. Am I using form.custom.inpval wrongly? Or is this a bug?
>
> On Jan 27, 9:58 am, Adi  wrote:
>
> > Hi Denes/Massimo,
>
> > Any inputs?
>
> > On Jan 25, 8:20 pm, Adi  wrote:
>
> > > Sorry I was posting the other reply so missed this: Responses inline.
>
> > > > You are appending to form1 so check:
> > > > 1) An INPUT named 'name', is it the only 'name' field in form1?
>
> > > Yes. names of all fields are different.
>
> > > > 2) Same for the SELECT, is there another 'gender' field?
>
> > > No. All fields are different.
>
> > > > 3) A second button named 'Add another' which will submit to the
> > > > controller that generated form1 (self-submission), is that what you
> > > > want?.
>
> > > A button in the same row as the insertedformwhich says "Add another"
> > > & submits the data to the same controller and function. So, Yes.
>
> > > > Denes.
>
> > > On Jan 25, 8:15 pm, DenesL  wrote:
>
> > > > On Jan 25, 6:35 am, Adi  wrote:
>
> > > > > Hi all,
>
> > > > > I'm trying to build acustomformin this fashion:
>
> > > > > There's a parent table and a child table (many one relationship). I've
> > > > > created a read-only SQLFORM for a record of the parent, and then I'm
> > > > > trying this:
>
> > > > > form1 = SQLFORM(db.parent, readonly=True)
>
> > > > > form2 = SQLFORM(db.child, keepopts=['gender'])
>
> > > > > form1[0].append(TR(INPUT(_type='text', name='name',
> > > > > requires=IS_NOT_EMPTY()), \
> > > > > SELECT(form2.custom.inpval.gender, name='gender'),\
> > > > > INPUT(_type='submit', _value='Add another'))
>
> > > > > This gives me the appearance of theformas I want, i.e., parent read-
> > > > > only record in aform, with additional single row of updateable child
> > > > >formwith "Add another" button. The secondformis to provide a drop-
> > > > > down list for 'gender'. However, in this case the "Add another" button
> > > > > doesn't submit, i.e, I can't get control in form1.accepts or
> > > > > form2.accepts.
>
> > > > > What am I doing wrong?
>
> > > > You are appending to form1 so check:
> > > > 1) An INPUT named 'name', is it the only 'name' field in form1?
> > > > 2) Same for the SELECT, is there another 'gender' field?
> > > > 3) A second button named 'Add another' which will submit to the
> > > > controller that generated form1 (self-submission), is that what you
> > > > want?.
>
> > > > Denes.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: input title attribute

2010-01-28 Thread mdipierro

form.element(_id='the_id_of_the_field')['_title']='the title of the
field'

This works. attributes must start with _. html.py is transparent to
them.


On Jan 28, 7:28 am, vihang  wrote:
> I am building the form directly from SQLFORM. But I tried many
> combinations using form.element and accessing the form array directly,
> but does not work. Supposedly 'title' is not there in the input helper
> (html.py) on the first place.
>
> On Jan 28, 4:37 pm, tiago almeida  wrote:
>
> > Have you tried using the optional parameter _title when building your INPUT
> > object?
>
> > INPUT( ..., _title="my Title", ...)
>
> > ---
>
> > On Thu, Jan 28, 2010 at 8:33 AM, vihang  wrote:
> > > Any idea how I can access or add 'title' attribute for input elements?
> > > Cannot see it anywhere in the html.py.
>
> > > 'title' is used for tooltips text.
>
> > > Thanks
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Using AS in DAL

2010-01-28 Thread Khaled ElAdawy
I need it to retrieve fields from the database dynamically according
to the current language,
Please refer to the example below:

MODEL:
..
Field('description_en', 'string',
label=str(T('Image Description'))+" "+str(T('EN')),
requires=[IS_NOT_EMPTY(), IS_LENGTH(maxsize=250, minsize=0)]
),
Field('description_ar', 'string',
label=str(T('Image Description'))+" "+str(T('AR')),
requires=[IS_NOT_EMPTY(), IS_LENGTH(maxsize=250, minsize=0)]
),
..

CONTROLLER:
..
query = eval('db.image.description_'+lang)
records = db(db.image.project_id==project_id).select(query AS
description)
...

VIEW: (One view for all languages)
..
{{for record in records:}}
{{=record.description}}
{{pass}}
..

However, I solved the problem by modifying the code as follows:

CONTROLLER:
..
query = eval('db.image.description_'+lang)
records = db(db.image.project_id==project_id).select(query)
...

VIEW:
..
{{for record in records:}}
{{=eval('record.description_'+lang)}}
{{pass}}
..

Regards,

On Jan 28, 5:13 pm, mdipierro  wrote:
> the DAL allows you to use AS only for the purpose of renaming tables
> in left joins, not for the purpose or renaming field names. The reason
> it does not is that it would introduce a lot of complexity but not
> necessarily provide a useful functionality. The new DAL will have the
> ability to do he re-naming at the DAL level.
>
> Perhaps I miss something? Why do you need this?
>
> On Jan 28, 5:04 am, Khaled ElAdawy  wrote:
>
>
>
> > I just want to map this simple query to DAL syntax:
> > "SELECT field_name FROM table_name AS my_name"
>
> > Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Using AS in DAL

2010-01-28 Thread mdipierro
I see. eval is dangerous. I would suggest:

description = 'description_'+lang
records = db(db.image.project_id==project_id).select(db.image
[description])
...
return dict(...,description=description,...)

VIEW:
..
{{for record in records:}}
{{=record[description]}}
{{pass}}
..

On Jan 28, 9:51 am, Khaled ElAdawy  wrote:
> I need it to retrieve fields from the database dynamically according
> to the current language,
> Please refer to the example below:
>
> MODEL:
> ..
> Field('description_en', 'string',
>     label=str(T('Image Description'))+" "+str(T('EN')),
>     requires=[IS_NOT_EMPTY(), IS_LENGTH(maxsize=250, minsize=0)]
> ),
> Field('description_ar', 'string',
>     label=str(T('Image Description'))+" "+str(T('AR')),
>     requires=[IS_NOT_EMPTY(), IS_LENGTH(maxsize=250, minsize=0)]
> ),
> ..
>
> CONTROLLER:
> ..
> query = eval('db.image.description_'+lang)
> records = db(db.image.project_id==project_id).select(query AS
> description)
> ...
>
> VIEW: (One view for all languages)
> ..
> {{for record in records:}}
> {{=record.description}}
> {{pass}}
> ..
>
> However, I solved the problem by modifying the code as follows:
>
> CONTROLLER:
> ..
> query = eval('db.image.description_'+lang)
> records = db(db.image.project_id==project_id).select(query)
> ...
>
> VIEW:
> ..
> {{for record in records:}}
> {{=eval('record.description_'+lang)}}
> {{pass}}
> ..
>
> Regards,
>
> On Jan 28, 5:13 pm, mdipierro  wrote:
>
> > the DAL allows you to use AS only for the purpose of renaming tables
> > in left joins, not for the purpose or renaming field names. The reason
> > it does not is that it would introduce a lot of complexity but not
> > necessarily provide a useful functionality. The new DAL will have the
> > ability to do he re-naming at the DAL level.
>
> > Perhaps I miss something? Why do you need this?
>
> > On Jan 28, 5:04 am, Khaled ElAdawy  wrote:
>
> > > I just want to map this simple query to DAL syntax:
> > > "SELECT field_name FROM table_name AS my_name"
>
> > > Regards,
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-28 Thread Thadeus Burgess
This is an issue with how different operating systems have different
methods for representing newline and as avid python developers we
should all know this :)

-Thadeus





On Wed, Jan 27, 2010 at 11:50 PM, mdipierro  wrote:
> I just run the test and you are right. It does not work.
>
> I also checked the original problem reported on this thread that
> started the discussion and I fail to reproduce it.
>
 writer=csv.writer(s,quoting=csv.QUOTE_MINIMAL)
 writer.writerow(['this','is\na','test',12])
 print s.getvalue()
> this,"is
> a",test,12
 reader=csv.reader(s,quoting=csv.QUOTE_MINIMAL)
 s.seek(0)
 for line in reader: print line
> ...
> ['this', 'is\x07', 'test', '12']
> ['this', 'is\na', 'test', '12']
>
>
> On Jan 27, 11:36 pm, Thadeus Burgess  wrote:
>> We can't have it exporting qoutes and then the import expecting the
>> qoutes to be minimal. Then the export/import functionality is broken
>> between itself =/
>>
>> I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
>> QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
>> with the option of better use-case in the new dal.
>>
>> Either way both import/export need to be the same.
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 11:16 PM, mdipierro  wrote:
>> > Oops. I was wrong. I did not do what I said. I just changed trunk so
>> > that import on import requires QUOTE_MINIMAL but on export applies
>> > QUOTE_NONNUMERIC.
>>
>> > So import does not change but new export should still be compatible
>> > with input. Am I wrong again?
>> > I did not try it yet. I am making a guess.
>>
>> > Massimo
>>
>> > On Jan 27, 11:01 pm, Thadeus Burgess  wrote:
>> >> Are you saying that from the csv module point of view, or from web2py
>> >> point of view?
>>
>> >> I just attempted a simple test attempting to export one of my old
>> >> files... it failed.
>>
>> >> Its no biggie, I just will specify my qoute type if I ever need to use
>> >> one of these old csv files.
>>
>> >> My only request is make an official changelog, and make a note about this!
>>
>> >> -Thadeus
>>
>> >> On Wed, Jan 27, 2010 at 10:55 PM, mdipierro  
>> >> wrote:
>> >> > ill not be a problem since this parameter only affects export
>> >> > not import. Because of the way it work
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-28 Thread mdipierro
than the issue is how we open the file, not how we parse it with csv.

On Jan 28, 10:35 am, Thadeus Burgess  wrote:
> This is an issue with how different operating systems have different
> methods for representing newline and as avid python developers we
> should all know this :)
>
> -Thadeus
>
> On Wed, Jan 27, 2010 at 11:50 PM, mdipierro  wrote:
> > I just run the test and you are right. It does not work.
>
> > I also checked the original problem reported on this thread that
> > started the discussion and I fail to reproduce it.
>
>  writer=csv.writer(s,quoting=csv.QUOTE_MINIMAL)
>  writer.writerow(['this','is\na','test',12])
>  print s.getvalue()
> > this,"is
> > a",test,12
>  reader=csv.reader(s,quoting=csv.QUOTE_MINIMAL)
>  s.seek(0)
>  for line in reader: print line
> > ...
> > ['this', 'is\x07', 'test', '12']
> > ['this', 'is\na', 'test', '12']
>
> > On Jan 27, 11:36 pm, Thadeus Burgess  wrote:
> >> We can't have it exporting qoutes and then the import expecting the
> >> qoutes to be minimal. Then the export/import functionality is broken
> >> between itself =/
>
> >> I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
> >> QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
> >> with the option of better use-case in the new dal.
>
> >> Either way both import/export need to be the same.
>
> >> -Thadeus
>
> >> On Wed, Jan 27, 2010 at 11:16 PM, mdipierro  
> >> wrote:
> >> > Oops. I was wrong. I did not do what I said. I just changed trunk so
> >> > that import on import requires QUOTE_MINIMAL but on export applies
> >> > QUOTE_NONNUMERIC.
>
> >> > So import does not change but new export should still be compatible
> >> > with input. Am I wrong again?
> >> > I did not try it yet. I am making a guess.
>
> >> > Massimo
>
> >> > On Jan 27, 11:01 pm, Thadeus Burgess  wrote:
> >> >> Are you saying that from the csv module point of view, or from web2py
> >> >> point of view?
>
> >> >> I just attempted a simple test attempting to export one of my old
> >> >> files... it failed.
>
> >> >> Its no biggie, I just will specify my qoute type if I ever need to use
> >> >> one of these old csv files.
>
> >> >> My only request is make an official changelog, and make a note about 
> >> >> this!
>
> >> >> -Thadeus
>
> >> >> On Wed, Jan 27, 2010 at 10:55 PM, mdipierro  
> >> >> wrote:
> >> >> > ill not be a problem since this parameter only affects export
> >> >> > not import. Because of the way it work
>
> >> > --
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "web2py-users" group.
> >> > To post to this group, send email to web...@googlegroups.com.
> >> > To unsubscribe from this group, send email to 
> >> > web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/web2py?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: wmd

2010-01-28 Thread Thadeus Burgess
Take a look at

http://code.google.com/p/blogitizor/source/browse/src/controllers/admin.py
line 280 starts the controller.

note lines 293-297 - setting wmd defaults

Look at

http://code.google.com/p/blogitizor/source/browse/src/views/admin/create.html

note lines
191-193 - sets wmd options
331 - initializes wmd, this will scan all textareas and convert them
to wmd unless they are of class wmd-ignore


-Thadeus





On Thu, Jan 28, 2010 at 5:00 AM, selecta  wrote:
> i showed in a slice that using a wysiwyg editor for markup is
> possible, why not use that instead of wysiwym
>
> On Jan 28, 9:52 am, Johann Spies  wrote:
>> Thadeus mentioned that he used WMD on his blog.
>>
>> I have tried to get it working by putting the following in layout.hml:
>>
>> 
>>   // to set WMD's options programatically, define a "wmd_options"
>> object with whatever settings
>>   // you want to override.  Here are the defaults:
>>   wmd_options = {
>>   // format sent to the server.  Use "Markdown" to return the markdown 
>> source.
>>   output: "HTML",
>>
>>   // line wrapping length for lists, blockquotes, etc.
>>   lineLength: 40,
>>
>>   // toolbar buttons.  Undo and redo get appended automatically.
>>   buttons: "bold italic | link blockquote code image | ol ul heading hr",
>>
>>   // option to automatically add WMD to the first textarea found.  See
>> apiExample.html for usage.
>>   autostart: true
>>   };
>> 
>> 
>> 
>> 
>>
>> But this seems to be ignored.
>>
>> As I understand the instructions this should be just before 
>> so I cannot see where else to put it.
>>
>> What am I doing wrong?
>>
>> Johann
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: state of documentation: why pdf?

2010-01-28 Thread Mengu
massimo,

so, are we able to write a documentation on web2py?

On Jan 28, 5:30 pm, mdipierro  wrote:
> In the Django world there are books (for sale) and there are other
> forms of documentations (html, etc).
> Nobody prevents you to write any documentation you like.
>
> My job is write the book and I will concentrate on it. That is how can
> justify the time I spend on web2py.
>
> Massimo
>
> On Jan 28, 6:49 am, pistacchio  wrote:
>
> > On Jan 28, 12:48 pm, Richard  wrote:
>
> > > This was brought up previously and the main obstacle (IIRC) is Massimo
> > > needs publications to justify working on web2py for his university.
> > > Hopefully a compromise can be reached.
>
> > if this is the reason (and it is indeed a valid one), than nobody
> > would keep us from having both a pdf and a html version. to start off,
> > the internet version could a reorganization / htmlized version of the
> > pdf, than we can expand it with examples, cross references, and keep
> > it up to date with the changes made in various revisions. the
> > university pdf, on the other hand, could expand and be kept updated
> > with the material from the html version. my 2 cents.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Mobile devices + web2py

2010-01-28 Thread Thadeus Burgess
wow Massimo where did that one creep out of the depths from!

Lol I never knew :)

-Thadeus





On Thu, Jan 28, 2010 at 9:27 AM, tiago almeida
 wrote:
> Great! I missed that one.
>
> Thank you very much,
> Tiago
> -
> On Thu, Jan 28, 2010 at 3:15 PM, mdipierro  wrote:
>>
>> http://www.web2py.com/examples/static/mobile_device_detect.py
>>
>> On Jan 28, 6:01 am, tiago almeida  wrote:
>> > Hello,
>> > does web2py have any mechanism for dealing with mobile devices? I'm
>> > talking
>> > about *determining if the user is on a mobile device* so that pages can
>> > be
>> > tailored for those screens.
>> >
>> > I've searched in the book and in web2pyslices and don't see anything
>> > like
>> > that.
>> >
>> > Thanks a lot in advance,
>> > Tiago Almeida
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] format zero IS_IN_DB

2010-01-28 Thread DenesL

Back in Jan.2/10 the default for zero was changed to ''
http://groups.google.com/group/web2py/msg/684a2374e7379861

Consider:
db.define_table('person',Field('name',unique=True), format='%(name)s')
db.define_table('dog',Field('name',unique=True),Field
('owner',db.person), format='%(name)s')

will generate a db.dog.owner dropdown with an empty option that IMO
should not be there since it is not part of the associated IS_IN_DB
requires.

Could you please explain to me why was zero='' made the default?

Denes.

PS: this also applies to IS_IN_SET but not in relation to
table._format e.g.

>>> r=IS_IN_SET((1,2,3))
>>> r.options()
[('', ''), ('1', '1'), ('2', '2'), ('3', '3')]

counter-intuitive.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Links and ajax

2010-01-28 Thread Jose
I'm trying to change a search form that uses ajax function.

Simplifying is a form with a dropbox and a button. What I want is
instead of displaying the dropbox is showing a series of links. The
problem is that as from the link I call the ajax function (...).


I currently have the following (works well):

def buscar():
profesiones = db().select(db.profesiones.ALL,
orderby=db.profesiones.profesion, cache=(cache.ram,3600))

sel_profesiones = SELECT(_name='id_profesion', _id='id_profesion',
*[OPTION(profesiones[i].profesion, _value=profesiones
[i].id) for i in range(len(profesiones))])

form = FORM(TABLE(
TR("Profesión:", sel_profesiones),
TR("", INPUT(_type="button", _value="Buscar",
_id="btn_buscar",
_onclick="ajax('bg_buscar',['id_profesion'],
'resultado');"))
))

return dict(form=form)

def bg_buscar():
registros = None
query = (db.profesionales.id_profesion ==
request.vars.id_profesion)
registros = db(query).select()

return dict(registros=registros)

i change for:

def buscar2():
profesiones = db().select(db.profesiones.ALL,
orderby=db.profesiones.profesion, cache=(cache.ram,3600))

return dict(profesiones=profesiones)


I do not know is how to assemble the view to call the ajax link (...).
I tried on this side but I could not do anything.

the view buscar2.html


{{for p in profesiones:}}
{{=A(p.profesion, _id="id_%d"%p.id, _href='#', _onclick="ajax
('bg_buscar2',['id_%d'],'resultado');"%p.id)}}
{{pass}}


José

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] format zero IS_IN_DB

2010-01-28 Thread Thadeus Burgess
http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e72960f6

Please follow the above thread.

Massimo said he was thinking about how to procede with the matter.


-Thadeus





On Thu, Jan 28, 2010 at 11:05 AM, DenesL  wrote:
>
> Back in Jan.2/10 the default for zero was changed to ''
> http://groups.google.com/group/web2py/msg/684a2374e7379861
>
> Consider:
> db.define_table('person',Field('name',unique=True), format='%(name)s')
> db.define_table('dog',Field('name',unique=True),Field
> ('owner',db.person), format='%(name)s')
>
> will generate a db.dog.owner dropdown with an empty option that IMO
> should not be there since it is not part of the associated IS_IN_DB
> requires.
>
> Could you please explain to me why was zero='' made the default?
>
> Denes.
>
> PS: this also applies to IS_IN_SET but not in relation to
> table._format e.g.
>
 r=IS_IN_SET((1,2,3))
 r.options()
> [('', ''), ('1', '1'), ('2', '2'), ('3', '3')]
>
> counter-intuitive.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] New site in web2py

2010-01-28 Thread Leandro - ProfessionalIT
Friends,

The new site in web2py made by my company: ProfessionalIT.

KZero Consultoria: http://www.kzeroconsultoria.com.br

-- Leandro.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: New site in web2py

2010-01-28 Thread pistacchio
Gratz :) Looks good to me

On Jan 28, 6:45 pm, Leandro - ProfessionalIT 
wrote:
> Friends,
>
>     The new site in web2py made by my company: ProfessionalIT.
>
>     KZero Consultoria:http://www.kzeroconsultoria.com.br
>
> -- Leandro.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: format zero IS_IN_DB

2010-01-28 Thread DenesL
Thanks, I've seen it.

The problem with format and IS_IN_DB can be easily fixed in sql.py but
I would be against setting the default of zero to '' in IS_IN_DB and
IS_IN_SET if it creates an empty option in the dropdown.

zero seems to have been introduced to display a "choose a value" kind
of message as the first option in the dropdown, and it should be
explicitly set when required, not explicity removed when not required,
i.e. having to set zero=None if you do not want the empty option,
which should not have been there to begin with.

Denes.

On Jan 28, 12:25 pm, Thadeus Burgess  wrote:
> http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e7...
>
> Please follow the above thread.
>
> Massimo said he was thinking about how to procede with the matter.
>
> -Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: state of documentation: why pdf?

2010-01-28 Thread Albert Abril
Mengu: why not?
Any new documentation is welcome.

On Thu, Jan 28, 2010 at 5:50 PM, Mengu  wrote:

> massimo,
>
> so, are we able to write a documentation on web2py?
>
> On Jan 28, 5:30 pm, mdipierro  wrote:
> > In the Django world there are books (for sale) and there are other
> > forms of documentations (html, etc).
> > Nobody prevents you to write any documentation you like.
> >
> > My job is write the book and I will concentrate on it. That is how can
> > justify the time I spend on web2py.
> >
> > Massimo
> >
> > On Jan 28, 6:49 am, pistacchio  wrote:
> >
> > > On Jan 28, 12:48 pm, Richard  wrote:
> >
> > > > This was brought up previously and the main obstacle (IIRC) is
> Massimo
> > > > needs publications to justify working on web2py for his university.
> > > > Hopefully a compromise can be reached.
> >
> > > if this is the reason (and it is indeed a valid one), than nobody
> > > would keep us from having both a pdf and a html version. to start off,
> > > the internet version could a reorganization / htmlized version of the
> > > pdf, than we can expand it with examples, cross references, and keep
> > > it up to date with the changes made in various revisions. the
> > > university pdf, on the other hand, could expand and be kept updated
> > > with the material from the html version. my 2 cents.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Mobile devices + web2py

2010-01-28 Thread Jason Brower
And if you need something more advanced than that... pywurfl is very
good.  Tells all the capabilities of the phone as well.  Even things
like if it has a camera and the screensizes.  Very powerful.  Used it in
my thesis project in web2py. (woot woot)
BR,
Jason Brower
On Thu, 2010-01-28 at 10:53 -0600, Thadeus Burgess wrote: 
> wow Massimo where did that one creep out of the depths from!
> 
> Lol I never knew :)
> 
> -Thadeus
> 
> 
> 
> 
> 
> On Thu, Jan 28, 2010 at 9:27 AM, tiago almeida
>  wrote:
> > Great! I missed that one.
> >
> > Thank you very much,
> > Tiago
> > -
> > On Thu, Jan 28, 2010 at 3:15 PM, mdipierro  wrote:
> >>
> >> http://www.web2py.com/examples/static/mobile_device_detect.py
> >>
> >> On Jan 28, 6:01 am, tiago almeida  wrote:
> >> > Hello,
> >> > does web2py have any mechanism for dealing with mobile devices? I'm
> >> > talking
> >> > about *determining if the user is on a mobile device* so that pages can
> >> > be
> >> > tailored for those screens.
> >> >
> >> > I've searched in the book and in web2pyslices and don't see anything
> >> > like
> >> > that.
> >> >
> >> > Thanks a lot in advance,
> >> > Tiago Almeida
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "web2py-users" group.
> >> To post to this group, send email to web...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> web2py+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/web2py?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/web2py?hl=en.
> >
> 


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: format zero IS_IN_DB

2010-01-28 Thread Thadeus Burgess
My thoughts exactly :)

-Thadeus





On Thu, Jan 28, 2010 at 12:55 PM, DenesL  wrote:
> Thanks, I've seen it.
>
> The problem with format and IS_IN_DB can be easily fixed in sql.py but
> I would be against setting the default of zero to '' in IS_IN_DB and
> IS_IN_SET if it creates an empty option in the dropdown.
>
> zero seems to have been introduced to display a "choose a value" kind
> of message as the first option in the dropdown, and it should be
> explicitly set when required, not explicity removed when not required,
> i.e. having to set zero=None if you do not want the empty option,
> which should not have been there to begin with.
>
> Denes.
>
> On Jan 28, 12:25 pm, Thadeus Burgess  wrote:
>> http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e7...
>>
>> Please follow the above thread.
>>
>> Massimo said he was thinking about how to procede with the matter.
>>
>> -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Copy tables from existing table

2010-01-28 Thread Thadeus Burgess
Is there a way to iterate through the Field() elements of a table and
use them to create another similar table ?

I'm looking for something like

db.define_table('hi', Field('hello'), Field('world'))

class Foo()
   def init(atable):
  for field in atable:
 db.define_table(tablename + '_mod', field, field, field,
Field('bar', 'datetime'))

So I would end up with

db.hi and db.hi_mod.

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: state of documentation: why pdf?

2010-01-28 Thread mdipierro
You need my permission. You need my permission only if you cut and
paste text from the book.

I can tell you right now that you are free to use all the code example
from the book as well as pictures but not the English text to avoid
copyright problems with the publisher. Exceptions can be made for
specific parts.

Massimo

On Jan 28, 10:50 am, Mengu  wrote:
> massimo,
>
> so, are we able to write a documentation on web2py?
>
> On Jan 28, 5:30 pm, mdipierro  wrote:
>
> > In the Django world there are books (for sale) and there are other
> > forms of documentations (html, etc).
> > Nobody prevents you to write any documentation you like.
>
> > My job is write the book and I will concentrate on it. That is how can
> > justify the time I spend on web2py.
>
> > Massimo
>
> > On Jan 28, 6:49 am, pistacchio  wrote:
>
> > > On Jan 28, 12:48 pm, Richard  wrote:
>
> > > > This was brought up previously and the main obstacle (IIRC) is Massimo
> > > > needs publications to justify working on web2py for his university.
> > > > Hopefully a compromise can be reached.
>
> > > if this is the reason (and it is indeed a valid one), than nobody
> > > would keep us from having both a pdf and a html version. to start off,
> > > the internet version could a reorganization / htmlized version of the
> > > pdf, than we can expand it with examples, cross references, and keep
> > > it up to date with the changes made in various revisions. the
> > > university pdf, on the other hand, could expand and be kept updated
> > > with the material from the html version. my 2 cents.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Mobile devices + web2py

2010-01-28 Thread mdipierro
LOL. I do not know it is time stamped as 2009-07-11. I do not remember
why I wrote it. Somebody must have asked for it in the past.

On Jan 28, 10:53 am, Thadeus Burgess  wrote:
> wow Massimo where did that one creep out of the depths from!
>
> Lol I never knew :)
>
> -Thadeus
>
> On Thu, Jan 28, 2010 at 9:27 AM, tiago almeida
>
>  wrote:
> > Great! I missed that one.
>
> > Thank you very much,
> > Tiago
> > -
> > On Thu, Jan 28, 2010 at 3:15 PM, mdipierro  wrote:
>
> >>http://www.web2py.com/examples/static/mobile_device_detect.py
>
> >> On Jan 28, 6:01 am, tiago almeida  wrote:
> >> > Hello,
> >> > does web2py have any mechanism for dealing with mobile devices? I'm
> >> > talking
> >> > about *determining if the user is on a mobile device* so that pages can
> >> > be
> >> > tailored for those screens.
>
> >> > I've searched in the book and in web2pyslices and don't see anything
> >> > like
> >> > that.
>
> >> > Thanks a lot in advance,
> >> > Tiago Almeida
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "web2py-users" group.
> >> To post to this group, send email to web...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> web2py+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/web2py?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Mobile devices + web2py

2010-01-28 Thread tiago almeida
Looks great. Thanks :)

On Thu, Jan 28, 2010 at 6:57 PM, Jason Brower  wrote:

> And if you need something more advanced than that... pywurfl is very
> good.  Tells all the capabilities of the phone as well.  Even things
> like if it has a camera and the screensizes.  Very powerful.  Used it in
> my thesis project in web2py. (woot woot)
> BR,
> Jason Brower
> On Thu, 2010-01-28 at 10:53 -0600, Thadeus Burgess wrote:
> > wow Massimo where did that one creep out of the depths from!
> >
> > Lol I never knew :)
> >
> > -Thadeus
> >
> >
> >
> >
> >
> > On Thu, Jan 28, 2010 at 9:27 AM, tiago almeida
> >  wrote:
> > > Great! I missed that one.
> > >
> > > Thank you very much,
> > > Tiago
> > > -
> > > On Thu, Jan 28, 2010 at 3:15 PM, mdipierro 
> wrote:
> > >>
> > >> http://www.web2py.com/examples/static/mobile_device_detect.py
> > >>
> > >> On Jan 28, 6:01 am, tiago almeida  wrote:
> > >> > Hello,
> > >> > does web2py have any mechanism for dealing with mobile devices? I'm
> > >> > talking
> > >> > about *determining if the user is on a mobile device* so that pages
> can
> > >> > be
> > >> > tailored for those screens.
> > >> >
> > >> > I've searched in the book and in web2pyslices and don't see anything
> > >> > like
> > >> > that.
> > >> >
> > >> > Thanks a lot in advance,
> > >> > Tiago Almeida
> > >>
> > >> --
> > >> You received this message because you are subscribed to the Google
> Groups
> > >> "web2py-users" group.
> > >> To post to this group, send email to web...@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> web2py+unsubscr...@googlegroups.com
> .
> > >> For more options, visit this group at
> > >> http://groups.google.com/group/web2py?hl=en.
> > >>
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group at
> > > http://groups.google.com/group/web2py?hl=en.
> > >
> >
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] RSS Example

2010-01-28 Thread Chris
Hi,
The RSS example in the book (page 80) uses relative URLs for the item
links which aren't clickable when viewed in Firefox or work in other
RSS readers. Is it possible to generate absolute urls for that example
that will work?

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] library app

2010-01-28 Thread mdipierro
http://www.reddit.com/r/Python/comments/av2r8/creating_school_library_website_best_way/c0jkyqy

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Massimo, I don't see how that could possibly work if there's no
request.args(0)? In fact, I tried it and got an "invalid function"
error. Wouldn't I first have to test not len(request.args(0)) and if
True then create else update? This seems obvious, but it seems that
crud is so compact that it might already be testing that condition,
no?

On Jan 28, 10:02 am, mdipierro  wrote:
> form = crud.update(db.person, request.args(0), ...)
>
> this will do an update if you havehttp://.../action/[id] and a create
> ifhttp://.../action
>
> On Jan 28, 1:53 am, weheh  wrote:
>
>
>
> > changing subject line- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread weheh
Hi Alexandre, yes I understand that, but it's not really the root of
my question. The question is whether to create special fields in my
records for holding the translated text, or use the built-in
translation mechanism of web2py?

On Jan 28, 9:57 am, Alexandre Andrade 
wrote:
> everything is passed by T('anything') go to languages/my_ln.py (like
> en_us.py).
>
> So you have to manually translate the strings on that file.
>
> 2010/1/28 weheh 
>
>
>
>
>
> > I haven't really worked with translation, yet. But I'm going to be
> > getting into it in a big way. I have
>
> > db.define_table('content',Field('title'),Field('body'))
>
> > I want to enter title and body in English, but then translate to other
> > languages.
> > Let's say I do this:
>
> > rows=db(db.content.id>0).select()
> > for row in rows:
> >  trans_title=T(row.title)
> >  trans_body=T(row.body)
>
> > Will something like that work?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.
>
> --
> Atenciosamente
>
> --
> =
> Alexandre Andrade
> Hipercenter.com- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread rāma
Wow that's an amazing site in 200 lines code !

On Jan 29, 4:28 am, mdipierro  wrote:
> http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
request.args[0] fails if there is no request.args. request.args(i)
never fails returns None instead.
If you pass None as second argument to crud.update it behaves as
crud.create. ;-)

On Jan 28, 2:33 pm, weheh  wrote:
> Massimo, I don't see how that could possibly work if there's no
> request.args(0)? In fact, I tried it and got an "invalid function"
> error. Wouldn't I first have to test not len(request.args(0)) and if
> True then create else update? This seems obvious, but it seems that
> crud is so compact that it might already be testing that condition,
> no?
>
> On Jan 28, 10:02 am, mdipierro  wrote:
>
> > form = crud.update(db.person, request.args(0), ...)
>
> > this will do an update if you havehttp://.../action/[id] and a create
> > ifhttp://.../action
>
> > On Jan 28, 1:53 am, weheh  wrote:
>
> > > changing subject line- Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread mdipierro
In my view, if you want to translate values in database, you should
arrange for translations to also be in db.
You can just use T but you do not want translation files to increase
when the db grows else everything can become slow.

On Jan 28, 2:41 pm, weheh  wrote:
> Hi Alexandre, yes I understand that, but it's not really the root of
> my question. The question is whether to create special fields in my
> records for holding the translated text, or use the built-in
> translation mechanism of web2py?
>
> On Jan 28, 9:57 am, Alexandre Andrade 
> wrote:
>
> > everything is passed by T('anything') go to languages/my_ln.py (like
> > en_us.py).
>
> > So you have to manually translate the strings on that file.
>
> > 2010/1/28 weheh 
>
> > > I haven't really worked with translation, yet. But I'm going to be
> > > getting into it in a big way. I have
>
> > > db.define_table('content',Field('title'),Field('body'))
>
> > > I want to enter title and body in English, but then translate to other
> > > languages.
> > > Let's say I do this:
>
> > > rows=db(db.content.id>0).select()
> > > for row in rows:
> > >  trans_title=T(row.title)
> > >  trans_body=T(row.body)
>
> > > Will something like that work?
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
>
> > --
> > Atenciosamente
>
> > --
> > =
> > Alexandre Andrade
> > Hipercenter.com- Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread mdipierro
Technically all models and controller is 168 lines of code (including
scaffolding code).

The default layout is 94 lines of html and the rest of views amount to
72 lines total.

Massimo

On Jan 28, 3:08 pm, rāma  wrote:
> Wow that's an amazing site in 200 lines code !
>
> On Jan 29, 4:28 am, mdipierro  wrote:
>
> >http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread rāma
Have/Can you released the source? Would love to look at it.

On Jan 29, 5:27 am, mdipierro  wrote:
> Technically all models and controller is 168 lines of code (including
> scaffolding code).
>
> The default layout is 94 lines of html and the rest of views amount to
> 72 lines total.
>
> Massimo
>
> On Jan 28, 3:08 pm, rāma  wrote:
>
>
>
> > Wow that's an amazing site in 200 lines code !
>
> > On Jan 29, 4:28 am, mdipierro  wrote:
>
> > >http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread mdipierro
It is there. There is a download link at the top of the search page.
It requires web2py to open it.

On Jan 28, 3:45 pm, rāma  wrote:
> Have/Can you released the source? Would love to look at it.
>
> On Jan 29, 5:27 am, mdipierro  wrote:
>
> > Technically all models and controller is 168 lines of code (including
> > scaffolding code).
>
> > The default layout is 94 lines of html and the rest of views amount to
> > 72 lines total.
>
> > Massimo
>
> > On Jan 28, 3:08 pm, rāma  wrote:
>
> > > Wow that's an amazing site in 200 lines code !
>
> > > On Jan 29, 4:28 am, mdipierro  wrote:
>
> > > >http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread mdipierro
reddit is down. I repost a direct link:

http://we2py.com/library

It would be great if one of you adopts this code and turn it into a
production system (perhaps linking amazon to automatically update book
info from ISBN and making the interface more customizable).





On Jan 28, 3:53 pm, mdipierro  wrote:
> It is there. There is a download link at the top of the search page.
> It requires web2py to open it.
>
> On Jan 28, 3:45 pm, rāma  wrote:
>
> > Have/Can you released the source? Would love to look at it.
>
> > On Jan 29, 5:27 am, mdipierro  wrote:
>
> > > Technically all models and controller is 168 lines of code (including
> > > scaffolding code).
>
> > > The default layout is 94 lines of html and the rest of views amount to
> > > 72 lines total.
>
> > > Massimo
>
> > > On Jan 28, 3:08 pm, rāma  wrote:
>
> > > > Wow that's an amazing site in 200 lines code !
>
> > > > On Jan 29, 4:28 am, mdipierro  wrote:
>
> > > > >http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Two domains, two web2py instances, two apps, same database

2010-01-28 Thread howesc
I agree with the 2 apps in one installation of web2py at minimum.  2
installations of web2py sounds like a maintenance nightmare to me.

Is it possible to write a virtual host so that a certain domain may
only see certain controllers in a web2py application?  i suspect that
it is, but getting the allows and denys tags right for apache might be
a pain, though it might be easier to maintain in the long run.

Is there any reason that you can't just use web2py groups and access
control decorators on the controller functions to restrict access?

cfh

On Jan 28, 6:41 am, Alexandre Andrade 
wrote:
> I think your proposed setup is good, with two virtual hosts.
>
> I just recomend append "migrate=false" to tables that appear in
> example.com(accounts, or auth_user)
>
> Could be also just apps in one installation of web2py, if you adjust one of
> your virtual hosts.
>
> 2010/1/28 Thadeus Burgess 
>
>
>
> > Here are my needs.
>
> > example.com = public portion of the website. This includes anything
> > publicly accessible, and allows new accounts to be created. Only needs
> > access to one table, accounts table.
> > dashboard.example.com = internal portion of the website, which
> > includes all account management functions, but of course linked to the
> > same database, but has access to many more tables.
>
> > In this setup, I would run two apache virtualhosts, and two
> > installations of web2py. I will define my models in a module that they
> > can be imported to each app.
>
> > Each app will of course have a different set of
> > controllers/views/static etc etc.
>
> > And dashboard.example.com will be force https, IP restricted (by
> > apache), htpasswd, web2py passwd, etc.. etc..
>
> > Is this an appropriate setup for this? Would having one app that
> > checks request.env.http_host and route based on this a better
> > solution?
>
> > What would be the correct way to design the models so they can be
> > imported instead of "exectued", like Admin but I need them to unpack
> > into the web2py global namespace. Since I am on linux, would symlinks
> > be a better approach I could store just the accounts table in one
> > file, and symlink that to both apps from a central "projects" folder.
>
> > Thoughts, suggestions, ideas?
>
> > -Thadeus
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.
>
> --
> Atenciosamente
>
> --
> =
> Alexandre Andrade
> Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Copy tables from existing table

2010-01-28 Thread DenesL

db.define_table('newname',*[f for f in db.table])


On Jan 28, 2:20 pm, Thadeus Burgess  wrote:
> Is there a way to iterate through the Field() elements of a table and
> use them to create another similar table ?
>
> I'm looking for something like
>
> db.define_table('hi', Field('hello'), Field('world'))
>
> class Foo()
>def init(atable):
>   for field in atable:
>  db.define_table(tablename + '_mod', field, field, field,
> Field('bar', 'datetime'))
>
> So I would end up with
>
> db.hi and db.hi_mod.
>
> -Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Two domains, two web2py instances, two apps, same database

2010-01-28 Thread mdipierro
All these things are possible. The issue is that the easiest way
depends on details.
You can create virtual hosts in apache
You can use routes to filter based on hostname (it is in the book)
You can have apps block access becased on more complex conditions.

On Jan 28, 4:10 pm, howesc  wrote:
> I agree with the 2 apps in one installation of web2py at minimum.  2
> installations of web2py sounds like a maintenance nightmare to me.
>
> Is it possible to write a virtual host so that a certain domain may
> only see certain controllers in a web2py application?  i suspect that
> it is, but getting the allows and denys tags right for apache might be
> a pain, though it might be easier to maintain in the long run.
>
> Is there any reason that you can't just use web2py groups and access
> control decorators on the controller functions to restrict access?
>
> cfh
>
> On Jan 28, 6:41 am, Alexandre Andrade 
> wrote:
>
> > I think your proposed setup is good, with two virtual hosts.
>
> > I just recomend append "migrate=false" to tables that appear in
> > example.com(accounts, or auth_user)
>
> > Could be also just apps in one installation of web2py, if you adjust one of
> > your virtual hosts.
>
> > 2010/1/28 Thadeus Burgess 
>
> > > Here are my needs.
>
> > > example.com = public portion of the website. This includes anything
> > > publicly accessible, and allows new accounts to be created. Only needs
> > > access to one table, accounts table.
> > > dashboard.example.com = internal portion of the website, which
> > > includes all account management functions, but of course linked to the
> > > same database, but has access to many more tables.
>
> > > In this setup, I would run two apache virtualhosts, and two
> > > installations of web2py. I will define my models in a module that they
> > > can be imported to each app.
>
> > > Each app will of course have a different set of
> > > controllers/views/static etc etc.
>
> > > And dashboard.example.com will be force https, IP restricted (by
> > > apache), htpasswd, web2py passwd, etc.. etc..
>
> > > Is this an appropriate setup for this? Would having one app that
> > > checks request.env.http_host and route based on this a better
> > > solution?
>
> > > What would be the correct way to design the models so they can be
> > > imported instead of "exectued", like Admin but I need them to unpack
> > > into the web2py global namespace. Since I am on linux, would symlinks
> > > be a better approach I could store just the accounts table in one
> > > file, and symlink that to both apps from a central "projects" folder.
>
> > > Thoughts, suggestions, ideas?
>
> > > -Thadeus
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
>
> > --
> > Atenciosamente
>
> > --
> > =
> > Alexandre Andrade
> > Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Copy tables from existing table

2010-01-28 Thread mdipierro
Or

db.define_table('newname',db.othertable)

On Jan 28, 4:19 pm, DenesL  wrote:
> db.define_table('newname',*[f for f in db.table])
>
> On Jan 28, 2:20 pm, Thadeus Burgess  wrote:
>
> > Is there a way to iterate through the Field() elements of a table and
> > use them to create another similar table ?
>
> > I'm looking for something like
>
> > db.define_table('hi', Field('hello'), Field('world'))
>
> > class Foo()
> >    def init(atable):
> >       for field in atable:
> >          db.define_table(tablename + '_mod', field, field, field,
> > Field('bar', 'datetime'))
>
> > So I would end up with
>
> > db.hi and db.hi_mod.
>
> > -Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] screencast requests

2010-01-28 Thread Mengu
hi everyone,

if you guys have screencast requests on web2py, please let me know.
i'd happily record.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: screencast requests

2010-01-28 Thread mdipierro
Since I just make this http://www.web2py.com/library
It would be nice to make a screencast that goes over the source code
line by line.
But I have not time.

Massimo

On Jan 28, 4:32 pm, Mengu  wrote:
> hi everyone,
>
> if you guys have screencast requests on web2py, please let me know.
> i'd happily record.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: library app

2010-01-28 Thread rāma
oops i missed it out of excitement!

On Jan 29, 6:03 am, mdipierro  wrote:
> reddit is down. I repost a direct link:
>
> http://we2py.com/library
>
> It would be great if one of you adopts this code and turn it into a
> production system (perhaps linking amazon to automatically update book
> info from ISBN and making the interface more customizable).
>
> On Jan 28, 3:53 pm, mdipierro  wrote:
>
>
>
> > It is there. There is a download link at the top of the search page.
> > It requires web2py to open it.
>
> > On Jan 28, 3:45 pm, rāma  wrote:
>
> > > Have/Can you released the source? Would love to look at it.
>
> > > On Jan 29, 5:27 am, mdipierro  wrote:
>
> > > > Technically all models and controller is 168 lines of code (including
> > > > scaffolding code).
>
> > > > The default layout is 94 lines of html and the rest of views amount to
> > > > 72 lines total.
>
> > > > Massimo
>
> > > > On Jan 28, 3:08 pm, rāma  wrote:
>
> > > > > Wow that's an amazing site in 200 lines code !
>
> > > > > On Jan 29, 4:28 am, mdipierro  wrote:
>
> > > > > >http://www.reddit.com/r/Python/comments/av2r8/creating_school_library...

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] screencast requests

2010-01-28 Thread Alex Fanjul
I think screencast is one of the best way to learn about something so 
thank you for you offering Mengu.
If you accept one of mine, I would like to see something about using 
web2py and smartphones (iphones, android, etc.) maybe with JSON or so.
The only example for JSON crud its in sahana code but its too much 
difficult for me.


Maybe you also could take some posible interesting topics and do a 
survey  to ask for vote one of them.


thanks
alex

El 28/01/2010 23:32, Mengu escribió:

hi everyone,

if you guys have screencast requests on web2py, please let me know.
i'd happily record.

   


--
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Copy tables from existing table

2010-01-28 Thread Thadeus Burgess
Sometimes I think to myself and say, "Why didn't I just try that!"

Thank you, both of you!

-Thadeus





On Thu, Jan 28, 2010 at 4:27 PM, mdipierro  wrote:
> Or
>
> db.define_table('newname',db.othertable)
>
> On Jan 28, 4:19 pm, DenesL  wrote:
>> db.define_table('newname',*[f for f in db.table])
>>
>> On Jan 28, 2:20 pm, Thadeus Burgess  wrote:
>>
>> > Is there a way to iterate through the Field() elements of a table and
>> > use them to create another similar table ?
>>
>> > I'm looking for something like
>>
>> > db.define_table('hi', Field('hello'), Field('world'))
>>
>> > class Foo()
>> >    def init(atable):
>> >       for field in atable:
>> >          db.define_table(tablename + '_mod', field, field, field,
>> > Field('bar', 'datetime'))
>>
>> > So I would end up with
>>
>> > db.hi and db.hi_mod.
>>
>> > -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: get or insert shortcut

2010-01-28 Thread Richard
I guess these don't exist so I've created my own versions, pasted
below. Would it be worth including something like this in the DAL?


def get_or_create(table, fields):
"""
Return ID of record from table with passed field values. Create
record if does not exist.

'table' is a DAL table reference, such as 'db.person'
'fields' is a dict, such as {'parent': 4, name: 'Richard'}
"""
logic = None
for field, value in fields.items():
e = table[field] == value
logic = e if logic is None else logic & e
record = db(logic).select(table['id']).first()
if record:
return record.id
else:
return table.insert(**fields).id


def update_or_create(table, required_fields, updated_fields):
"""
Modify record from table that matches 'required_fields' with
'updated_fields'.
If record with 'required_fields' does not exist then create it.

'table' is a DAL table reference, such as 'db.person'
'required_fields' and 'updated_fields' are dicts, such as
{'parent': 4, name: 'Richard'}
"""
logic = None
for field, value in required_fields.items():
e = table[field] == value
logic = e if logic is None else logic & e
record = db(logic).select().first()
if record is None:
record = table.insert(**required_fields)
record.update_record(**updated_fields)



On Jan 28, 11:24 pm, Richard  wrote:
> I want to get the ID of a record with certain fields, and create it if
> not already existing. Is there a shortcut for this common operation?
> In Django it is called "get_or_create()"
>
> Also, is there a shortcut for update_or_create()?
>
> Thanks,
> Richard

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread weheh
Thanks, understood.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question [ RESOLVED]

2010-01-28 Thread weheh
Thanks, Massimo. Understood.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread Christopher Steel
Hi Richard,

Translations get a little more complicated than most people expect.
Here are a few things you want to watch out for:

Your site will have a default language. This is the language of the
strings placed in the T functions. Generally speaking most people
choose English simply because most web applications, including Web2py,
where programmed in english and use T with English strings throughout.
So even though I am doing a site for mostly Francophones, my "default"
site language is English. Usually you would place something like the
following in db.py for this purpose

Language Switching. Many multilingual sites need to have a mecanisim
in order to allow users to change the default language of the site
content in addition to the sites functional language. This can be
accomplished via a controller and something like the following at the
top of db.py (just under the first line is generally a good place)

###
## Internationalization
## Requires a controller, view and menu item to allow users to change
languages on the
## fly.
##
# T.current_languages=['en','en-us'] is our applications default
language. Generally
# speaking you may want this to be English, even for sites that are
not "in english".
# This represents the language of the stings that get translated using
the "T".
T.current_languages=['en','en-us']
# If I (or a user) calls with a request var _language then we want to
store it.
if request.vars._language:
session._language=request.vars._language
#
if session._language: T.force(session._language)

Allowing Users to change languages

Menu item example

{{=T('language')}} : {{=session._language}}






db.define_table('page',
Field('title'),
Field('body', 'text'),
Field('created_on', 'datetime', default=request.now),
Field('created_by', db.auth_user, default=user_id),
Field('active', 'boolean'),
Field('language'))



On Jan 28, 3:28 am, weheh  wrote:
> I haven't really worked with translation, yet. But I'm going to be
> getting into it in a big way. I have
>
> db.define_table('content',Field('title'),Field('body'))
>
> I want to enter title and body in English, but then translate to other
> languages.
> Let's say I do this:
>
> rows=db(db.content.id>0).select()
> for row in rows:
>   trans_title=T(row.title)
>   trans_body=T(row.body)
>
> Will something like that work?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: get or insert shortcut

2010-01-28 Thread mdipierro
This

logic = None
for field, value in fields.items():
e = table[field] == value
logic = e if logic is None else logic & e
record = db(logic).select(table['id']).first()

does not do what you think it does.

I think you want:

logic=reduce(lambda a,b:a&b,[table[k]==fields[k] for k in fields])
record = db(logic).select().first()

On Jan 28, 6:24 am, Richard  wrote:
> I want to get the ID of a record with certain fields, and create it if
> not already existing. Is there a shortcut for this common operation?
> In Django it is called "get_or_create()"
>
> Also, is there a shortcut for update_or_create()?
>
> Thanks,
> Richard

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Hi Massimo, I'm sorry, but I don't understand how to do this. I tried
the following:

#controller
def junk():
  form = crud.update(db.content,request.args(2),next=request.url)
  rows=crud.select(...)
  return dict(form=form,rows=rows)

Record creation works OK. But when I click on a rows record id,
expecting the form to populate and then update when I submit, I get an
invalid function error.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread Christopher Steel
Whoops, I pressed send by accident...

Anyway you can checkout:

http://kenai.com/projects/universalcake/

for an example of the language changing mechanism.

As far as the database, you will have a record id (the automatic
index) but you may require a semi-unique field that ties all your
translations of one source document together. I use the title.

db.define_table('page',
Field('title'),
Field('section_id', db.section),
Field('body', 'text'),
Field('created_on', 'datetime', default=request.now),
Field('created_by', db.auth_user, default=user_id),
Field('active', 'boolean'),
Field('language')) # Field for language (ie. en for
example)

Selecting entires

Controller examples:
wiki.py

def show_active():
pages = db(db.page.active=='True').select(db.page.id,
db.page.title, orderby=db.page.title)

return dict(pages=pages)

def show_english():
pages = db(db.page.language=='en').select(db.page.id,
db.page.title, orderby=db.page.title)
return dict(pages=pages)

def show_active_english():
pages = db((db.page.active=='True') &
(db.page.language=='en')).select(db.page.id, db.page.title,
orderby=db.page.title)
return dict(pages=pages)

View example
wiki/show_active_english

{{extend 'layout.html'}}
Show Active English Pages
[ {{=A('search', _href=URL(r=request, f='search'))}} ]
{{for page in pages:}}
{{=LI(A(page.title, _href=URL(r=request, f='show', args=page.id)
))}}
{{pass}}
[ {{=A('create page', _href=URL(r=request, f='create'))}} ]


Don't know where you want to deploy, I think the above would run GAE,
have not tested it though...

Cheers,

Chris


On Jan 28, 3:28 am, weheh  wrote:
> I haven't really worked with translation, yet. But I'm going to be
> getting into it in a big way. I have
>
> db.define_table('content',Field('title'),Field('body'))
>
> I want to enter title and body in English, but then translate to other
> languages.
> Let's say I do this:
>
> rows=db(db.content.id>0).select()
> for row in rows:
>   trans_title=T(row.title)
>   trans_body=T(row.body)
>
> Will something like that work?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Why in the default language list there is no "en" or "en-en"?

2010-01-28 Thread tyoc213
Reading the post about default lang, I have watched that there is no
english language in the list of languages. So
http://localhost:8000/admin/default/update_languages/welcome would not
show it, so the question is, if I create "en-en" or "en" it will show
that language that is not show there?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Stupid translation question

2010-01-28 Thread weheh
Hi Chris - super write up. Thanks. I'll be referring to it in the next
few days. - RG

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Two files that perhaps should't be in web2py_src.zip

2010-01-28 Thread tyoc213
I think this 2

applications/admin/static/edit_area/images/Thumbs.db
applications/admin/static/edit_area/plugins/charmap/images/Thumbs.db

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Mobile Access Design

2010-01-28 Thread yamandu
Hey, thanks Mr Freeze,

I am sure it gonna help.
And I am look webgrid module.
So useful! I´m gonna try tomorrow, but I already know it will same a
lot of time.
I think a negative point of web2py is the table renderers but webgrid
seems to solve this.
I could be included in web2py.

Thanks.

On 28 Jan, 02:43, "mr.freeze"  wrote:
> I made a mileage tracker for blackberry 
> here:http://www.web2pyslices.com/main/slices/take_slice/15
>
> It's a simple app but hopefully will help.
>
> On Jan 27, 10:35 pm,yamandu wrote:
>
>
>
> > I am building an app that has some functions that need to be accessed
> > from a mobile, a pocket pc or maybe a cell phone.
> > The question is: using web2py what would be a working design?
> > I mean, what direction I must follow?
> > Anyone has made this?
>
> > I think I could be have different type of view for mobiles. But don´t
> > know if ti could be the best way.
> > I need to reduce as traffic as mush as possible but also don´t want to
> > rewrite lot of code neither write another app like in Java or
> > something else. That is, it must be more centralized.
>
> > Any tip?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: new on web2pyslices.com: version history!

2010-01-28 Thread mr.freeze
Also, a new revision will now trigger an email if you are subscribed
to that slice. Handy for keeping up with changes.

On Jan 27, 9:56 pm, "mr.freeze"  wrote:
> Well it took a while but I finally got around to it. From now on when
> you modify your slice, a version history link will appear below the
> main body.  It currently only allows viewing but will support
> restoring previous versions soon. Enjoy and keep those slices coming!

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Checking my site in other browsers...

2010-01-28 Thread Jason Brower
I used to use this...
http://browsershots.org/
But it seems that I need a robots.txt file in the root of my site
here...
http://www.bullseyedesign4u.com/welcome/default/index
Is there an easy way to make this file in
http://www.bullseyedesign4u.com/robots.txt in my web2py install?  I
wonder if other sites demand the robot there as well. :/
Are there any other sites to get screenshots from other browsers?  I
can't find anyone with ie6 to get me a screenshot. I would love it if
someone here could too. :P
BR,
Jason Brower


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread mdipierro
what is the url that gives you invalid record? What is in request.url?
with args(2) and not args(0)?

On Jan 28, 7:20 pm, weheh  wrote:
> Hi Massimo, I'm sorry, but I don't understand how to do this. I tried
> the following:
>
> #controller
> def junk():
>   form = crud.update(db.content,request.args(2),next=request.url)
>   rows=crud.select(...)
>   return dict(form=form,rows=rows)
>
> Record creation works OK. But when I click on a rows record id,
> expecting the form to populate and then update when I submit, I get an
> invalid function error.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Why in the default language list there is no "en" or "en-en"?

2010-01-28 Thread mdipierro
yes but the translation of 'en' will be ignored unless you change the
value of

T.current_languages = ['en']


On Jan 28, 7:36 pm, tyoc213  wrote:
> Reading the post about default lang, I have watched that there is no
> english language in the list of languages. 
> Sohttp://localhost:8000/admin/default/update_languages/welcomewould not
> show it, so the question is, if I create "en-en" or "en" it will show
> that language that is not show there?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Two files that perhaps should't be in web2py_src.zip

2010-01-28 Thread mdipierro
good catch. Perhaps, somebody more stilled in mercurial than me,
should look at the build scripts in Makefile and perhaps rewrite them
to use a clean checkout instead of the current mechanism.

On Jan 28, 9:04 pm, tyoc213  wrote:
> I think this 2
>
> applications/admin/static/edit_area/images/Thumbs.db
> applications/admin/static/edit_area/plugins/charmap/images/Thumbs.db

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: new on web2pyslices.com: version history!

2010-01-28 Thread mdipierro
cool!

On Jan 28, 10:20 pm, "mr.freeze"  wrote:
> Also, a new revision will now trigger an email if you are subscribed
> to that slice. Handy for keeping up with changes.
>
> On Jan 27, 9:56 pm, "mr.freeze"  wrote:
>
> > Well it took a while but I finally got around to it. From now on when
> > you modify your slice, a version history link will appear below the
> > main body.  It currently only allows viewing but will support
> > restoring previous versions soon. Enjoy and keep those slices coming!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Checking my site in other browsers...

2010-01-28 Thread mdipierro
put the robots.txt somewhere, for example in applications/welcome/
static and then create a routes.py

routes_in=[('/robots.txt','/welcome/static/robots.txt')]

this is in the book. Chapter 4.

On Jan 28, 10:52 pm, Jason Brower  wrote:
> I used to use this...http://browsershots.org/
> But it seems that I need a robots.txt file in the root of my site
> here...http://www.bullseyedesign4u.com/welcome/default/index
> Is there an easy way to make this file 
> inhttp://www.bullseyedesign4u.com/robots.txtin my web2py install?  I
> wonder if other sites demand the robot there as well. :/
> Are there any other sites to get screenshots from other browsers?  I
> can't find anyone with ie6 to get me a screenshot. I would love it if
> someone here could too. :P
> BR,
> Jason Brower

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
http://127.0.0.1:8000/spin/default/junk/read/content/4

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
The URL is automatically generated by the crud.select and is attached
to the record id. Here's the URL:

http://127.0.0.1:8000/spin/default/marketing/read/content/4

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: get or insert shortcut

2010-01-28 Thread Richard
thanks that's much neater.

> does not do what you think it does.
can you explain? It worked for my test cases...

> record = db(logic).select(table['id']).first()
I noticed you removed the ID selection part - is there any efficiency
gained in just selecting the ID?

Richard


On Jan 29, 12:06 pm, mdipierro  wrote:
> This
>
>     logic = None
>     for field, value in fields.items():
>         e = table[field] == value
>         logic = e if logic is None else logic & e
>     record = db(logic).select(table['id']).first()
>
> does not do what you think it does.
>
> I think you want:
>
>     logic=reduce(lambda a,b:a&b,[table[k]==fields[k] for k in fields])
>     record = db(logic).select().first()
>
> On Jan 28, 6:24 am, Richard  wrote:
>
>
>
> > I want to get the ID of a record with certain fields, and create it if
> > not already existing. Is there a shortcut for this common operation?
> > In Django it is called "get_or_create()"
>
> > Also, is there a shortcut for update_or_create()?
>
> > Thanks,
> > Richard

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: crud newbie question regarding update

2010-01-28 Thread weheh
Oh, Massimo, one other thing. The crud.select is returning the
auth.user.id, whereas I would like to get auth.user.email in the rows
listing. How would I go about doing that? My db.content table has a
field named email:

Field('user',db.auth_user,requires=IS_IN_DB(db,'auth_user.id','%(email)
s'))

But I still only get the auth.user.id value for field user.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Custom form doesn't submit

2010-01-28 Thread Adi
Ok, I removed the SELECT entirely to see if the form submits, but it
still doesn't. Now I'm doing this:

1. created a read-only SQLFORM
2. did form[0].append(TR(, ))

But the Add Another button doesn't submit. Firebug shows html to be
OK. However the custom part of the SQLFORM doesn't include "id"s for
the fields - which may mean even if form submits I won't be able to
access "form.vars.myfield" .

Any help here? I've been stuck for quite some time now. :(

On Jan 28, 8:35 pm, mdipierro  wrote:
> This is not a bug. Somehow your code is passing helpers instead of a
> value. This is the wrong line:
>
> SELECT(form.custom.inpval.filename,)
>
> The arguments of select should be option items. They cannot be custom
> widgets.
>
> On Jan 28, 7:08 am, Adi  wrote:
>
>
>
> > Update: I think I found a web2py bug.
>
> > form.custom.inpval.filename is generating bad html code. The first
> > option label of the html is this:
> > 
> >  > value="Joker">JokerRiddler > option>Twoface">
> > Joker
> > Riddler > value="Twoface">Twoface
>
> > 
>
> > Basically the first  has nested inside itself what should be
> > the actual  code. If I remove this in Firebug, the form
> > submits. Am I using form.custom.inpval wrongly? Or is this a bug?
>
> > On Jan 27, 9:58 am, Adi  wrote:
>
> > > Hi Denes/Massimo,
>
> > > Any inputs?
>
> > > On Jan 25, 8:20 pm, Adi  wrote:
>
> > > > Sorry I was posting the other reply so missed this: Responses inline.
>
> > > > > You are appending to form1 so check:
> > > > > 1) An INPUT named 'name', is it the only 'name' field in form1?
>
> > > > Yes. names of all fields are different.
>
> > > > > 2) Same for the SELECT, is there another 'gender' field?
>
> > > > No. All fields are different.
>
> > > > > 3) A second button named 'Add another' which will submit to the
> > > > > controller that generated form1 (self-submission), is that what you
> > > > > want?.
>
> > > > A button in the same row as the insertedformwhich says "Add another"
> > > > & submits the data to the same controller and function. So, Yes.
>
> > > > > Denes.
>
> > > > On Jan 25, 8:15 pm, DenesL  wrote:
>
> > > > > On Jan 25, 6:35 am, Adi  wrote:
>
> > > > > > Hi all,
>
> > > > > > I'm trying to build acustomformin this fashion:
>
> > > > > > There's a parent table and a child table (many one relationship). 
> > > > > > I've
> > > > > > created a read-only SQLFORM for a record of the parent, and then I'm
> > > > > > trying this:
>
> > > > > > form1 = SQLFORM(db.parent, readonly=True)
>
> > > > > > form2 = SQLFORM(db.child, keepopts=['gender'])
>
> > > > > > form1[0].append(TR(INPUT(_type='text', name='name',
> > > > > > requires=IS_NOT_EMPTY()), \
> > > > > > SELECT(form2.custom.inpval.gender, name='gender'),\
> > > > > > INPUT(_type='submit', _value='Add another'))
>
> > > > > > This gives me the appearance of theformas I want, i.e., parent read-
> > > > > > only record in aform, with additional single row of updateable child
> > > > > >formwith "Add another" button. The secondformis to provide a drop-
> > > > > > down list for 'gender'. However, in this case the "Add another" 
> > > > > > button
> > > > > > doesn't submit, i.e, I can't get control in form1.accepts or
> > > > > > form2.accepts.
>
> > > > > > What am I doing wrong?
>
> > > > > You are appending to form1 so check:
> > > > > 1) An INPUT named 'name', is it the only 'name' field in form1?
> > > > > 2) Same for the SELECT, is there another 'gender' field?
> > > > > 3) A second button named 'Add another' which will submit to the
> > > > > controller that generated form1 (self-submission), is that what you
> > > > > want?.
>
> > > > > Denes.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] HELP with wysiwyg

2010-01-28 Thread mdipierro
has anybody used?

http://127.0.0.1:8000/admin/default/htmledit/welcome/views/default/index.html

If you try insert a link it escapes the url of the link. This is
normally good but a problem when the url is {{=URL(...)}}
Can it be disabled?

Massimo

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.