[web2py] self.settings.remember_me_form = False

2011-07-20 Thread pbreit
http://web2py.com/book/default/chapter/08?search=remember+me


[web2py] Re: self.settings.remember_me_form = False

2011-07-20 Thread annet
Thanks for your reply. I apologize for not searching in the book
myself, at the moment I have to juggle with bandwidth to get things
done :-(

Kind regards,

Annet.


Re: [web2py] Re: storeing a db set in a storage for a map plugin

2011-07-20 Thread Manuele Pesenti

On 20/07/2011 00:34, Anthony wrote:

Objects defined in your models and controllers do not survive from
request to request (unless, of course, you store them somewhere, like
the session). In your code, the Set object is created when you visit
/default/index, but the select happens when you visit
/plugin_openplayers/index, which happens in a different request, so the
Set object no longer exists.


ok, in this case I need to pass a db set that cannot be stored in 
session (right?)... what's the right way to do that?


thanks

Manuele


Anthony





[web2py] Re: mapreduce.appspot.com

2011-07-20 Thread Plumo
You can add new types to the DAL that use GAE entities.

Here is what I used to create an unindexed string type:

from google.appengine.ext import db as gae

db._adapter.types['noindex'] = (lambda: gae.StringProperty(multiline=True, 
indexed=False))



[web2py] Re: Web2py Powertables plugin : in-line editing problem.

2011-07-20 Thread Will
On Jul 20, 7:21 am, Bruno Rocha rochacbr...@gmail.com wrote:
 try:

 def editablefunction():
    id = request.vars.row_id
    column = request.vars.column
    db(db.order_lines.id==id).update(column=value)
   * db.commit()*

Didn't work.
More info: There is a very quick 'Saving' appearing in the edited box
right after editing but it displays the old record right afterwards.
(1)
I tried dropping the editablefunction, making the extrajs part:
powerTable.extrajs = dict(autoresize={},tooltip={},editable={})
and then it would display the message 'Field has been edited' like
specified in the plugin_powertable.py sample controller.
def.editable():return dict(message=T('This Field was edited'))
 but of course no update (refresh page and old record is back)

Using the function you suggested above to replace editable() 's
content gave the same reactions as (1)


[web2py] export data to OOO and Excel

2011-07-20 Thread Vineet
I was looking for a library to export data to OpenOffice  Excel.
I found 2 such open source projects.

For OOO ---
http://ooolib.sourceforge.net/

For Excel ---
http://www.python-excel.org/

What I intend to do is, keep the classes in web2py folder, import the
classes in controller, then parse the result fetched from MySQL and
export the data to OOO or Excel.

Reasons as to why I am posting it here are--

1] Whether anybody has tried these and knows if these are mostly bug-
free (may not be 100%)
2] Whether anybody knows any other (better suited, may be) projects
like these (considering integration into w2p, feature-rich, tested,
etc.)
3] To share my findings with the list (might be useful to someone
new).

Cheers
:-)


Re: [web2py] Re: bug in crud with load and ajax=false

2011-07-20 Thread Sebastian E. Ovide
Hi Anthony,

I have not tested the trunk yet, but I have change those two lines

other_request.vars = Storage(vars)
other_request.get_vars = Storage(vars)

I still get an error:
 invalid view (default/crud_in_comp.load)(in index.html)
{{=LOAD('default','crud_in_comp.load',ajax_trap=True)}}

(in default.py)
def crud_in_comp():
return dict(crud=crud.create(db.auth_user,message=None))

any other file involved in that fix ?

On Tue, Jul 19, 2011 at 9:39 PM, Anthony abasta...@gmail.com wrote:

 Nightly build is not the same as trunk -- I'm not sure when it was last
 updated. You can pull trunk from the Google Code repository via Mercurial
 (you need to have Mercurial installed):
 http://code.google.com/p/web2py/source/checkout. Or you can just change
 the two relevant lines in your own copy of compileapp.py:
 http://code.google.com/p/web2py/source/browse/gluon/compileapp.py#126(change 
 lines 124-125 in 1.97.1 to what's in lines 126-127 in trunk) -- it
 just uses Storage(vars) in place of vars.

 Anthony

 On Tuesday, July 19, 2011 4:28:45 PM UTC-4, apple wrote:

 I downloaded the nightly build source and copied it on top of my
 web2py directory. Still get the request.vars as dict. Is that
 expected?

 On Jul 19, 5:40 pm, Anthony abas...@gmail.com wrote:
  Oops, forgot we already fixed that in trunk, so it will be work properly
 in
  the next release.
 
  Anthony
 
 
 
 
 
 
 
  On Tuesday, July 19, 2011 9:50:37 AM UTC-4, Anthony wrote:
   Good catch. I'll submit a patch.
 
   On Tuesday, July 19, 2011 8:56:08 AM UTC-4, apple wrote:
 
   I note that when ajax=False then request.vars is a dict rather than a

   storage object.
 
   On Jul 19, 11:44 am, apple sim...@gmail.com wrote:
The following works fine with the SQLFORM line and ajax=false or
ajax=true. However replacing SQLFORM line with the CRUD line it
 works
with ajax=true but fails with ajax=false, generating one of those
annoying restricted errors. I am guessing related to previous
 issue
with request.vars and load?
 
CONTROLLER
def test():
return dict()
def testload():
form=crud.update(db.customer,**1)
#form=SQLFORM(db.customer,1)
return dict(form=XML(form.xml()))
TEST.HTML VIEW
{{extend 'layout.html'}}
{{=LOAD(c='crm',f='testload.**load', ajax=False, ajax_trap=True)}}

TESTLOAD.LOAD VIEW
{{=form}}




-- 
Sebastian E. Ovide


Re: [web2py] Re: storeing a db set in a storage for a map plugin

2011-07-20 Thread Manuele Pesenti

On 20/07/2011 08:44, Manuele Pesenti wrote:


ok, in this case I need to pass a db set that cannot be stored in
session (right?)... what's the right way to do that?


would it be the case to use tha global declaretion such as is 
explained here for example?


http://effbot.org/pyfaq/how-do-you-set-a-global-variable-in-a-function.htm



thanks

 Manuele




Re: [web2py] Re: 'truncate' broken in SQLTABLE with 'headers'.

2011-07-20 Thread Martín Mulone
Can you open a ticket and give an example of SQLTABLE that fail?.

2011/7/19 Anthony abasta...@gmail.com

 On Tuesday, July 19, 2011 7:48:35 PM UTC-4, Carlos wrote:

 So 'truncate' is not being respected when using the previous 'headers'
 format (simple dict of strings).


 Oh, I see, you're right -- that should be fixed.

 Anthony





-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: web2py on github

2011-07-20 Thread blackthorne
be aware that google code hosting now supports git..

On Jul 20, 4:44 am, luckysmack luckysm...@gmail.com wrote:
 Well i was going to for the original. But it being so out of date, i
 thought i would just take the mercurial branch and use a tool to
 convert the code and its branches with history to git. that way it is
 exactly what is in the mercurial repos. But doing that i cant fork it.
 i would need to create my own repo. which would mean there would be
 duplicate repos for web2py. is there a way i can for the one on github
 and then merge in the converted mercurial to git copy? since they
 essentially have separate remotes. Anyone know of a way i could do
 this?

 On Jul 19, 8:31 pm, luckysmack luckysm...@gmail.com wrote:



  Letting those users out there know that I will forking the web2py on
  github (which is outdated) and will be updating it as I will need it
  and its easier (for me at least) to keep all my repos in one location.
  Ive already forked it and will be updating it shortly.

 https://github.com/luckysmack/web2py


Re: [web2py] export data to OOO and Excel

2011-07-20 Thread Joaquin Orbe
On Wed, Jul 20, 2011 at 5:45 AM, Vineet vineet.deod...@gmail.com wrote:
 I was looking for a library to export data to OpenOffice  Excel.
 I found 2 such open source projects.

 For OOO ---
 http://ooolib.sourceforge.net/

 For Excel ---
 http://www.python-excel.org/

 What I intend to do is, keep the classes in web2py folder, import the
 classes in controller, then parse the result fetched from MySQL and
 export the data to OOO or Excel.

 Reasons as to why I am posting it here are--

 1] Whether anybody has tried these and knows if these are mostly bug-
 free (may not be 100%)
 2] Whether anybody knows any other (better suited, may be) projects
 like these (considering integration into w2p, feature-rich, tested,
 etc.)
 3] To share my findings with the list (might be useful to someone
 new).

 Cheers
 :-)

Hi Vineet,
I used xlwt for a non-production site and worked fine for me (just a
very simple report with a small formatting).
This is a quick example:

def excel_report():
from datetime import datetime
import xlwt
tmpfilename=os.path.join(request.folder,'private',str(uuid4()))

font0 = xlwt.Font()
font0.name = 'Arial'
font0.bold = True

style0 = xlwt.XFStyle()
style0.font = font0

style1 = xlwt.XFStyle()
style1.num_format_str = 'DD--'

wb = xlwt.Workbook()
ws = wb.add_sheet('Sample report')

ws.write(0, 0, 'Text here', style0)
ws.write(0, 6, 'More text here', style0)
ws.write(0, 7, datetime.now(), style1)

wb.save(tmpfilename)

data = open(tmpfilename,rb).read()
os.unlink(tmpfilename)
response.headers['Content-Type']='application/vnd.ms-excel'
return data


Hope it helps you.

Joaco.


Re: [web2py] record representation using a non-id column?

2011-07-20 Thread Johann Spies
 On 9 July 2011 03:47, niknok nikolai...@gmail.com wrote:

 **
 I have another unique column in my table that I would like to use as index
 for record representation.  How do I tell web2py to use another index?

 Ttrying to use like:
 db.mytable.thisfield.represent = lambda id: db.other(myidx).thatfield


I use this:


db.define_table('akb_doccenter_location',

Field('location'))

db.akb_doccenter.location.represent = lambda uuid: db(
db.akb_doccenter_location.uuid==uuid).select(
db.akb_doccenter_location.location).first()['location']


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


Re: [web2py] record representation using a non-id column?

2011-07-20 Thread Johann Spies
On 20 July 2011 14:09, Johann Spies johann.sp...@gmail.com wrote:


 I use this:


 db.define_table('akb_doccenter_location',

 Field('location'))


Apologies, I did not complete the message before sending: the model includes
a Field(uuid),  obviously.

Regards
Johann


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


[web2py] Re: adding plugin_wiki to existing application - prettydate

2011-07-20 Thread Vincent
after some digging around I found the prettydate function in
gluon.tools.

If I from gluon.tools import prettydate directly in the page.html
view I no longer get an error. If I do the same thing but only in the
controller it still does not work.

Any ideas what characteristics of my app may cause this behavior?
Since it does not seem to be the default behavior (at least not on a
fresh app, as described in previous post)

Thanks
Vincent

On Jul 18, 4:01 pm, Vincent vincentchevr...@gmail.com wrote:
 Hi,

 I have an existing web2py app called dispersion to which I am trying
 to add the plugin_wiki.

 I added the plugin through the design interface, created an editor
 group and added my user to it. I can now navigate to [site]/dispersion/
 plugin_wiki and create a page, however when I try to submit it I get
 the following error:

 Traceback (most recent call last):
   File F:\programs\web2py\gluon\restricted.py, line 192, in
 restricted    exec ccode in environment
   File F:\programs\web2py\applications\dispersion\views\plugin_wiki/
 page.html, line 113, in module
   NameError: name 'prettydate' is not defined

 If I create a new default application from scratch and install the
 plugin_wiki it works without problem. An online video tutorial
 regarding plugin_wiki by Massimo mentions the date is delivered
 through ajax. I have zero ajax experience.

 I'm running on Windows, from source, with the built-in server.

 Anybody have any ideas how to address/debug this?

 thanks
 Vincent


Re: [web2py] Re: bug in crud with load and ajax=false

2011-07-20 Thread Anthony
Do you have a /views/default/crud_in_comp.load view? If not, for now you'll 
need one, as generic views aren't working in non-ajax components at the 
moment (this should be fixed soon).
 
Anthony

On Wednesday, July 20, 2011 5:38:18 AM UTC-4, sebastian wrote:

 Hi Anthony,

 I have not tested the trunk yet, but I have change those two lines 

 other_request.vars = Storage(vars)
 other_request.get_vars = Storage(vars)

 I still get an error:
 invalid view (default/crud_in_comp.load)(in index.html)
 {{=LOAD('default','crud_in_comp.load',ajax_trap=True)}}

 (in default.py)
 def crud_in_comp():
 return dict(crud=crud.create(db.auth_user,message=None))

 any other file involved in that fix ?

 On Tue, Jul 19, 2011 at 9:39 PM, Anthony abas...@gmail.com wrote:

  Nightly build is not the same as trunk -- I'm not sure when it was last 
 updated. You can pull trunk from the Google Code repository via Mercurial 
 (you need to have Mercurial installed): 
 http://code.google.com/p/web2py/source/checkout. Or you can just change 
 the two relevant lines in your own copy of compileapp.py: 
 http://code.google.com/p/web2py/source/browse/gluon/compileapp.py#126(change 
 lines 124-125 in 1.97.1 to what's in lines 126-127 in trunk) -- it 
 just uses Storage(vars) in place of vars.
  
 Anthony
  
 On Tuesday, July 19, 2011 4:28:45 PM UTC-4, apple wrote:

 I downloaded the nightly build source and copied it on top of my 
 web2py directory. Still get the request.vars as dict. Is that 
 expected? 

  On Jul 19, 5:40 pm, Anthony aba...@gmail.com wrote: 
  Oops, forgot we already fixed that in trunk, so it will be work 
 properly in 
  the next release. 
  
  Anthony 
  
  
  
  
  
  
  
  On Tuesday, July 19, 2011 9:50:37 AM UTC-4, Anthony wrote: 
   Good catch. I'll submit a patch. 
  
   On Tuesday, July 19, 2011 8:56:08 AM UTC-4, apple wrote: 
  
   I note that when ajax=False then request.vars is a dict rather than 
 a 
   storage object. 
  
   On Jul 19, 11:44 am, apple sim...@gmail.com wrote: 
The following works fine with the SQLFORM line and ajax=false or 
ajax=true. However replacing SQLFORM line with the CRUD line it 
 works 
with ajax=true but fails with ajax=false, generating one of those 
annoying restricted errors. I am guessing related to previous 
 issue 
with request.vars and load? 
  
CONTROLLER 
def test(): 
return dict() 
def testload(): 
form=crud.update(db.customer,**1) 
#form=SQLFORM(db.customer,1) 
return dict(form=XML(form.xml())) 
TEST.HTML VIEW 
{{extend 'layout.html'}} 
{{=LOAD(c='crm',f='testload.**load', ajax=False, 
 ajax_trap=True)}} 
TESTLOAD.LOAD VIEW 
{{=form}}




 -- 
 Sebastian E. Ovide






Re: [web2py] Re: bug in crud with load and ajax=false

2011-07-20 Thread Sebastian E. Ovide
adding a default default/crud_in_comp.load made the trick.

On Wed, Jul 20, 2011 at 2:12 PM, Anthony abasta...@gmail.com wrote:

 Do you have a /views/default/crud_in_comp.load view? If not, for now you'll
 need one, as generic views aren't working in non-ajax components at the
 moment (this should be fixed soon).

 Anthony

 On Wednesday, July 20, 2011 5:38:18 AM UTC-4, sebastian wrote:

 Hi Anthony,

 I have not tested the trunk yet, but I have change those two lines

 other_request.vars = Storage(vars)
 other_request.get_vars = Storage(vars)

 I still get an error:
 invalid view (default/crud_in_comp.load)(in index.html)
 {{=LOAD('default','crud_in_**comp.load',ajax_trap=True)}}

 (in default.py)
 def crud_in_comp():
 return dict(crud=crud.create(db.auth_**user,message=None))

 any other file involved in that fix ?

 On Tue, Jul 19, 2011 at 9:39 PM, Anthony abas...@gmail.com wrote:

  Nightly build is not the same as trunk -- I'm not sure when it was last
 updated. You can pull trunk from the Google Code repository via Mercurial
 (you need to have Mercurial installed): http://code.google.com/p/**
 web2py/source/checkout http://code.google.com/p/web2py/source/checkout.
 Or you can just change the two relevant lines in your own copy of
 compileapp.py: http://code.google.com/p/**web2py/source/browse/gluon/**
 compileapp.py#126http://code.google.com/p/web2py/source/browse/gluon/compileapp.py#126(change
  lines 124-125 in 1.97.1 to what's in lines 126-127 in trunk) -- it
 just uses Storage(vars) in place of vars.

 Anthony

 On Tuesday, July 19, 2011 4:28:45 PM UTC-4, apple wrote:

 I downloaded the nightly build source and copied it on top of my
 web2py directory. Still get the request.vars as dict. Is that
 expected?

  On Jul 19, 5:40 pm, Anthony aba...@gmail.com wrote:
  Oops, forgot we already fixed that in trunk, so it will be work
 properly in
  the next release.
 
  Anthony
 
 
 
 
 
 
 
  On Tuesday, July 19, 2011 9:50:37 AM UTC-4, Anthony wrote:
   Good catch. I'll submit a patch.
 
   On Tuesday, July 19, 2011 8:56:08 AM UTC-4, apple wrote:
 
   I note that when ajax=False then request.vars is a dict rather than
 a
   storage object.
 
   On Jul 19, 11:44 am, apple sim...@gmail.com wrote:
The following works fine with the SQLFORM line and ajax=false or
ajax=true. However replacing SQLFORM line with the CRUD line it
 works
with ajax=true but fails with ajax=false, generating one of those

annoying restricted errors. I am guessing related to previous
 issue
with request.vars and load?
 
CONTROLLER
def test():
return dict()
def testload():
form=crud.update(db.customer,1)
#form=SQLFORM(db.customer,1)
return dict(form=XML(form.xml()))
TEST.HTML VIEW
{{extend 'layout.html'}}
{{=LOAD(c='crm',f='testload.**lo**ad', ajax=False,
 ajax_trap=True)}}
TESTLOAD.LOAD VIEW
{{=form}}




 --
 Sebastian E. Ovide







-- 
Sebastian E. Ovide


Re: [web2py] Re: storeing a db set in a storage for a map plugin

2011-07-20 Thread Anthony
No, the Set object has to be defined during the same request as the select, 
so you should either define it in a model file (as in the plugin_gmap 
example), or in the /plugin_openplayers/index function (where the select 
happens). Alternatively, you could define a function that does the work of 
/plugin_openplayers/index and put the function in a model file or in a 
module, and then call that function from /default/index after you define the 
Set there (note, if you put the function in a module, you must import it to 
use it, and in order to reference the request variables, you either have to 
pass them explicitly as an argument to the function, or your module has to 
import the 'current' object, and your module code can then reference 
current.request.vars).
 
Anthony

On Wednesday, July 20, 2011 5:52:08 AM UTC-4, Manuele wrote:

 On 20/07/2011 08:44, Manuele Pesenti wrote:
 
  ok, in this case I need to pass a db set that cannot be stored in
  session (right?)... what's the right way to do that? 

 would it be the case to use tha global declaretion such as is 
 explained here for example? 

 http://effbot.org/pyfaq/how-do-you-set-a-global-variable-in-a-function.htm 

 
  thanks
 
   Manuele 

  

[web2py] Re: Two problems with LOAD; one may be a bug(?)

2011-07-20 Thread Iceberg


On Jul 13, 8:49 am, Anthony abasta...@gmail.com wrote:

  Second problem:
  In trying to find out if setting ajax to True was causing my first
  problem, I stumbled over a second.  Setting 'ajax=False' or not
  setting ajax at all causes an exception.  Could this be a bug?  If so,
  please let me know where and how to report the thing.  It's totally
  reproducible on my system.

 There is currently a bug with ajax=False where response.generic_patterns is
 not getting passed to the component, so generic views are not working with
 non-ajax components at the moment. If you're getting an invalid view error,
 that could be the problem.

 Anthony


Hi Anthony,

I encounter same problem. STFW and I read your two posts. One is
above, the other is here:

http://groups.google.com/group/web2py/msg/25bd655665bf47bf

I am curious to see a bug exists for 2 weeks. That is not normal,
considering web2py has a tradition of fixing bug within 24 hours. Is
there anything special about this one? Thanks in advance.

Regards,
Ray (a.k.a. Iceberg)


[web2py] Re: adding plugin_wiki to existing application - prettydate

2011-07-20 Thread Anthony
On Wednesday, July 20, 2011 8:11:56 AM UTC-4, Vincent wrote: 

 after some digging around I found the prettydate function in 
 gluon.tools. 

 If I from gluon.tools import prettydate directly in the page.html 
 view I no longer get an error. If I do the same thing but only in the 
 controller it still does not work.

 
The views are not run in the same context as the controller, so if you 
import a module in a controller, it will not be available in the view.
 
Anthony


[web2py] Re: Two problems with LOAD; one may be a bug(?)

2011-07-20 Thread Anthony
On Wednesday, July 20, 2011 10:05:11 AM UTC-4, Iceberg wrote: 

 Hi Anthony, 

 I encounter same problem. STFW and I read your two posts. One is 
 above, the other is here: 

 http://groups.google.com/group/web2py/msg/25bd655665bf47bf 

 I am curious to see a bug exists for 2 weeks. That is not normal, 
 considering web2py has a tradition of fixing bug within 24 hours. Is 
 there anything special about this one? Thanks in advance. 

 Regards, 
 Ray (a.k.a. Iceberg)

 
I submitted a patch for a quick fix, but there are some conceptual problems 
with non-ajax components that need to be thought through, so I think Massimo 
may have postponed applying the patch until we figure that out. For example, 
the fix for this particular issue would involve copying 
response.generic_patterns to other_response.generic_patterns (which is the 
response object used by the component). But what if the parent page action 
made changes to response.generic_patterns -- should those changes propogate 
to the component (which is what would happen with the simple fix), or should 
the component not see those changes (that's a lot harder to work out without 
re-running the models)? Note, this issue is not limited to generic_patterns.
 
Also, I think Massimo has just been very busy the past couple weeks, so 
there haven't been a lot of commits in general.
 
Anthony


[web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Chris Baron
Thank you for the prompt responses.

On Jul 19, 4:12 pm, Roberto Perdomo roberto...@gmail.com wrote:
 Hello, it's me again.

 Well, I discovered that the problem of loading the table with load is in
 the event live plugin_powertable.py. I've replaced the event live for
 bind, and, works, but just load the details for the first 10 rows
 displayed when loading the table.

 Is there any way to fix this error?

 thanks
 2011/7/19 Bruno Rocha rochacbr...@gmail.com







  this should be:

  table.dtfeatures['aoColumns'] = ''

  dtfeatures implement any option from datatables.net

  On Tue, Jul 19, 2011 at 1:32 PM, Christopher Baron cba...@fieldmuseum.org
   wrote:

  Does anyone know where, what to set the 'aoColumns' property to ?

  The documentation for this plugin is not helpful...

  On Jul 18, 1:25 pm, Roberto Perdomo roberto...@gmail.com wrote:
   I now discover that only show the details only for the first 10 records.

   I send you to your mail my app, because is very hevy for the group mail.

   2011/7/18 Bruno Rocha rochacbr...@gmail.com

include ownTable._id = something and ownTable._class = something
  to set
different class and id to the tables.

On Mon, Jul 18, 2011 at 12:57 PM, Chris Baron topher.ba...@gmail.com
  wrote:

How do you do it ?

Here is my controller :

ownDataSource = db( db.gtree.contributor == '
'.join( [ auth.user.first_name, auth.user.last_name ] ) ).select()

   class ownVirtualFields(object):
       @virtualsettings(label='Tree')
       def tree_url(self):
           gtree = self.gtree.id
           u = URL(c=gtree,f=view,args=self.gtree.id,
vars=dict(treeType='grafted'))
           return A('grafted', _href=u)

   ownTable = plugins.powerTable
   ownTable.datasource = ownDataSource
   ownTable.dtfeatures[sScrollY] = 200px
   ownTable.dtfeatures[sScrollX] = 100%
   ownTable.virtualfields = ownVirtualFields()
   ownTable.headers = labels
   ownTable.showkeycolumn = False
   ownTable.dtfeatures[bJQueryUI] =
request.vars.get(jqueryui,True)
   ## ownTable.uitheme = request.vars.get(theme,cupertino)
   ownTable.uitheme = request.vars.get(theme,smoothness)
   ownTable.dtfeatures[iDisplayLength] = 25
   ownTable.dtfeatures[aaSorting] = [[6,'desc']]
   ownTable.dtfeatures[sPaginationType] = request.vars.get(
       pager,full_numbers
       ) # two_button scrolling
   ownTable.columns = [gtree.id,
                         virtual.tree_url,
                         gtree.mtime,
                         gtree.title,
                         gtree.comment ]

   ownTable.extra = dict(autoresize=True)

   

   uniqueUserId = db( db.user_map.auth_user_id ==
auth.user.id ).select()[0].unique_user_id

   shareDataSource = db( ( db.gtree.id == db.gtree_share.gtree ) 
                         ( db.gtree_share.user ==
uniqueUserId ) ).select()

   class shareVirtualFields(object):
       @virtualsettings(label='Tree')
       def tree_url(self):
           gtree = self.gtree.id
           u = URL(c=gtree,f=view,args=self.gtree.id,
vars=dict(treeType='grafted'))
           return A('grafted', _href=u)
shareTable = plugins.powerTable
   shareTable.datasource = shareDataSource
   shareTable.dtfeatures[sScrollY] = 200px
   shareTable.dtfeatures[sScrollX] = 100%
   shareTable.virtualfields = shareVirtualFields()
   shareTable.headers = labels
   shareTable.showkeycolumn = False
   shareTable.dtfeatures[bJQueryUI] =
request.vars.get(jqueryui,True)
   ## shareTable.uitheme = request.vars.get(theme,cupertino)
   shareTable.uitheme = request.vars.get(theme,smoothness)
   shareTable.dtfeatures[iDisplayLength] = 25
   shareTable.dtfeatures[aaSorting] = [[6,'desc']]
   shareTable.dtfeatures[sPaginationType] = request.vars.get(
       pager,full_numbers
       ) # two_button scrolling
   shareTable.columns = [gtree.id,
                         virtual.tree_url,
                         gtree.mtime,
                         gtree.title,
                         gtree.comment ]

   shareTable.extra = dict(autoresize=True)

   return dict( ownedByUser = ownTable.create(), sharedWithUser =
ownTable.create() )

Here is my view :

div class=blackBorder width98 fullHeight

   div style=height:50%; overflow:auto;
       div class=centerText style=font-size:x-large; padding:
10px;Grafted Tables You Own/div
       {{=ownedByUser}}
   /div

   div style=height:50%; overflow:auto;
       div class=centerText style=font-size:x-large; padding:
10px;Grafted Tables Shared With You/div
       {{=sharedWithUser}}
   /div

/div

--

--
Bruno Rocha
[ About me:http://zerp.ly/rochacbruno]
[ Aprenda a programar:http://CursoDePython.com.br]
[ O seu aliado nos 

[web2py] web2py (context process , midelware)

2011-07-20 Thread ariel.glez.m
what thing replace in web2py the context process and midelware of
django.


[web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Chris Baron
I'm still having a problem getting two powertables on one page.  If I
comment out the code for the second powertable, everything is fine,
but it seems the first powertable can't find its data.  Please refer
to code posted above.  I think this has something to do with
instantiation, specifically, I think that this is my problem :

ownTable = plugins.powerTable
# do stuff with ownTable

shareTable = plugins.powerTable
 #do stuff with shareTable

return dict( ownedByUser = ownTable.create(), sharedWithUser =
ownTable.create() )


How do I get separate instances?

On Jul 20, 9:40 am, Chris Baron topher.ba...@gmail.com wrote:
 Thank you for the prompt responses.

 On Jul 19, 4:12 pm, Roberto Perdomo roberto...@gmail.com wrote:







  Hello, it's me again.

  Well, I discovered that the problem of loading the table with load is in
  the event live plugin_powertable.py. I've replaced the event live for
  bind, and, works, but just load the details for the first 10 rows
  displayed when loading the table.

  Is there any way to fix this error?

  thanks
  2011/7/19 Bruno Rocha rochacbr...@gmail.com

   this should be:

   table.dtfeatures['aoColumns'] = ''

   dtfeatures implement any option from datatables.net

   On Tue, Jul 19, 2011 at 1:32 PM, Christopher Baron cba...@fieldmuseum.org
wrote:

   Does anyone know where, what to set the 'aoColumns' property to ?

   The documentation for this plugin is not helpful...

   On Jul 18, 1:25 pm, Roberto Perdomo roberto...@gmail.com wrote:
I now discover that only show the details only for the first 10 
records.

I send you to your mail my app, because is very hevy for the group 
mail.

2011/7/18 Bruno Rocha rochacbr...@gmail.com

 include ownTable._id = something and ownTable._class = something
   to set
 different class and id to the tables.

 On Mon, Jul 18, 2011 at 12:57 PM, Chris Baron topher.ba...@gmail.com
   wrote:

 How do you do it ?

 Here is my controller :

 ownDataSource = db( db.gtree.contributor == '
 '.join( [ auth.user.first_name, auth.user.last_name ] ) ).select()

    class ownVirtualFields(object):
        @virtualsettings(label='Tree')
        def tree_url(self):
            gtree = self.gtree.id
            u = URL(c=gtree,f=view,args=self.gtree.id,
 vars=dict(treeType='grafted'))
            return A('grafted', _href=u)

    ownTable = plugins.powerTable
    ownTable.datasource = ownDataSource
    ownTable.dtfeatures[sScrollY] = 200px
    ownTable.dtfeatures[sScrollX] = 100%
    ownTable.virtualfields = ownVirtualFields()
    ownTable.headers = labels
    ownTable.showkeycolumn = False
    ownTable.dtfeatures[bJQueryUI] =
 request.vars.get(jqueryui,True)
    ## ownTable.uitheme = request.vars.get(theme,cupertino)
    ownTable.uitheme = request.vars.get(theme,smoothness)
    ownTable.dtfeatures[iDisplayLength] = 25
    ownTable.dtfeatures[aaSorting] = [[6,'desc']]
    ownTable.dtfeatures[sPaginationType] = request.vars.get(
        pager,full_numbers
        ) # two_button scrolling
    ownTable.columns = [gtree.id,
                          virtual.tree_url,
                          gtree.mtime,
                          gtree.title,
                          gtree.comment ]

    ownTable.extra = dict(autoresize=True)

    

    uniqueUserId = db( db.user_map.auth_user_id ==
 auth.user.id ).select()[0].unique_user_id

    shareDataSource = db( ( db.gtree.id == db.gtree_share.gtree ) 
                          ( db.gtree_share.user ==
 uniqueUserId ) ).select()

    class shareVirtualFields(object):
        @virtualsettings(label='Tree')
        def tree_url(self):
            gtree = self.gtree.id
            u = URL(c=gtree,f=view,args=self.gtree.id,
 vars=dict(treeType='grafted'))
            return A('grafted', _href=u)
 shareTable = plugins.powerTable
    shareTable.datasource = shareDataSource
    shareTable.dtfeatures[sScrollY] = 200px
    shareTable.dtfeatures[sScrollX] = 100%
    shareTable.virtualfields = shareVirtualFields()
    shareTable.headers = labels
    shareTable.showkeycolumn = False
    shareTable.dtfeatures[bJQueryUI] =
 request.vars.get(jqueryui,True)
    ## shareTable.uitheme = request.vars.get(theme,cupertino)
    shareTable.uitheme = request.vars.get(theme,smoothness)
    shareTable.dtfeatures[iDisplayLength] = 25
    shareTable.dtfeatures[aaSorting] = [[6,'desc']]
    shareTable.dtfeatures[sPaginationType] = request.vars.get(
        pager,full_numbers
        ) # two_button scrolling
    shareTable.columns = [gtree.id,
                          virtual.tree_url,
                          gtree.mtime,
                          gtree.title,
                          gtree.comment ]

    

[web2py] HTLM Helper URL. How to pass html tags as arguments

2011-07-20 Thread António Ramos
hello



i have a simple view with some html and no db defined in the background

*EXAMPLE VIEW*
select
option value=volvoVolvo/option
option value=saabSaab/option
option value=mercedesMercedes/option
option value=audiAudi/option
/select

{{=LI(A('something', _href=URL('show', args=??))}}

if i want to pass as argument of URL the selection in the above select tag


how do i  do that?


thank you?


Re: [web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Roberto Perdomo
i think that you code is wrong, try with:

return dict( ownedByUser = ownTable.create(), sharedWithUser
= sharedWithUser.create() )

you were doubling ownTable on the dict.



2011/7/20 Chris Baron topher.ba...@gmail.com

 I'm still having a problem getting two powertables on one page.  If I
 comment out the code for the second powertable, everything is fine,
 but it seems the first powertable can't find its data.  Please refer
 to code posted above.  I think this has something to do with
 instantiation, specifically, I think that this is my problem :

ownTable = plugins.powerTable
# do stuff with ownTable

shareTable = plugins.powerTable
 #do stuff with shareTable

return dict( ownedByUser = ownTable.create(), sharedWithUser =
 ownTable.create() )


 How do I get separate instances?

 On Jul 20, 9:40 am, Chris Baron topher.ba...@gmail.com wrote:
  Thank you for the prompt responses.
 
  On Jul 19, 4:12 pm, Roberto Perdomo roberto...@gmail.com wrote:
 
 
 
 
 
 
 
   Hello, it's me again.
 
   Well, I discovered that the problem of loading the table with load is
 in
   the event live plugin_powertable.py. I've replaced the event live
 for
   bind, and, works, but just load the details for the first 10 rows
   displayed when loading the table.
 
   Is there any way to fix this error?
 
   thanks
   2011/7/19 Bruno Rocha rochacbr...@gmail.com
 
this should be:
 
table.dtfeatures['aoColumns'] = ''
 
dtfeatures implement any option from datatables.net
 
On Tue, Jul 19, 2011 at 1:32 PM, Christopher Baron 
 cba...@fieldmuseum.org
 wrote:
 
Does anyone know where, what to set the 'aoColumns' property to ?
 
The documentation for this plugin is not helpful...
 
On Jul 18, 1:25 pm, Roberto Perdomo roberto...@gmail.com wrote:
 I now discover that only show the details only for the first 10
 records.
 
 I send you to your mail my app, because is very hevy for the group
 mail.
 
 2011/7/18 Bruno Rocha rochacbr...@gmail.com
 
  include ownTable._id = something and ownTable._class =
 something
to set
  different class and id to the tables.
 
  On Mon, Jul 18, 2011 at 12:57 PM, Chris Baron 
 topher.ba...@gmail.com
wrote:
 
  How do you do it ?
 
  Here is my controller :
 
  ownDataSource = db( db.gtree.contributor == '
  '.join( [ auth.user.first_name, auth.user.last_name ] )
 ).select()
 
 class ownVirtualFields(object):
 @virtualsettings(label='Tree')
 def tree_url(self):
 gtree = self.gtree.id
 u = URL(c=gtree,f=view,args=self.gtree.id,
  vars=dict(treeType='grafted'))
 return A('grafted', _href=u)
 
 ownTable = plugins.powerTable
 ownTable.datasource = ownDataSource
 ownTable.dtfeatures[sScrollY] = 200px
 ownTable.dtfeatures[sScrollX] = 100%
 ownTable.virtualfields = ownVirtualFields()
 ownTable.headers = labels
 ownTable.showkeycolumn = False
 ownTable.dtfeatures[bJQueryUI] =
  request.vars.get(jqueryui,True)
 ## ownTable.uitheme = request.vars.get(theme,cupertino)
 ownTable.uitheme = request.vars.get(theme,smoothness)
 ownTable.dtfeatures[iDisplayLength] = 25
 ownTable.dtfeatures[aaSorting] = [[6,'desc']]
 ownTable.dtfeatures[sPaginationType] = request.vars.get(
 pager,full_numbers
 ) # two_button scrolling
 ownTable.columns = [gtree.id,
   virtual.tree_url,
   gtree.mtime,
   gtree.title,
   gtree.comment ]
 
 ownTable.extra = dict(autoresize=True)
 
 
 
 uniqueUserId = db( db.user_map.auth_user_id ==
  auth.user.id ).select()[0].unique_user_id
 
 shareDataSource = db( ( db.gtree.id == db.gtree_share.gtree
 ) 
   ( db.gtree_share.user ==
  uniqueUserId ) ).select()
 
 class shareVirtualFields(object):
 @virtualsettings(label='Tree')
 def tree_url(self):
 gtree = self.gtree.id
 u = URL(c=gtree,f=view,args=self.gtree.id,
  vars=dict(treeType='grafted'))
 return A('grafted', _href=u)
  shareTable = plugins.powerTable
 shareTable.datasource = shareDataSource
 shareTable.dtfeatures[sScrollY] = 200px
 shareTable.dtfeatures[sScrollX] = 100%
 shareTable.virtualfields = shareVirtualFields()
 shareTable.headers = labels
 shareTable.showkeycolumn = False
 shareTable.dtfeatures[bJQueryUI] =
  request.vars.get(jqueryui,True)
 ## shareTable.uitheme =
 request.vars.get(theme,cupertino)
 shareTable.uitheme = request.vars.get(theme,smoothness)
 shareTable.dtfeatures[iDisplayLength] = 25
 shareTable.dtfeatures[aaSorting] = [[6,'desc']]
 

[web2py] Re: HTLM Helper URL. How to pass html tags as arguments

2011-07-20 Thread Anthony
On Wednesday, July 20, 2011 11:17:51 AM UTC-4, Ramos wrote: 

  
 i have a simple view with some html and no db defined in the background

 *EXAMPLE VIEW*
 select
 option value=volvoVolvo/option
 option value=saabSaab/option
 option value=mercedesMercedes/option
 option value=audiAudi/option
 /select

 {{=LI(A('something', _href=URL('show', args=??))}}

 if i want to pass as argument of URL the selection in the above select tag

 
The URL function is called on the server side at the time the page is first 
rendered, but the selection is made by the user on the client side after the 
page has been delivered, so there is no way for the URL function to insert 
an argument from the select because the select happens later. Depending on 
what you're trying to achieve, you might be better off treating this as a 
form and doing a submit, or otherwise do something with Javascript on the 
client side.
 
Anthony
 


[web2py] Re: [web2py:33655] Re: import/install matplotlib or other modules from other python on system?

2011-07-20 Thread Hadi
mdipierro mdipierro@... writes:

 
 
 On Oct 25, 11:30 am, Vincent vinc...@... wrote:
  Not sure how I missed that.
  I am getting this error,
 
   os.chdir('/Users/vmd/Dropbox/web2py/web2py.app')
   from gluon.main import *
 
 install the web2py source version if you are going this
 
 


Hi Guys,
Please help me out. it's making me to go insane. I can't find out how to import
the matplotlib within web2py.

i want to import LXML and matplotlib.

What should i do?

THANKS A LOT.

All the best,
Hadi



[web2py] Re: [web2py:33655] Re: import/install matplotlib or other modules from other python on system?

2011-07-20 Thread Anthony
If you're running one of the web2py binary versions, web2py runs its own 
Python interpreter, so it won't have access to the Python installed on your 
system (or any of its modules). If you want to use the Python on your 
system, just run the source version of web2py -- it's just as easy as the 
binary -- simply download, unzip, and run the /web2py/web2py.py file. Then 
you should be able to import matplotlib (assuming it is installed on your 
system).
 
Anthony

On Wednesday, July 20, 2011 11:50:39 AM UTC-4, Hadi wrote:

 mdipierro mdipierro@... writes: 

  
  
  On Oct 25, 11:30 am, Vincent vinc...@... wrote:
   Not sure how I missed that.
   I am getting this error,
  
os.chdir('/Users/vmd/Dropbox/web2py/web2py.app')
from gluon.main import *
  
  install the web2py source version if you are going this
  
  


 Hi Guys,
 Please help me out. it's making me to go insane. I can't find out how to 
 import
 the matplotlib within web2py. 

 i want to import LXML and matplotlib. 

 What should i do? 

 THANKS A LOT. 

 All the best,
 Hadi 



[web2py] typo book chapter 8

2011-07-20 Thread Herman
@auth.requires_login()
def hello():
return dict(message='hello %(first_name)' % auth.user)

is missing an s after %(first_name)  :

@auth.requires_login()
def hello():
return dict(message='hello %(first_name)s' % auth.user)


Re: [web2py] Re: CRON or Background script?

2011-07-20 Thread ron_m
Run 2 copies of web2py, one for the script and the other for the web site. 
If the database is SQLite you will end up with blocking problems if the 
background task takes too long.


[web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Chris Baron
I have already corrected that - sorry for the confusion...

On Jul 20, 10:23 am, Roberto Perdomo roberto...@gmail.com wrote:
 i think that you code is wrong, try with:

 return dict( ownedByUser = ownTable.create(), sharedWithUser
 = sharedWithUser.create() )

 you were doubling ownTable on the dict.

 2011/7/20 Chris Baron topher.ba...@gmail.com







  I'm still having a problem getting two powertables on one page.  If I
  comment out the code for the second powertable, everything is fine,
  but it seems the first powertable can't find its data.  Please refer
  to code posted above.  I think this has something to do with
  instantiation, specifically, I think that this is my problem :

     ownTable = plugins.powerTable
     # do stuff with ownTable

     shareTable = plugins.powerTable
      #do stuff with shareTable

     return dict( ownedByUser = ownTable.create(), sharedWithUser =
  ownTable.create() )

  How do I get separate instances?

  On Jul 20, 9:40 am, Chris Baron topher.ba...@gmail.com wrote:
   Thank you for the prompt responses.

   On Jul 19, 4:12 pm, Roberto Perdomo roberto...@gmail.com wrote:

Hello, it's me again.

Well, I discovered that the problem of loading the table with load is
  in
the event live plugin_powertable.py. I've replaced the event live
  for
bind, and, works, but just load the details for the first 10 rows
displayed when loading the table.

Is there any way to fix this error?

thanks
2011/7/19 Bruno Rocha rochacbr...@gmail.com

 this should be:

 table.dtfeatures['aoColumns'] = ''

 dtfeatures implement any option from datatables.net

 On Tue, Jul 19, 2011 at 1:32 PM, Christopher Baron 
  cba...@fieldmuseum.org
  wrote:

 Does anyone know where, what to set the 'aoColumns' property to ?

 The documentation for this plugin is not helpful...

 On Jul 18, 1:25 pm, Roberto Perdomo roberto...@gmail.com wrote:
  I now discover that only show the details only for the first 10
  records.

  I send you to your mail my app, because is very hevy for the group
  mail.

  2011/7/18 Bruno Rocha rochacbr...@gmail.com

   include ownTable._id = something and ownTable._class =
  something
 to set
   different class and id to the tables.

   On Mon, Jul 18, 2011 at 12:57 PM, Chris Baron 
  topher.ba...@gmail.com
 wrote:

   How do you do it ?

   Here is my controller :

   ownDataSource = db( db.gtree.contributor == '
   '.join( [ auth.user.first_name, auth.user.last_name ] )
  ).select()

      class ownVirtualFields(object):
          @virtualsettings(label='Tree')
          def tree_url(self):
              gtree = self.gtree.id
              u = URL(c=gtree,f=view,args=self.gtree.id,
   vars=dict(treeType='grafted'))
              return A('grafted', _href=u)

      ownTable = plugins.powerTable
      ownTable.datasource = ownDataSource
      ownTable.dtfeatures[sScrollY] = 200px
      ownTable.dtfeatures[sScrollX] = 100%
      ownTable.virtualfields = ownVirtualFields()
      ownTable.headers = labels
      ownTable.showkeycolumn = False
      ownTable.dtfeatures[bJQueryUI] =
   request.vars.get(jqueryui,True)
      ## ownTable.uitheme = request.vars.get(theme,cupertino)
      ownTable.uitheme = request.vars.get(theme,smoothness)
      ownTable.dtfeatures[iDisplayLength] = 25
      ownTable.dtfeatures[aaSorting] = [[6,'desc']]
      ownTable.dtfeatures[sPaginationType] = request.vars.get(
          pager,full_numbers
          ) # two_button scrolling
      ownTable.columns = [gtree.id,
                            virtual.tree_url,
                            gtree.mtime,
                            gtree.title,
                            gtree.comment ]

      ownTable.extra = dict(autoresize=True)

      

      uniqueUserId = db( db.user_map.auth_user_id ==
   auth.user.id ).select()[0].unique_user_id

      shareDataSource = db( ( db.gtree.id == db.gtree_share.gtree
  ) 
                            ( db.gtree_share.user ==
   uniqueUserId ) ).select()

      class shareVirtualFields(object):
          @virtualsettings(label='Tree')
          def tree_url(self):
              gtree = self.gtree.id
              u = URL(c=gtree,f=view,args=self.gtree.id,
   vars=dict(treeType='grafted'))
              return A('grafted', _href=u)
   shareTable = plugins.powerTable
      shareTable.datasource = shareDataSource
      shareTable.dtfeatures[sScrollY] = 200px
      shareTable.dtfeatures[sScrollX] = 100%
      shareTable.virtualfields = shareVirtualFields()
      shareTable.headers = labels
      shareTable.showkeycolumn = False
      shareTable.dtfeatures[bJQueryUI] =
   request.vars.get(jqueryui,True)
      ## shareTable.uitheme =
  

[web2py] Re: web2py (context process , midelware)

2011-07-20 Thread Anthony
On Wednesday, July 20, 2011 10:56:18 AM UTC-4, ariel.glez.m wrote: 

 what thing replace in web2py the context process

 
I'm not too familiar with Django and its context processors -- it looks like 
they automatically add particular variables/objects to your template context 
before rendering. Note, in web2py, all of the web2py API global objects, 
including request, response, and session, are automatically available in the 
environment in which templates are rendered. Also, any variables/objects 
defined in any model file are available in the template environment. Looking 
at Django's default context processors, I think most of that stuff is 
already available in web2py's template environment (e.g., the entire auth 
object, which is defined in a model file, is available in the template 
environment, including auth.user).
 

 and midelware of 
 django.

 
Here's what the book has to say about middleware: 
http://web2py.com/book/default/chapter/04#WSGI
 
Massimo also suggested some alternatives here: 
https://groups.google.com/d/msg/web2py/xEwZJeZGhSM/1tdX__F--voJ
 
I think much of what is handled by standard Django middleware is handled 
(usually automatically and by default) by other means in web2py (e.g., 
sessions, auth, CSRF protection, transactions, internationalization, etc.).
 
Anthony


[web2py] Re: gluon/contrib/simplejson/encoder.py changes

2011-07-20 Thread Massimo Di Pierro
Yes. It was a problem to maintain a patched fork of simplejson and it
used to cause conflicts. Now we have

json in gluon/serializers.py which hanldes date/datetimes.

On Jul 19, 11:33 am, Carl m...@carlroach.com wrote:
 sometime between Web2py v1.89.1 and v1.93.2 encoder.py was changed so
 it didn't explicitly support 'datetime'.

 my code now trips an exception about simplejson not supporting
 datetime

 is datetime handled in a different fashion?


Re: [web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Bruno Rocha
Sorry,

Powertable is 'alpha' and I have too much work to do to improve it.
I am trying to solve things..

BTW: I am comming with a new grid system, a complete one, based on CRUD
http://labs.blouweb.com/PowerGrid/default/noimages

(in tests)


[web2py] Re: CAS Auth with other technologies

2011-07-20 Thread Massimo Di Pierro
The CAS server supports but 1 and 2 but defaults to 2 which is more
portable. It should work with third party clients out of the box.



On Jul 19, 8:09 pm, Bruno Bemfica brunobemf...@gmail.com wrote:
 Hi, I'm new on Web2Py and Python, and I have a question: There's any
 way to make apps developed with other technologies (in my case, PHP
 and ASP.NET) authenticate with the web2py CAS server? I need to
 integrate some apps to my company and we have systems made in a lot of
 different technologies. What we need is, for example: Login into the
 web2py app, and if the user click in a link to an ASP.NET or PHP
 application, he doesn't need to login again, and vice-versa.

 Thanks!


[web2py] Re: view for email message

2011-07-20 Thread Massimo Di Pierro
I think you are looking for the wrong solution to the problem.

You should just use

from gluon.template import render
mail.sent(to=...,message=render(content=...,context={..}))

On Jul 18, 4:47 am, Manuele Pesenti manuele.pese...@gmail.com wrote:
 hi *,

 I woulld like to reuse a controller function with a different view to
 get an html message to send via email... how is it possible?

 Is there a way from python code to get the html text that is returned
 when a browser call an url that correspond to my controller dressed by
 my view with the same name of my controller and, for example, with
 .email extension?

 many thanks

         Manuele


Re: [web2py] Re: gluon/contrib/simplejson/encoder.py changes

2011-07-20 Thread Carl Roach
excellent.
I'm using @service.jsonrpc as a decorator to controller functions and
setting service=Service(globals()) in db.py

what needs to change to move to the new approach?

p.s. the 3rd edition hardcopy arrived last week... my, how it's grown!
excellent production!

On 20 July 2011 18:20, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 Yes. It was a problem to maintain a patched fork of simplejson and it
 used to cause conflicts. Now we have

 json in gluon/serializers.py which hanldes date/datetimes.

 On Jul 19, 11:33 am, Carl m...@carlroach.com wrote:
 sometime between Web2py v1.89.1 and v1.93.2 encoder.py was changed so
 it didn't explicitly support 'datetime'.

 my code now trips an exception about simplejson not supporting
 datetime

 is datetime handled in a different fashion?



[web2py] apologies

2011-07-20 Thread Massimo Di Pierro
Hello everybody,

I apologize I have been not active on the list for a few days does to
a series of circumstances: travel, power outage, jetlag. Anyway, looks
like Anthony, Jonathan and a few others manage to answer almost all
the questions which proves I am not needed and that is good. ;-)
Anyway, if there is any pending issue feel free to ping.

Massimo


Re: [web2py] apologies

2011-07-20 Thread Bruno Rocha
form.validate() and form.process() patch that I sent. ( need to be tested,
validates etc..)

On Wed, Jul 20, 2011 at 2:39 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Hello everybody,

 I apologize I have been not active on the list for a few days does to
 a series of circumstances: travel, power outage, jetlag. Anyway, looks
 like Anthony, Jonathan and a few others manage to answer almost all
 the questions which proves I am not needed and that is good. ;-)
 Anyway, if there is any pending issue feel free to ping.

 Massimo




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] apologies

2011-07-20 Thread José Luis Redrejo Rodríguez
There are a couple of bugs I reported a couple of weeks ago:
http://code.google.com/p/web2py/issues/detail?id=324
http://code.google.com/p/web2py/issues/detail?id=319

Both contain suggested patches to fix them, and #324 is specially
important for many people.

2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com:
 Hello everybody,

 I apologize I have been not active on the list for a few days does to
 a series of circumstances: travel, power outage, jetlag. Anyway, looks
 like Anthony, Jonathan and a few others manage to answer almost all
 the questions which proves I am not needed and that is good. ;-)
 Anyway, if there is any pending issue feel free to ping.

 Massimo


[web2py] Re: adding plugin_wiki to existing application - prettydate

2011-07-20 Thread Vincent
Hi Anthony,

thanks for clarifying that. I guess my question is then:

why does it work in the default application without having to do from
gluon.tools import prettydate in the page.html view?

Or more explicitly, what could cause the prettydate function to be
in the namespace in the page.html view in the fresh default app and
not in my app?

thanks
Vincent

On Jul 20, 9:09 am, Anthony abasta...@gmail.com wrote:
 On Wednesday, July 20, 2011 8:11:56 AM UTC-4, Vincent wrote:

  after some digging around I found the prettydate function in
  gluon.tools.

  If I from gluon.tools import prettydate directly in the page.html
  view I no longer get an error. If I do the same thing but only in the
  controller it still does not work.

 The views are not run in the same context as the controller, so if you
 import a module in a controller, it will not be available in the view.

 Anthony


[web2py] Google Apps / Google Account Authentication

2011-07-20 Thread Nikhil Rishi
Hi
I am a beginner in web2py, after going through the manual.. the very
first thing I am trying to do is using Google Apps/ Google Accounts as
Authentication instead of regular user-names and passes.

Please help. Please provide exact steps what i need to do.

Thanks
Nikhil


[web2py] Re: apologies

2011-07-20 Thread Massimo Di Pierro
Please send me an example of code that breaks issue 319.

On Jul 20, 12:45 pm, José Luis Redrejo Rodríguez jredr...@debian.org
wrote:
 There are a couple of bugs I reported a couple of weeks 
 ago:http://code.google.com/p/web2py/issues/detail?id=324http://code.google.com/p/web2py/issues/detail?id=319

 Both contain suggested patches to fix them, and #324 is specially
 important for many people.

 2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com:







  Hello everybody,

  I apologize I have been not active on the list for a few days does to
  a series of circumstances: travel, power outage, jetlag. Anyway, looks
  like Anthony, Jonathan and a few others manage to answer almost all
  the questions which proves I am not needed and that is good. ;-)
  Anyway, if there is any pending issue feel free to ping.

  Massimo


[web2py] Re: adding plugin_wiki to existing application - prettydate

2011-07-20 Thread Anthony
I'm not sure about that -- maybe Massimo can answer. 

On Wednesday, July 20, 2011 2:18:23 PM UTC-4, Vincent wrote:

 Hi Anthony, 

 thanks for clarifying that. I guess my question is then: 

 why does it work in the default application without having to do from 
 gluon.tools import prettydate in the page.html view? 

 Or more explicitly, what could cause the prettydate function to be 
 in the namespace in the page.html view in the fresh default app and 
 not in my app? 

 thanks 
 Vincent 

 On Jul 20, 9:09 am, Anthony abas...@gmail.com wrote: 
  On Wednesday, July 20, 2011 8:11:56 AM UTC-4, Vincent wrote: 
  
   after some digging around I found the prettydate function in 
   gluon.tools. 
  
   If I from gluon.tools import prettydate directly in the page.html 
   view I no longer get an error. If I do the same thing but only in the 
   controller it still does not work. 
  
  The views are not run in the same context as the controller, so if you 
  import a module in a controller, it will not be available in the view. 
  
  Anthony



[web2py] Re: apologies

2011-07-20 Thread demetrio
Hi Massimo, i sent a mail a few days ago asking about some way to
provide simultaneous multi-language support to our application. If
you (or somebody) could give some suggestion would be nice.

http://groups.google.com/group/web2py/browse_thread/thread/d6525c6623aad50c

thanks in advance

On 20 jul, 19:39, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Hello everybody,

 I apologize I have been not active on the list for a few days does to
 a series of circumstances: travel, power outage, jetlag. Anyway, looks
 like Anthony, Jonathan and a few others manage to answer almost all
 the questions which proves I am not needed and that is good. ;-)
 Anyway, if there is any pending issue feel free to ping.

 Massimo


Re: [web2py] Re: apologies

2011-07-20 Thread Vasile Ermicioi
just an old wish of mine:
- make web2py to work with latest pyamf version,
- and there is a bug in latest version which is not fixed in trunk

thank you


[web2py] Re: typo book chapter 8

2011-07-20 Thread cjrh
On Jul 20, 12:32 pm, Herman herman...@gmail.com wrote:
 is missing an s after %(first_name)  :

Fixed, well-spotted thank you.


Re: [web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Roberto Perdomo
Hi, thanks for your work with powertables.

Today i resolved the problem, editing plugin_powertable.py.

I have replace live for bind, but not only load the details for the first 10
records. The solution was load the table with all records (iDisplayLength =
-1), but recentlly discovered that live is not recomended.

Finally replace live with delegate and works very fine usind LOAD method
from web2py.

thanks you.

Attached plugin_powertable.py modified.


2011/7/20 Bruno Rocha rochacbr...@gmail.com

 Sorry,

 Powertable is 'alpha' and I have too much work to do to improve it.
 I am trying to solve things..

 BTW: I am comming with a new grid system, a complete one, based on CRUD
 http://labs.blouweb.com/PowerGrid/default/noimages

 (in tests)

# -*- coding: utf-8 -*-
###
#AUTHOR AND LICENSE
###
# This is an ALPHA VERSION
# This uses code taken from web2py gluon/sqlhtml.py, plugin_datatable,plugin_webgrid 
#
# Web2py plugin powerTable ( Version ALPHA 0.1.1 : 2010-12-28 ) 
# Copyright (c) 2010 Rocha, Bruno Cezar
# @rochacbruno
# https://bitbucket.org/rochacbruno/powertable
# http://powertable.blouweb.com
#
# License Code: GPL, General Public License v. 2.0
# License Content: Creative Commons Attribution 3.0 
#
# Also visit: www.web2py.com 
# or Groups: http://groups.google.com/group/web2py 
#http://groups.google.com/group/web2py-usuarios  
#
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see http://www.gnu.org/licenses/
###
###
#HOW TO : More info, tutorial and complete API in powertable.blouweb.com
###
#def index():
##every method of this class is a function which returns a Virtual Field
#class Virtual(object):
#@virtualsettings(label=T('Information:'))
#def virtualtooltip(self):
#return T('This is a virtual tooltip for record %s' % self.person.id)
#
## Alias to the plugin object
#mytable = plugins.powerTable
#
#mytable.datasource = db.auth_user
#mytable.virtualfields = Virtual()
#mytable.headers = 'fieldname:capitalize'
#mytable.dtfeatures['bJQueryUI'] = True
#mytable.uitheme = 'smoothness'
#mytable.extra = dict(tooltip={'value':'vitualtooltip'})
#mytable.dtfeatures['sPaginationType'] = 'scrolling'
## you can specify the columns, remove to show all
#mytable.columns = ['auth_user.id','auth_user.first_name','auth_user.last_name','auth_user.email']
#
#return dict(table=mytable.create())
#
#



###
#INITIALISATION
###
import time
import re
table_field = re.compile('[\w_]+\.[\w_]+')
from gluon.sql import  Row, Rows, Set, Query,Table

if not 'plugin_powertablesdb' in globals():
if 'db' in globals():
plugin_powertablesdb = db
else:
raise ReferenceError('You need to define either db or plugin_powertablesdb for PowerTables')


plugins = PluginManager('powerTable')
powerTable = plugins.powerTable


###
#MAIN CLASS, THE powerTable OBJECT
###

class PowerTable(TABLE):

def __init__(self):

#load attributes from plugin manager
datasource = powerTable.get('datasource',getfakerow())
database = powerTable.get('database',plugin_powertablesdb)
headers = powerTable.get('headers',{})
columns = powerTable.get('columns',None)
hiddencolumns = powerTable.get('hiddencolumns',[])
orderby = powerTable.get('orderby',None)
linkto = powerTable.get('linkto',None)
upload = powerTable.get('upload',None)
truncate = powerTable.get('truncate',255)
th_link = powerTable.get('th_link','')
virtualfields = powerTable.get('virtualfields',None)
keycolumn = 

Re: [web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Roberto Perdomo
Bruno, if you can send me PowerGrid for test it, i'd appreciate it, looks
great.


2011/7/20 Roberto Perdomo roberto...@gmail.com

 Hi, thanks for your work with powertables.

 Today i resolved the problem, editing plugin_powertable.py.

 I have replace live for bind, but not only load the details for the first
 10 records. The solution was load the table with all records (iDisplayLength
 = -1), but recentlly discovered that live is not recomended.

 Finally replace live with delegate and works very fine usind LOAD method
 from web2py.

 thanks you.

 Attached plugin_powertable.py modified.


 2011/7/20 Bruno Rocha rochacbr...@gmail.com

 Sorry,

 Powertable is 'alpha' and I have too much work to do to improve it.
 I am trying to solve things..

 BTW: I am comming with a new grid system, a complete one, based on CRUD
 http://labs.blouweb.com/PowerGrid/default/noimages

 (in tests)





[web2py] Re: Simultaneous multi-language system.

2011-07-20 Thread Christopher Steel
On the one hand If you only want to display two languages at the same time 
at all times then translations are not required. 

If on the other hand you want people to be able to switch between languages 
like this http://voiceofaccess.org ,  then translations are required but 
displaying both languages at the same time is not required because people 
can switch languages on the fly.


C.




Re: [web2py] Re: Simultaneous multi-language system.

2011-07-20 Thread Daniel Gonzalez Zaballos
The thing is that in Spain, there are some bilingual regions with their own
language besides the official language. Sometimes they require that an app
be in the main language (spanish) and their specifical language and the
capatility to switch between them, and rarely (this case), have both
simultaneosly. If in the future, we sell the same app to a customer in a
different region with its own language, we will need to revise all the code
to find the literals and traduce them, and worse, have to maintain different
versions of the same application with the only difference of the language.

That's one of the reasons why we are looking for an optimal solution, like a
way to extend the T() object.

Thanks for your time.
Best regards
Daniel


2011/7/20 Christopher Steel chris.st...@gmail.com

 On the one hand If you only want to display two languages at the same time
 at all times then translations are not required.

 If on the other hand you want people to be able to switch between languages
 like this http://voiceofaccess.org ,  then translations are required but
 displaying both languages at the same time is not required because people
 can switch languages on the fly.


 C.




[web2py] Adding date() and time() to Field object

2011-07-20 Thread Angelo Compagnucci
Hello list members,

sometimes is useful to exctract the date or the time from a Filed
object without traversing the rows returned by a select statement.

I provide an examlpe:

db.define_table('test',Field('data','datetime'))

def getdates():
   rows = db(db.test).select(db.test.data.date())
   return dict(rows=rows)

def gettimes():
   rows = db(db.test).select(db.test.data.time())
   return dict(rows=rows)

This could be usefull in all the cases where yuo have to produce
statistics based on time and dates, think of how many access I had
per day? Or per month?.

An example:

hsname = 'testhotspot'
entry_date = dbradius.radacct.AcctStartTime.year()|
dbradius.radacct.AcctStartTime.month()|
dbradius.radacct.AcctStartTime.day()
rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
count,
dbradius.radacct.RadAcctStartTime.date,
groupby=entry_date)

Whitout the date method in Field object, I have to traverse the rows
object and produce another rows object with the datetimes swapped by
dates. It's not elegant and really time consuming when you have many
rows. Excracting date or time directly db side is really a fast
operation and it is supported by all major db. I verified this and I
think every database supported by DAL should have these options.

I apologize for being reopening this discussion (I previuosly made
another request on the ml) but Massimo was not here so He can read
this time!

I'm willing to implement this feature if anybody intrested.

I have already added the two methods (date and time) but what I obtain
is a string, not a date or a time object as I'm expecting. Can anyone
help me?

Thank you


Re: [web2py] apologies

2011-07-20 Thread Michele Comitini
Gee... Massimo aren't you on vacation? Stop bothering us! ;-) ;-)

mic


2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com:
 Hello everybody,

 I apologize I have been not active on the list for a few days does to
 a series of circumstances: travel, power outage, jetlag. Anyway, looks
 like Anthony, Jonathan and a few others manage to answer almost all
 the questions which proves I am not needed and that is good. ;-)
 Anyway, if there is any pending issue feel free to ping.

 Massimo


[web2py] Re: Simultaneous multi-language system.

2011-07-20 Thread Anthony
I think there are a few possibilities. First, your MultiT function could 
work, but you'd have to use str(T(text)) instead of T(text). The reason is 
that T() returns a lazyT object, not the translated string (it isn't 
translated until rendering). You can force the translation by calling the 
lazyT.__str__ method via str(T(text)).
 
Another option is to define your own T() objects for each language and force 
them to use the specific language. For example:
 
In a model file:
from gluon.languages import translator
enT=translator(request)
enT.force('en-en')
esT=translator(request)
esT.force('es-es')
 
In a view:
{{=esT('House')}} / {{=enT('House')}}
 
 
It would probably be easy to abstract the above by defining a class that 
stores multiple T objects and lets you easily add additional ones.
 
A third option might be to create a special multi-language translation file. 
For example, you could create a file called es-en.py, which could include 
translations such as:
 
'House': 'Casa / House'
 
 
Hope that helps.
 
Anthony
 

On Wednesday, July 13, 2011 1:22:23 PM UTC-4, demetrio wrote:

 Hi everyone, i don't know if Simultaneous multi-language system is 
 the correct way to say what i need... i'll explain myself. 

 I'm developing an application that by request of our customer, needs 
 to have 2 languages at the same time. For example, if this app were in 
 spanish and english, in the navigator should appear something like: 

 Casa / House 

 In the view we want to do something like this 

 {{=T(House, es-es)}} / {{=T(House, en-en)}} 

 But i don't know if web2py can permit to do this or something like 
 that. 

 I was thinking of writing a function like this: 

 def MultiT(text,separator= / ): 
 T.force(es-es) 
 ret_text = T(text) 
 T.force(en-en) 
 ret_text += separator + T(text) 
 return ret_text 

 But it does not work. Also, do not know how this affects the system 
 when updating the language files with the strings to translate (now 
 the files are updated automatically when pressing the update 
 languages button in admin, and I guess that it would make it on run 
 time. 

 Any sugestions? 

 Best regards 
 Daniel



Re: [web2py] Re: powertable ( multiple tables on the same page )

2011-07-20 Thread Bruno Rocha
PLUGIN PowerGrid

ONLY FOR TESTERS!! It is an Pre Alpha Version.

No Documentation yet (use it by example)

It would be full of JavaScript Bugs and need documentation, if you can help
with documentation please let me know your bitbucket user.

DEMO: http://labs.blouweb.com/PowerGrid/default/index
DOWNLOAD app  plugin :
https://bitbucket.org/rochacbruno/powergrid/downloads

http://labs.blouweb.com

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda Python e web2py online:
http://CursoDePython.com.brhttp://cursodepython.com.br/
 ]
[ O seu aliado nos cuidados com os animais:
http://AnimalSystem.com.brhttp://animalsystem.com.br/
 ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] What about a few web2py server vm builds

2011-07-20 Thread Mike Veltman
First I dont know if someone already did it.

I have been playing with suse studio for a while and I thought to build a 
vm/install iso for a base and test web2py server.

So I do some brainstorming

It will be based on a minimal server (opensuse 11.4) install.

I was thinking/brainstorming  to do the following.

1) create a web2py user with a few scripts for dumping and loading databases 
and to start a web2py shell.
2) create a default mysql database with a defaultdb database thats used in the 
web2py setup.
3) Place Web2py in /srv/web2py
4) The installation should not use more then 4 GB
5) The installation should use LV setup for easy increase of space
6) Web2py should be autostarting.
7) iso and vm for installation on usb or in vmware/kvm etc

I was wondering if it would be smart to push web2py into a apache webserver or 
something else. And what other things I should add. 



With regards,
Mike Veltman




[web2py] Re: web2py on github

2011-07-20 Thread luckysmack
oh yea? well thats handy. am i able to fork/clone a mercurial repo as
a git repo?

On Jul 20, 4:33 am, blackthorne francisco@gmail.com wrote:
 be aware that google code hosting now supports git..

 On Jul 20, 4:44 am, luckysmack luckysm...@gmail.com wrote:







  Well i was going to for the original. But it being so out of date, i
  thought i would just take the mercurial branch and use a tool to
  convert the code and its branches with history to git. that way it is
  exactly what is in the mercurial repos. But doing that i cant fork it.
  i would need to create my own repo. which would mean there would be
  duplicate repos for web2py. is there a way i can for the one on github
  and then merge in the converted mercurial to git copy? since they
  essentially have separate remotes. Anyone know of a way i could do
  this?

  On Jul 19, 8:31 pm, luckysmack luckysm...@gmail.com wrote:

   Letting those users out there know that I will forking the web2py on
   github (which is outdated) and will be updating it as I will need it
   and its easier (for me at least) to keep all my repos in one location.
   Ive already forked it and will be updating it shortly.

  https://github.com/luckysmack/web2py


[web2py] No CallBack (Onaccept) When using facebook or Twitter Connect for loging.

2011-07-20 Thread Yannick
Hello Mate,

When using Facebook Connect for login purpose there is no
Callback(onaccept) method that Web2py can call and execute right after
the user login to the application. The Callback is only available for
Web2Py Auth.

I was wondering why that Web2py limitation ?

From the application level I can find a work around this by updating a
table in the DB but I was wondering if you have another work around at
the Framework (Web2py) level without changing the tools.py code.

Cheers,
Yannick P.


[web2py] Re: record representation using a non-id column?

2011-07-20 Thread niknok
Thanks Johann!

On Jul 20, 8:11 pm, Johann Spies johann.sp...@gmail.com wrote:
 On 20 July 2011 14:09, Johann Spies johann.sp...@gmail.com wrote:



  I use this:

  db.define_table('akb_doccenter_location',

                  Field('location'))

 Apologies, I did not complete the message before sending: the model includes
 a Field(uuid),  obviously.

 Regards
 Johann

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


[web2py] Re: Google Apps / Google Account Authentication

2011-07-20 Thread Anthony
Have you looked at 
http://code.google.com/p/web2py/source/browse/gluon/contrib/login_methods/gae_google_account.py?
 
See http://web2py.com/book/default/chapter/08?search=GAE+login.
 
Anthony

On Wednesday, July 20, 2011 2:12:33 PM UTC-4, Nikhil Rishi wrote:

 Hi 
 I am a beginner in web2py, after going through the manual.. the very 
 first thing I am trying to do is using Google Apps/ Google Accounts as 
 Authentication instead of regular user-names and passes. 

 Please help. Please provide exact steps what i need to do. 

 Thanks 
 Nikhil



[web2py] Re: export data to OOO and Excel

2011-07-20 Thread Vineet
Hi Joaco,
Thanks for your reply.
The information given by you is very helpful.
Thanks again.
--Vineet

On Jul 20, 4:56 pm, Joaquin Orbe joaquino...@gmail.com wrote:
 On Wed, Jul 20, 2011 at 5:45 AM, Vineet vineet.deod...@gmail.com wrote:
  I was looking for a library to export data to OpenOffice  Excel.
  I found 2 such open source projects.

  For OOO ---
 http://ooolib.sourceforge.net/

  For Excel ---
 http://www.python-excel.org/

  What I intend to do is, keep the classes in web2py folder, import the
  classes in controller, then parse the result fetched from MySQL and
  export the data to OOO or Excel.

  Reasons as to why I am posting it here are--

  1] Whether anybody has tried these and knows if these are mostly bug-
  free (may not be 100%)
  2] Whether anybody knows any other (better suited, may be) projects
  like these (considering integration into w2p, feature-rich, tested,
  etc.)
  3] To share my findings with the list (might be useful to someone
  new).

  Cheers
  :-)

 Hi Vineet,
 I used xlwt for a non-production site and worked fine for me (just a
 very simple report with a small formatting).
 This is a quick example:

 def excel_report():
     from datetime import datetime
     import xlwt
     tmpfilename=os.path.join(request.folder,'private',str(uuid4()))

     font0 = xlwt.Font()
     font0.name = 'Arial'
     font0.bold = True

     style0 = xlwt.XFStyle()
     style0.font = font0

     style1 = xlwt.XFStyle()
     style1.num_format_str = 'DD--'

     wb = xlwt.Workbook()
     ws = wb.add_sheet('Sample report')

     ws.write(0, 0, 'Text here', style0)
     ws.write(0, 6, 'More text here', style0)
     ws.write(0, 7, datetime.now(), style1)

     wb.save(tmpfilename)

     data = open(tmpfilename,rb).read()
     os.unlink(tmpfilename)
     response.headers['Content-Type']='application/vnd.ms-excel'
     return data

 Hope it helps you.

 Joaco.


Re: [web2py] Re: web2py on github

2011-07-20 Thread Jonathan Lundell
On Jul 20, 2011, at 7:05 PM, luckysmack wrote:
 
 oh yea? well thats handy. am i able to fork/clone a mercurial repo as
 a git repo?

Why git, btw? Seems like sticking with hg would be more straightforward.

 
 On Jul 20, 4:33 am, blackthorne francisco@gmail.com wrote:
 be aware that google code hosting now supports git..
 
 On Jul 20, 4:44 am, luckysmack luckysm...@gmail.com wrote:
 
 
 
 
 
 
 
 Well i was going to for the original. But it being so out of date, i
 thought i would just take the mercurial branch and use a tool to
 convert the code and its branches with history to git. that way it is
 exactly what is in the mercurial repos. But doing that i cant fork it.
 i would need to create my own repo. which would mean there would be
 duplicate repos for web2py. is there a way i can for the one on github
 and then merge in the converted mercurial to git copy? since they
 essentially have separate remotes. Anyone know of a way i could do
 this?
 
 On Jul 19, 8:31 pm, luckysmack luckysm...@gmail.com wrote:
 
 Letting those users out there know that I will forking the web2py on
 github (which is outdated) and will be updating it as I will need it
 and its easier (for me at least) to keep all my repos in one location.
 Ive already forked it and will be updating it shortly.
 
 https://github.com/luckysmack/web2py




[web2py] http://www.web2py.com/book/default/chapter/11

2011-07-20 Thread noelrv
URL for ref.83 is broken - http://sial.org/howto/openssl/self-signed


[web2py] typo: http://www.web2py.com/book/default/chapter/11

2011-07-20 Thread noelrv
typo in apt-get below:

sudo apt-egt -y install libapache2-mod-proxy-html


[web2py] Just started web development

2011-07-20 Thread Furqan
Hey guys,
Just wanted to say hi to all of you, I recently started using web2py,
actually i was going to start it on Django but I read lots of good
things about web2py so I am planning on using it.

I have done some python programming but I am new to web development
with python.
Thanks

Furqan


[web2py] AttributeError: 'thread._local' with wsgiref.simple_server or similar

2011-07-20 Thread Christopher F
Hi,

I'm trying to call web2py.gluon.main.wsgibase depending on whether a
url path matches.

The code is like this:

[...]

os.chdir(web2py_dir)
import web2py.gluon.main
os.chdir(current_dir)

[...]

if [...]:
httpd = wsgiref.simple_server.make_server('', int(options.port),
self)
httpd.serve_forever()
else:
socket_name = options.socket
flup.server.fcgi.WSGIServer(self,
bindAddress=socket_name).run()



where self has __call__(self, environ, start_response) and will call
web2py.gluon.main.wsgibase or another wsgi app.

When I try to visit the page (simple_server or flup with lighttpd), I
get this error:

Traceback (most recent call last):
  File [redacted]/web2py/gluon/restricted.py, line 192, in
restricted
exec ccode in environment
  File [redacted]/web2py/applications/[redacted]/models/db.py, line
35, in module
auth = Auth(db)# authentication/
authorization
  File [redacted]/web2py/gluon/tools.py, line 805, in __init__
request = current.request
AttributeError: 'thread._local' object has no attribute 'request'

The admin application runs fine however. It says: Version 1.97.1
Running on WSGIServer/0.1 Python/2.7.1+

Will web2py work in call chains like this? I'm not sure how this is
different than running plain web2py with web2py built-in servers,
doesn't it end up calling wsgibase anyway?

Thanks for your help.


[web2py] Re: adding plugin_wiki to existing application - prettydate

2011-07-20 Thread Massimo Di Pierro
In file
views/plugin_wiki/comment.html:
there is
{{from gluon.tools import prettydate}}

On Jul 20, 1:39 pm, Anthony abasta...@gmail.com wrote:
 I'm not sure about that -- maybe Massimo can answer.







 On Wednesday, July 20, 2011 2:18:23 PM UTC-4, Vincent wrote:
  Hi Anthony,

  thanks for clarifying that. I guess my question is then:

  why does it work in the default application without having to do from
  gluon.tools import prettydate in the page.html view?

  Or more explicitly, what could cause the prettydate function to be
  in the namespace in the page.html view in the fresh default app and
  not in my app?

  thanks
  Vincent

  On Jul 20, 9:09 am, Anthony abas...@gmail.com wrote:
   On Wednesday, July 20, 2011 8:11:56 AM UTC-4, Vincent wrote:

after some digging around I found the prettydate function in
gluon.tools.

If I from gluon.tools import prettydate directly in the page.html
view I no longer get an error. If I do the same thing but only in the
controller it still does not work.

   The views are not run in the same context as the controller, so if you
   import a module in a controller, it will not be available in the view.

   Anthony


[web2py] Re: Adding date() and time() to Field object

2011-07-20 Thread Massimo Di Pierro
I agree it would be useful.
It will be tricky to implement.
Moreover

row = db().select(db.table.field.date()).first()

would not go into row.field but into row[db.table.field.date()]

it  would be much easier to just provide a function row.field.asdate()
or row.field.astime()


On Jul 20, 5:03 pm, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Hello list members,

 sometimes is useful to exctract the date or the time from a Filed
 object without traversing the rows returned by a select statement.

 I provide an examlpe:

 db.define_table('test',Field('data','datetime'))

 def getdates():
    rows = db(db.test).select(db.test.data.date())
    return dict(rows=rows)

 def gettimes():
    rows = db(db.test).select(db.test.data.time())
    return dict(rows=rows)

 This could be usefull in all the cases where yuo have to produce
 statistics based on time and dates, think of how many access I had
 per day? Or per month?.

 An example:

 hsname = 'testhotspot'
 entry_date = dbradius.radacct.AcctStartTime.year()|
                             dbradius.radacct.AcctStartTime.month()|
                             dbradius.radacct.AcctStartTime.day()
 rows = dbradius(dbradius.radacct.CalledStationId==hsname).select(
                             count,
                             dbradius.radacct.RadAcctStartTime.date,
                             groupby=entry_date)

 Whitout the date method in Field object, I have to traverse the rows
 object and produce another rows object with the datetimes swapped by
 dates. It's not elegant and really time consuming when you have many
 rows. Excracting date or time directly db side is really a fast
 operation and it is supported by all major db. I verified this and I
 think every database supported by DAL should have these options.

 I apologize for being reopening this discussion (I previuosly made
 another request on the ml) but Massimo was not here so He can read
 this time!

 I'm willing to implement this feature if anybody intrested.

 I have already added the two methods (date and time) but what I obtain
 is a string, not a date or a time object as I'm expecting. Can anyone
 help me?

 Thank you


[web2py] Re: apologies

2011-07-20 Thread Massimo Di Pierro
LOL

On Jul 20, 5:22 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 Gee... Massimo aren't you on vacation? Stop bothering us! ;-) ;-)

 mic

 2011/7/20 Massimo Di Pierro massimo.dipie...@gmail.com:







  Hello everybody,

  I apologize I have been not active on the list for a few days does to
  a series of circumstances: travel, power outage, jetlag. Anyway, looks
  like Anthony, Jonathan and a few others manage to answer almost all
  the questions which proves I am not needed and that is good. ;-)
  Anyway, if there is any pending issue feel free to ping.

  Massimo


Re: [web2py] What about a few web2py server vm builds

2011-07-20 Thread pbreit
I'm not a fan of images and instead try to steer towards a scripting 
approach. There are a bunch of scripts in the Web2py distro and I and others 
have also created some scripts:

https://bitbucket.org/pbreit/web2py-automation
http://code.google.com/p/web2py/source/browse/#hg%2Fscripts


[web2py] Re: apologies

2011-07-20 Thread Massimo Di Pierro
I think 1 is fixed in trunk. Did you try? What is the bug not fixed in
trunk?

On Jul 20, 1:48 pm, Vasile Ermicioi elff...@gmail.com wrote:
 just an old wish of mine:
 - make web2py to work with latest pyamf version,
 - and there is a bug in latest version which is not fixed in trunk

 thank you


[web2py] Re: Simultaneous multi-language system.

2011-07-20 Thread Massimo Di Pierro
I think for now Anthony's proposal is the way to go. Open a ticket in
google code and we can think of other options.

On Jul 20, 5:53 pm, Anthony abasta...@gmail.com wrote:
 I think there are a few possibilities. First, your MultiT function could
 work, but you'd have to use str(T(text)) instead of T(text). The reason is
 that T() returns a lazyT object, not the translated string (it isn't
 translated until rendering). You can force the translation by calling the
 lazyT.__str__ method via str(T(text)).

 Another option is to define your own T() objects for each language and force
 them to use the specific language. For example:

 In a model file:
 from gluon.languages import translator
 enT=translator(request)
 enT.force('en-en')
 esT=translator(request)
 esT.force('es-es')

 In a view:
 {{=esT('House')}} / {{=enT('House')}}

 It would probably be easy to abstract the above by defining a class that
 stores multiple T objects and lets you easily add additional ones.

 A third option might be to create a special multi-language translation file.
 For example, you could create a file called es-en.py, which could include
 translations such as:

 'House': 'Casa / House'

 Hope that helps.

 Anthony







 On Wednesday, July 13, 2011 1:22:23 PM UTC-4, demetrio wrote:
  Hi everyone, i don't know if Simultaneous multi-language system is
  the correct way to say what i need... i'll explain myself.

  I'm developing an application that by request of our customer, needs
  to have 2 languages at the same time. For example, if this app were in
  spanish and english, in the navigator should appear something like:

  Casa / House

  In the view we want to do something like this

  {{=T(House, es-es)}} / {{=T(House, en-en)}}

  But i don't know if web2py can permit to do this or something like
  that.

  I was thinking of writing a function like this:

  def MultiT(text,separator= / ):
      T.force(es-es)
      ret_text = T(text)
      T.force(en-en)
      ret_text += separator + T(text)
      return ret_text

  But it does not work. Also, do not know how this affects the system
  when updating the language files with the strings to translate (now
  the files are updated automatically when pressing the update
  languages button in admin, and I guess that it would make it on run
  time.

  Any sugestions?

  Best regards
  Daniel


[web2py] Re: What about a few web2py server vm builds

2011-07-20 Thread Massimo Di Pierro
There was discussion

http://www.turnkeylinux.org/forum/general/20110107/tklpatch-web2py-framework



On Jul 20, 8:04 pm, Mike Veltman mike.velt...@gmail.com wrote:
 First I dont know if someone already did it.

 I have been playing with suse studio for a while and I thought to build a
 vm/install iso for a base and test web2py server.

 So I do some brainstorming

 It will be based on a minimal server (opensuse 11.4) install.

 I was thinking/brainstorming  to do the following.

 1) create a web2py user with a few scripts for dumping and loading databases
 and to start a web2py shell.
 2) create a default mysql database with a defaultdb database thats used in the
 web2py setup.
 3) Place Web2py in /srv/web2py
 4) The installation should not use more then 4 GB
 5) The installation should use LV setup for easy increase of space
 6) Web2py should be autostarting.
 7) iso and vm for installation on usb or in vmware/kvm etc

 I was wondering if it would be smart to push web2py into a apache webserver or
 something else. And what other things I should add.

 With regards,
 Mike Veltman


[web2py] Re: apologies

2011-07-20 Thread annet
I posted this problem a view days ago:


http://groups.google.com/group/web2py/browse_thread/thread/4f37d6ab1d2d752a


It's not an issue, but it's still bothering me ;-)


Kind regards,

Annet.