[web2py] Re: Multiple tables, one form with image upload

2011-10-03 Thread TheSweetlink
Hello pbreit,

I cannot find the post on this group where I found it but I'm pretty
sure form.vars.filename_newfilename is what you're looking for.

This is not to be confused with request.vars.filename.filename which
will contain your original filename.  form.vars.filename_filename will
contain the new filename returned by store()

Rather than using two tables from models I am defining my Fields
directly in my SQLFORM.factory but that shouldn't matter in this case.

I have successfully uploaded files to the filesystem having
SQLFORM.factory calling store() and renaming the file for me.

I had to specify an uploadfolder similar to
uploadfolder=os.path.join(request.folder,'static/uploads/') in my
SQLFORM.factory.  (Just realized that's what you helped me with a few
days ago.)

Try this in your db.image.insert(...):

def newpost():
form = SQLFORM.factory(db.post, db.image)
if form.process().accepted:
post_id = db.post.insert(**db.post._filter_fields(form.vars))
db.image.insert(post_id=post_id,
filename=form.vars.filename_newfilename)
redirect(URL('post', args=post_id))
return dict(form=form)


-David

On Oct 2, 4:23 am, pbreit pbreitenb...@gmail.com wrote:
 I can't seem to figure out how to do multiple tables in one form where an
 image upload is involved. I've tried various combinations of this.
 Unfortunately I'm not getting meaningful error messages right now,
 everything is listed as timed out.

 db.define_table('post',
     Field('title'),
     Field('body', 'text'))

 db.define_table('image',
     Field('post_id', db.post, readable=False, writable=False),
     Field('filename', 'upload'))

 def newpost():
     form = SQLFORM.factory(db.post, db.image)
     if form.process().accepted:
         post_id = db.post.insert(**db.post._filter_fields(form.vars))
         db.image.insert(post_id=post_id,
             filename=db.image.filename.store(form.vars.filename.file,
 form.vars.filename.filename))
         redirect(URL('post', args=post_id))
     return dict(form=form)


Re: [web2py] Re: wrapping long text lengths in grid/smartgrid

2011-10-03 Thread Johann Spies
On 1 October 2011 05:28, Bruno Rocha rochacbr...@gmail.com wrote:

 grid should have a truncate parameter.


It seems that there is none at the moment.  I got

TypeError: grid() got an unexpected keyword argument 'truncate'


when trying

form = SQLFORM.grid(query, columns = columns,deletable = False,
 orderby = db.akb_articles.title,  maxtextlength
= 40,
 truncate = 150
)

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


Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode

2011-10-03 Thread Roberto De Ioris

Il giorno 03/ott/2011, alle ore 07:51, MidGe ha scritto:

 Thank you for your interest and quick reply.
 
 I was meaning disabling it in:
 
 applications/welcome/controllers/appadmin.py
 
 
  Ah! Yes, I could do that,  But I also am able to log in and edit when using 
 apache as a server.
 
 i suspect the webfaction proxy is not passing the correct headers (or is
 using some other technic) to let uWSGI knows the scheme is https.
 
  Yes, something like that is the cause.
 
 This can be easy fixed with a WSGI middleware, but i would like to be sure
 about it.
 
 Fine I can duplicate an re-duplicate here.  I can insert any code to 
 debug/test and am quite prepared to help in anyway. I just need some guidance 
 as I am in an area where I have little knowledge (uwsgi).
 
 Thanks again
 
 Michel



I have just committed support for X-FORWARDED-SSL header (it looks like it is 
what webfaction is using). It works only in --http-socket mode
(not --http one). If you can install the mercurial version on webfaction and 
test it, i will backport the patch to the stable tree.

Thanks

--
Roberto De Ioris
http://unbit.it
JID: robe...@jabber.unbit.it



Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode

2011-10-03 Thread MidGe
OK, will give it a shot and let you know.

What is the mercurial command for the version you committed?

Michel


Re: [web2py] MongoDB and Web2py

2011-10-03 Thread ~redShadow~
On Sun, 2011-10-02 at 14:52 -0700, Francisco Costa wrote: 
 I don't want to spam the group about this, but I would like to have
 some official incites about when will the DAL have a MongoDB Adapter.
 
 
 Since this is the most requested feature by the web2py community
 http://web2py.uservoice.com/forums/42577-general are there any plans
 or schedule for this support?

I am using pymongo directly in some experiments, but I'd prefer it to be
integrated directly in the DAL. I was trying to extend the actual
adapter by monkeypatching that, but I found quite hard to write that due
to the lack of documentation on what adapters should do exactly (am I
wrong? There's some doc that I wasn't able to find?).

Anyways, I'd need MongoDBAdapter working for a project, so I'm willingly
to cooperate in writing and testing that, I'm just a bit stuck trying to
understand how adapters should work, by reading the source code of other
adapters..

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  Software is like sex: it's better when it's free!
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread andrej burja
hi

how could i add a sum in the linked table?
i have person, linked table payments. Opening the payments table from person 
table, displaying only payments from that person, i would like to display 
the sum for that person. How can i do that?
and how to change the label on button 't_payments'?

andrej


Re: [web2py] Re: wrapping long text lengths in grid/smartgrid

2011-10-03 Thread David Marko
Here is the complete signature of grid method from source there is 
really no truncate param.

  def grid(query,
 fields=None,
 field_id=None,
 left=None,
 headers={},
 columns=None,
 orderby=None,
 searchable=True,
 sortable=True,
 paginate=20,
 deletable=True,
 editable=True,
 details=True,
 selectable=None,
 create=True,
 csv=True,
 links=None,
 upload = 'default',
 args=[],
 user_signature = True,
 maxtextlengths={},
 maxtextlength=20,
 onvalidation=None,
 oncreate=None,
 onupdate=None, 
 ondelete=None,
 sorter_icons=('[^]','[v]'),
 ui = 'web2py',
 showbuttontext=True,
 _class=web2py_grid, 
 formname='web2py_grid',
):


[web2py] Re: how to select a row that isn't linked by a second table?

2011-10-03 Thread Cliff
pbreit's answer will work as well.

In case you don't grok left joins, check out the book at this link:

http://www.web2py.com/book/default/chapter/06#One-to-Many-Relation

No matter your experience level, it is very helpful to Read The Fine
Manual.  Web2py has plenty of neat features to make life easier for
the web developer.

On Oct 1, 6:07 pm, pbreit pbreitenb...@gmail.com wrote:
 I think this works:

 db(db.b.link==None).select(db.a.ALL, db.b.ALL,
 left=db.b.on(db.a.id==db.b.link))


[web2py] Re: Problem with private mode of fluxflex

2011-10-03 Thread monotasker
Although my previous issues were a bit different, I've just hit the same 
login problem this morning. The site was fine when I went to sleep last 
night, and now the login doesn't persist past page refresh. In my case it 
wasn't related to private mode, though.


Re: Re : Re: [web2py] Re: fluxflex

2011-10-03 Thread monotasker
In case you haven't figured this out yet, you need to use https:// when you 
access the admin page on a remote site. If you try to use http:// you'll get 
that message about the password file not being accessible.


[web2py] composite views

2011-10-03 Thread Matt Broadstone
Good morning,
   I have a situation where I want to display composite views (a view
for an object inside a view for its parent object). I have a class
Connection that has a Profile associated with it. Profile can be one
of a number of different subclasses (AProfile, BProfile, CProfile). I
also have views associated for each of the profiles, within a
template directory under the views/connection directory. The way
I've tried to go about solving this is to make a view.html (associated
with the view() method in the controller) as a base template with a
block for profile_section inside of it. Then, in each of the profile
templates, I extend view.html and then fill out the block for the
profile.

The problem I am now facing is how to properly route to the right
template file from within the controller's view method. I know I could
just create a new method in the controller for each profile type, but
I'd rather not do that if possible. I also think that a simple
redirect is not the right solution here. Can anyone advise as to the
best way to do this? Or am I just on the wrong track with the whole
extend idea?

Thank you,
Matt


Re: [web2py] composite views

2011-10-03 Thread Bruno Rocha
You can always set

if x:
response.view = 'folder/file.html'
elif y:
response.view = ''

Also, you can use:

def action:
 return response.render(file.html, dict(context=context))


On Mon, Oct 3, 2011 at 10:16 AM, Matt Broadstone mbroa...@gmail.com wrote:

 Good morning,
   I have a situation where I want to display composite views (a view
 for an object inside a view for its parent object). I have a class
 Connection that has a Profile associated with it. Profile can be one
 of a number of different subclasses (AProfile, BProfile, CProfile). I
 also have views associated for each of the profiles, within a
 template directory under the views/connection directory. The way
 I've tried to go about solving this is to make a view.html (associated
 with the view() method in the controller) as a base template with a
 block for profile_section inside of it. Then, in each of the profile
 templates, I extend view.html and then fill out the block for the
 profile.

 The problem I am now facing is how to properly route to the right
 template file from within the controller's view method. I know I could
 just create a new method in the controller for each profile type, but
 I'd rather not do that if possible. I also think that a simple
 redirect is not the right solution here. Can anyone advise as to the
 best way to do this? Or am I just on the wrong track with the whole
 extend idea?

 Thank you,
 Matt




-- 



--
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 ]


[web2py] DAL orderby question: should this work?

2011-10-03 Thread Cliff
The book says to do orderby this way
db.person.ALL, orderby=db.person.name

But I am using this:
db.person.ALL, orderby='name'

Is this an undocumented feature that might go away at some point, or
can I continue to rely on it?

Thanks,
Cliff Kachinske


[web2py] Re: Subdomain based on blog users in routes.py

2011-10-03 Thread Farsheed Ashouri
Yes Anthony, I've read it 50 times! but i cant figure out this one. your 
code doesn't work. I test it few times on my local and main server. :(
 I am giving up!


Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
On Mon, Oct 3, 2011 at 10:11 AM, Bruno Rocha rochacbr...@gmail.com wrote:
 You can always set
 if x:
 response.view = 'folder/file.html'
 elif y:
 response.view = ''
 Also, you can use:
 def action:
      return response.render(file.html, dict(context=context))

I tried this with the following code in my controller:

if (isinstance(p, TestProtocol)):
response.view = connection/templates/test.html


and I get this error:
Traceback (most recent call last):
  File /home/mbroadstone/app/src/web2py/gluon/template.py, line 437,
in _get_file_text
fileobj = open(filepath, 'rb')
IOError: [Errno 2] No such file or directory:
'/home/mbroadstone/app/src/web2py/applications/app/views/../edit.html'

I then tried to print out what response.view should have been prior,
and it contained connection/edit.html as expected. What am I doing
wrong here?

Matt


 On Mon, Oct 3, 2011 at 10:16 AM, Matt Broadstone mbroa...@gmail.com wrote:

 Good morning,
   I have a situation where I want to display composite views (a view
 for an object inside a view for its parent object). I have a class
 Connection that has a Profile associated with it. Profile can be one
 of a number of different subclasses (AProfile, BProfile, CProfile). I
 also have views associated for each of the profiles, within a
 template directory under the views/connection directory. The way
 I've tried to go about solving this is to make a view.html (associated
 with the view() method in the controller) as a base template with a
 block for profile_section inside of it. Then, in each of the profile
 templates, I extend view.html and then fill out the block for the
 profile.

 The problem I am now facing is how to properly route to the right
 template file from within the controller's view method. I know I could
 just create a new method in the controller for each profile type, but
 I'd rather not do that if possible. I also think that a simple
 redirect is not the right solution here. Can anyone advise as to the
 best way to do this? Or am I just on the wrong track with the whole
 extend idea?

 Thank you,
 Matt



 --



 --
 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 ]



[web2py] Encryption/Decryption Modules

2011-10-03 Thread horridohobbyist
I'm looking for a way to encrypt/decrypt data in web2py. Someone
suggested that pyme is already included in web2py, but I think he's
just plain wrong. I've seen references to m2secret on the web, but
it's obvious that it needs to be installed.

I've not been able to figure out how to install M2Crypto or m2secret.
What is my best course of action?

(I'm currently using pyDes, which is an all-Python implementation. It
is exceedingly slow, however.)

Thanks,
Richard


Re: [web2py] composite views

2011-10-03 Thread Matt Broadstone
On Mon, Oct 3, 2011 at 10:49 AM, Matt Broadstone mbroa...@gmail.com wrote:
 On Mon, Oct 3, 2011 at 10:11 AM, Bruno Rocha rochacbr...@gmail.com wrote:
 You can always set
 if x:
 response.view = 'folder/file.html'
 elif y:
 response.view = ''
 Also, you can use:
 def action:
      return response.render(file.html, dict(context=context))

 I tried this with the following code in my controller:

        if (isinstance(p, TestProtocol)):
            response.view = connection/templates/test.html


 and I get this error:
 Traceback (most recent call last):
  File /home/mbroadstone/app/src/web2py/gluon/template.py, line 437,
 in _get_file_text
    fileobj = open(filepath, 'rb')
 IOError: [Errno 2] No such file or directory:
 '/home/mbroadstone/app/src/web2py/applications/app/views/../edit.html'

 I then tried to print out what response.view should have been prior,
 and it contained connection/edit.html as expected. What am I doing
 wrong here?

Apologies, this has to do with the extend being used in the
sub-template. Thank you very much for your help

 Matt


 On Mon, Oct 3, 2011 at 10:16 AM, Matt Broadstone mbroa...@gmail.com wrote:

 Good morning,
   I have a situation where I want to display composite views (a view
 for an object inside a view for its parent object). I have a class
 Connection that has a Profile associated with it. Profile can be one
 of a number of different subclasses (AProfile, BProfile, CProfile). I
 also have views associated for each of the profiles, within a
 template directory under the views/connection directory. The way
 I've tried to go about solving this is to make a view.html (associated
 with the view() method in the controller) as a base template with a
 block for profile_section inside of it. Then, in each of the profile
 templates, I extend view.html and then fill out the block for the
 profile.

 The problem I am now facing is how to properly route to the right
 template file from within the controller's view method. I know I could
 just create a new method in the controller for each profile type, but
 I'd rather not do that if possible. I also think that a simple
 redirect is not the right solution here. Can anyone advise as to the
 best way to do this? Or am I just on the wrong track with the whole
 extend idea?

 Thank you,
 Matt



 --



 --
 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 ]




[web2py] Re: Help: multiple=True with requires = IS_IN_SET()

2011-10-03 Thread jkral
No this does not work:
 ...requires=[IS_IN_SET(...), IS_NOT_EMPTY(), ...]

Here the widget is added manually:

 db.define_table('info',
   Field('info_number', 'integer', label='Info Number'),
   Field('description', 'text'),
   Field('environment', widget=SQLFORM.widgets.checkboxes.widget),
   Field('notice'))


On Sep 30, 7:39 pm, Anthony abasta...@gmail.com wrote:
 On Friday, September 30, 2011 3:48:53 PM UTC-4, DenesL wrote:

  ...requires=[IS_IN_SET(...), IS_NOT_EMPTY(), ...]

 Are you saying that the above currently works but simply suppresses the
 widget? In that case, would it be possible to manually add the widget back?

 ...requires = [IS_NOT_EMPTY(), IS_IN_SET(...)]  # widget won't show by
 default due to the list
 ...widget = SQLFORM.widgets.multiple.widget  # manually specify the multiple
 widget

 Anthony


[web2py] Re: Help: multiple=True with requires = IS_IN_SET()

2011-10-03 Thread jkral
I don't know if I am jumping the gun here, but DenesL your widget
example appears to test for   0, albeit it's not presented in the
checkbox form, but it does seem to require 1 or more environments to
be selected.

(= ♥


On Oct 1, 12:10 pm, DenesL denes1...@yahoo.ca wrote:
 On Sep 30, 8:39 pm, Anthony abasta...@gmail.com wrote:

  On Friday, September 30, 2011 3:48:53 PM UTC-4, DenesL wrote:

  ...widget = SQLFORM.widgets.multiple.widget  # manually specify the multiple
  widget


[web2py] Problem with login not lasting after page refresh

2011-10-03 Thread monotasker
I've got an alpha-stage language quizzing app at paideia.fluxflex.com that 
requires auth login for pretty well every controller to track students' 
performance. But today when I pushed new changes to the server the login no 
longer lasts past any page refresh. Even an ajax refresh of a component 
returns a login link instead of the expected contents. This affects the 
admin interface too, where I'm prompted for my admin login on every action 
(i.e., page refresh). But this only happens on the public server. When I run 
the app locally (on the rocket server) I have no problems. I've had a lot of 
minor trouble with fluxflex, so I'm not sure if this is a server-level 
problem or whether I've somehow introduced a bug. Any idea what would cause 
this kind of behaviour?

(I'm a bit panicked here because my students are supposed to be using the 
app! That's what I get for trying to use a devel site in a class.) 

Thanks.


[web2py] Re: Help: multiple=True with requires = IS_IN_SET()

2011-10-03 Thread jkral
Nope lies...  I did jump the gun (I need to work on my giddiness .)

On Oct 3, 11:00 am, jkral jk...@gogoair.com wrote:
 I don't know if I am jumping the gun here, but DenesL your widget
 example appears to test for   0, albeit it's not presented in the
 checkbox form, but it does seem to require 1 or more environments to
 be selected.

 (= ♥

 On Oct 1, 12:10 pm, DenesL denes1...@yahoo.ca wrote:







  On Sep 30, 8:39 pm, Anthony abasta...@gmail.com wrote:

   On Friday, September 30, 2011 3:48:53 PM UTC-4, DenesL wrote:
   ...widget = SQLFORM.widgets.multiple.widget  # manually specify the 
   multiple
   widget


[web2py] Smartgrid litle bug

2011-10-03 Thread Roberto Perdomo
When i delete a row, the records dissapear fron the grid, but the counter
still mantains the previus value


[web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread David Marko
Just taking the example from web2py manual as below, how can I force web2py 
to show dropdown for father_id and mother_id fields with existing person 
items/values? For self-reference definition I cannot use IS_IN_DB validator, 
so there are no widgets displayed.

db.define_table('person',
Field http://www.web2py.com/book/default/docstring/Field('name'),
Field http://www.web2py.com/book/default/docstring/Field('father_id', 
'reference 
person'),
Field http://www.web2py.com/book/default/docstring/Field('mother_id', 
'reference 
person'))



Re: [web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread Richard Vézina
There is a issue about that :

http://code.google.com/p/web2py/issues/detail?id=382

So it seems that it still pending? Do you have the last stable version?

Richard

On Mon, Oct 3, 2011 at 1:44 PM, David Marko dma...@tiscali.cz wrote:

 Just taking the example from web2py manual as below, how can I force web2py
 to show dropdown for father_id and mother_id fields with existing person
 items/values? For self-reference definition I cannot use IS_IN_DB validator,
 so there are no widgets displayed.

 db.define_table('person',
 Field http://www.web2py.com/book/default/docstring/Field('name'),
 Field http://www.web2py.com/book/default/docstring/Field('father_id', 
 'reference
 person'),
 Field http://www.web2py.com/book/default/docstring/Field('mother_id', 
 'reference
 person'))




Re: [web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread Richard Vézina
You can correct the problem yourself with represent for now... It's what I
did.

Richard

On Mon, Oct 3, 2011 at 1:58 PM, Richard Vézina
ml.richard.vez...@gmail.comwrote:

 There is a issue about that :

 http://code.google.com/p/web2py/issues/detail?id=382

 So it seems that it still pending? Do you have the last stable version?

 Richard


 On Mon, Oct 3, 2011 at 1:44 PM, David Marko dma...@tiscali.cz wrote:

 Just taking the example from web2py manual as below, how can I force
 web2py to show dropdown for father_id and mother_id fields with existing
 person items/values? For self-reference definition I cannot use IS_IN_DB
 validator, so there are no widgets displayed.

 db.define_table('person',
 Field http://www.web2py.com/book/default/docstring/Field('name'),
 Field http://www.web2py.com/book/default/docstring/Field('father_id', 
 'reference
 person'),
 Field http://www.web2py.com/book/default/docstring/Field('mother_id', 
 'reference
 person'))





[web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Massimo Di Pierro


On Oct 3, 5:07 am, andrej burja andrej.bu...@gmail.com wrote:
 hi

 how could i add a sum in the linked table?
 i have person, linked table payments. Opening the payments table from person
 table, displaying only payments from that person, i would like to display
 the sum for that person. How can i do that?

That's a good idea for a new feature. Please open a ticket

 and how to change the label on button 't_payments'?

db.t_payments._plural = 'My Payments' # requires trunk




 andrej


[web2py] Re: wrapping long text lengths in grid/smartgrid

2011-10-03 Thread Massimo Di Pierro
 maxtextlengths={'tablename.fieldname':20},  # per field
 maxtextlength=20,  # default

On Oct 3, 5:50 am, David Marko dma...@tiscali.cz wrote:
 Here is the complete signature of grid method from source there is
 really no truncate param.

   def grid(query,
              fields=None,
              field_id=None,
              left=None,
              headers={},
              columns=None,
              orderby=None,
              searchable=True,
              sortable=True,
              paginate=20,
              deletable=True,
              editable=True,
              details=True,
              selectable=None,
              create=True,
              csv=True,
              links=None,
              upload = 'default',
              args=[],
              user_signature = True,
              maxtextlengths={},
              maxtextlength=20,
              onvalidation=None,
              oncreate=None,
              onupdate=None,
              ondelete=None,
              sorter_icons=('[^]','[v]'),
              ui = 'web2py',
              showbuttontext=True,
              _class=web2py_grid,            
              formname='web2py_grid',
             ):

Re: [web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread David Marko
Its not the list:reference problem, I use scenario described in here ... h
ttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliaseshttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases

Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode

2011-10-03 Thread Roberto De Ioris

 OK, will give it a shot and let you know.

 What is the mercurial command for the version you committed?

 Michel


hg clone http://projects.unbit.it/hg/uwsgi
cd uwsgi
make

-- 
Roberto De Ioris
http://unbit.it


Re: [web2py] anyone using jython with web2py on production

2011-10-03 Thread Phyo Arkar
My exprience with jython is , its VERY slow compare to CPython , so No
I am not going to recommend it.

On 10/1/11, elffikk elff...@gmail.com wrote:
 hi,

 I am interested to know if there is anyone using jython with web2py in
 production

 - on top of what server
 - with what database
 - what is the memory consumption
 - what is the performance

 thank you


Re: [web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread Richard Vézina
Can you explain I don't understand what's not working if it not the issue
about self reference field that is in cause.

Why you can't use IS_IN_DB?

Richard

On Mon, Oct 3, 2011 at 2:08 PM, David Marko dma...@tiscali.cz wrote:

 Its not the list:reference problem, I use scenario described in here ... h
 ttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliaseshttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases


Re: [web2py] DAL self-reference and how to display dropdown widget

2011-10-03 Thread Richard Vézina
If it is because you can fill both field at a time use
IS_EMPTY_OR(IS_IN_DB(...))

Richard

On Mon, Oct 3, 2011 at 3:10 PM, Richard Vézina
ml.richard.vez...@gmail.comwrote:

 Can you explain I don't understand what's not working if it not the issue
 about self reference field that is in cause.

 Why you can't use IS_IN_DB?

 Richard


 On Mon, Oct 3, 2011 at 2:08 PM, David Marko dma...@tiscali.cz wrote:

 Its not the list:reference problem, I use scenario described in here ... h
 ttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliaseshttp://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases





[web2py] How to start something when page rendering has completed?

2011-10-03 Thread TheSweetlink
Please help me with your suggestions.

I'm playing with Redis pub/sub via redis-py as a possible method to
reload a component in a page instead of polling.

In its simplest form the idea is:

1)  create pubsub object
2)  subscribe it to one or more channels (just one in this case)
3)  create listen object to listen to subscribed channels
4)  listen object calls .next() --- stuck here
5)  new message published to channel triggers component reload

Everything works great on at a python CLI however I cannot seem to
figure out one crucial detail.

When I start the listener object to check for new messages it is a
blocking call so it prevents the page from completely loading while
waiting for a new message on the channel it is subscribed to.

I tried putting listener.next() at the end of my view but it prevents
my page from working properly as it just blocks waiting for a new
message.  A new message allows the page to complete loading but that
defeats the purpose.

How can I completely load my page and then start listening to Redis'
pubsub for new messages?

Your thoughts are most appreciated.

-David


[web2py] Do not break on MySQL :: ERROR 1153: Got a packet bigger than 'max_allowed_packet .

2011-10-03 Thread Phyo Arkar
After webp2y swtich from mysql-python driver to  pymysql , theres no
error raised when a packet size is bigger.
Below error is never raised: version 1.98.2
MySQL :: ERROR 1153: Got a packet bigger than 'max_allowed_packet .


And i am thinking about how to handle Larger than 1GB inserts coz
max_allowed_packet size is 1GB only and I am soon going to encounter
1GB text extracts from archives.

Anyone have idea?

My guess is to do chunk updates

if size(text_to_inserted) = 1024*1024*1024 :
 db.execute(UPDATE table SET field = CONCAT( field, ' this is
appended' ) WHERE id = 1;)

is concat supported in DAL ?


[web2py] Problem with format in DAL table definition ...

2011-10-03 Thread David Marko
I'm using common one-to-many scenario with company and emplees. I'm using 
format in table definitions but I cant see company name in exploee list in 
web2py db admin and smartgrid gives me this 

field.represent = lambda id,r=None,referee=referee,rep=field.represent: 
A(rep(id),_class=trap(),_href=URL(args=request.args[:args]+['view',referee,id], 
user_signature=user_signature))
TypeError: 'NoneType' object is not callable

What I'm doing wrong or is it something broken? I'm using lates trunk version 
...



Re: [web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Jim Steil

This didn't work for me, but maybe I'm applying it in the wrong spot.

My controller is:

@auth.requires_login()
def members():
response.view = 'list.html'
columns = ['member.firstName', 'member.lastName', 'member.city',
   'member.state', 'member.phone', 'member.joinedOn',
   'memberCampaign.campaignId',
   'memberCampaign.amount', 'memberCampaign.paidOn',
   'memberTag.tagId']
db.memberCampaign._plural = 'Campaigns'
grid = SQLFORM.smartgrid(db.member, columns=columns, details=False,
 ui='jquery-ui', csv=False)
return dict(grid=grid)

Running this I get:
Traceback (most recent call last):
  File C:\dev\web2py\gluon\restricted.py, line 194, in restricted
exec ccode in environment
  File C:/dev/web2py/applications/dalc/controllers/default.py, line 
118, in module

  File C:\dev\web2py\gluon\globals.py, line 149, in lambda
self._caller = lambda f: f()
  File C:\dev\web2py\gluon\tools.py, line 2467, in f
return action(*a, **b)
  File C:/dev/web2py/applications/dalc/controllers/default.py, line 
100, in members

db.memberCampaign._plural = 'Campaigns'
  File C:\dev\web2py\gluon\dal.py, line 4981, in __setattr__
raise SyntaxError, 'Object exists and cannot be redefined: %s' % key
SyntaxError: Object exists and cannot be redefined: _plural

Just created my environment from trunk.

Thoughts?

-Jim

On 10/3/2011 12:59 PM, Massimo Di Pierro wrote:


On Oct 3, 5:07 am, andrej burjaandrej.bu...@gmail.com  wrote:

hi

how could i add a sum in the linked table?
i have person, linked table payments. Opening the payments table from person
table, displaying only payments from that person, i would like to display
the sum for that person. How can i do that?

That's a good idea for a new feature. Please open a ticket


and how to change the label on button 't_payments'?

db.t_payments._plural = 'My Payments' # requires trunk




andrej


Re: [web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Phyo Arkar
Very nice work ongoing ..

Only sad thing is i am moving into Qooxdoo framework and  am getting
more and more into it , i am not going to be able to use any of
smartgrid .. It have an excellent Table with well written remote
model.

Hope i can use in web2py way,

On 10/4/11, Jim Steil j...@qlf.com wrote:
 This didn't work for me, but maybe I'm applying it in the wrong spot.

 My controller is:

 @auth.requires_login()
 def members():
  response.view = 'list.html'
  columns = ['member.firstName', 'member.lastName', 'member.city',
 'member.state', 'member.phone', 'member.joinedOn',
 'memberCampaign.campaignId',
 'memberCampaign.amount', 'memberCampaign.paidOn',
 'memberTag.tagId']
  db.memberCampaign._plural = 'Campaigns'
  grid = SQLFORM.smartgrid(db.member, columns=columns, details=False,
   ui='jquery-ui', csv=False)
  return dict(grid=grid)

 Running this I get:
 Traceback (most recent call last):
File C:\dev\web2py\gluon\restricted.py, line 194, in restricted
  exec ccode in environment
File C:/dev/web2py/applications/dalc/controllers/default.py, line
 118, in module
File C:\dev\web2py\gluon\globals.py, line 149, in lambda
  self._caller = lambda f: f()
File C:\dev\web2py\gluon\tools.py, line 2467, in f
  return action(*a, **b)
File C:/dev/web2py/applications/dalc/controllers/default.py, line
 100, in members
  db.memberCampaign._plural = 'Campaigns'
File C:\dev\web2py\gluon\dal.py, line 4981, in __setattr__
  raise SyntaxError, 'Object exists and cannot be redefined: %s' % key
 SyntaxError: Object exists and cannot be redefined: _plural

 Just created my environment from trunk.

 Thoughts?

  -Jim

 On 10/3/2011 12:59 PM, Massimo Di Pierro wrote:

 On Oct 3, 5:07 am, andrej burjaandrej.bu...@gmail.com  wrote:
 hi

 how could i add a sum in the linked table?
 i have person, linked table payments. Opening the payments table from
 person
 table, displaying only payments from that person, i would like to display
 the sum for that person. How can i do that?
 That's a good idea for a new feature. Please open a ticket

 and how to change the label on button 't_payments'?
 db.t_payments._plural = 'My Payments' # requires trunk



 andrej



[web2py] Re: Howto change request.uri_language through URL function?

2011-10-03 Thread Kernc
On Aug 31, 10:44 pm, Alexander Cabezas alexcabez...@gmail.com wrote:
 Did you build it with web2py?

No, that website is powered by PHP.

 How could I do the same thing in my application?

As Massimo mentioned here (https://groups.google.com/d/msg/web2py/
q2B9mekNCwk/tUmqU0Iu-ZIJ), with the exception that in the model
(db.py) you put, instead of
 T.force(request.lang)
this (from here (https://groups.google.com/d/msg/web2py/fpFJQlI21w4/
M1BWlGkB6v8J))
 if request.uri_language: T.force(request.uri_language)

it works well with welcome application.

this is severely underdocumented in the book! i18n section (http://
www.web2py.com/book/default/chapter/04#T-and-Internationalization)
needs extending.


but now that I read your post again, and as I understand, I don't
think you can do it.
you can't link from http://site.com/en/content to http://site.com/fr/content
with URL().
in order to be able to do so, URL needs a lang parameter, so one can
do:
a href={{=URL(a='app', lang='fr', c='controller',
f='function', ...)}}French/a
lang must come in between application and controller.

EDIT: disregard half. you can hack it.
URL() by default produces absolute scheme-less URLs, like this /a/c/f.
so to link from http://site.com/en/a/c/f to http://site.com/fr/a/c/f,
you prepend URL() call with '/fr', like this:
a href=/fr{{=URL(a=request.application, c=request.controller,
f=request.function, ...)}}French/a

HTH?


[web2py] Re: anyone using jython with web2py on production

2011-10-03 Thread Massimo Di Pierro
My experience is that it relays on the java regular expression parser
instead of the python one and that result in difference of behavior.

On Oct 3, 2:09 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:
 My exprience with jython is , its VERY slow compare to CPython , so No
 I am not going to recommend it.

 On 10/1/11, elffikk elff...@gmail.com wrote:







  hi,

  I am interested to know if there is anyone using jython with web2py in
  production

  - on top of what server
  - with what database
  - what is the memory consumption
  - what is the performance

  thank you


Re: [web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Anthony
From the code, it looks like you would define _plural at table definition 
time:

db.define_table('memberCampaign', singular='Campaign', plural='Campaigns', 
...)

But it should probably be made changeable. Actually, for now you can do:

db.memberCampaign['_plural'] = 'Campaigns'

Anthony

On Monday, October 3, 2011 3:36:54 PM UTC-4, Jim S wrote:

 This didn't work for me, but maybe I'm applying it in the wrong spot.

 My controller is:

 @auth.requires_login()
 def members():
  response.view = 'list.html'
  columns = ['member.firstName', 'member.lastName', 'member.city',
 'member.state', 'member.phone', 'member.joinedOn',
 'memberCampaign.campaignId',
 'memberCampaign.amount', 'memberCampaign.paidOn',
 'memberTag.tagId']
  db.memberCampaign._plural = 'Campaigns'
  grid = SQLFORM.smartgrid(db.member, columns=columns, details=False,
   ui='jquery-ui', csv=False)
  return dict(grid=grid)

 Running this I get:
 Traceback (most recent call last):
File C:\dev\web2py\gluon\restricted.py, line 194, in restricted
  exec ccode in environment
File C:/dev/web2py/applications/dalc/controllers/default.py, line 
 118, in module
File C:\dev\web2py\gluon\globals.py, line 149, in lambda
  self._caller = lambda f: f()
File C:\dev\web2py\gluon\tools.py, line 2467, in f
  return action(*a, **b)
File C:/dev/web2py/applications/dalc/controllers/default.py, line 
 100, in members
  db.memberCampaign._plural = 'Campaigns'
File C:\dev\web2py\gluon\dal.py, line 4981, in __setattr__
  raise SyntaxError, 'Object exists and cannot be redefined: %s' % key
 SyntaxError: Object exists and cannot be redefined: _plural

 Just created my environment from trunk.

 Thoughts?

  -Jim

 On 10/3/2011 12:59 PM, Massimo Di Pierro wrote:
 
  On Oct 3, 5:07 am, andrej burjaandrej...@gmail.com  wrote:
  hi
 
  how could i add a sum in the linked table?
  i have person, linked table payments. Opening the payments table from 
 person
  table, displaying only payments from that person, i would like to 
 display
  the sum for that person. How can i do that?
  That's a good idea for a new feature. Please open a ticket
 
  and how to change the label on button 't_payments'?
  db.t_payments._plural = 'My Payments' # requires trunk
 
 
 
  andrej



Re: [web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Jim Steil
Thanks Anthony, works perfect.  Yes, it needs to changeable.  I have the 
following tables:


member, campaign and memberCampaign

When I'm using SmartGrid to display members, I need the memberCampaign 
label to say Campaigns, but when I'm using SmartGrid for Campaigns, the 
memberCampaign label needs to say Members.


Adding the line below in my controller code allows that.

Thanks again,

-Jim

On 10/3/2011 3:20 PM, Anthony wrote:
From the code, it looks like you would define _plural at table 
definition time:


db.define_table('memberCampaign', singular='Campaign', 
plural='Campaigns', ...)


But it should probably be made changeable. Actually, for now you can do:

db.memberCampaign['_plural'] = 'Campaigns'

Anthony

On Monday, October 3, 2011 3:36:54 PM UTC-4, Jim S wrote:

This didn't work for me, but maybe I'm applying it in the wrong spot.

My controller is:

@auth.requires_login()
def members():
 response.view = 'list.html'
 columns = ['member.firstName', 'member.lastName', 'member.city',
'member.state', 'member.phone', 'member.joinedOn',
'memberCampaign.campaignId',
'memberCampaign.amount', 'memberCampaign.paidOn',
'memberTag.tagId']
 db.memberCampaign._plural = 'Campaigns'
 grid = SQLFORM.smartgrid(db.member, columns=columns,
details=False,
  ui='jquery-ui', csv=False)
 return dict(grid=grid)

Running this I get:
Traceback (most recent call last):
   File C:\dev\web2py\gluon\restricted.py, line 194, in restricted
 exec ccode in environment
   File C:/dev/web2py/applications/dalc/controllers/default.py,
line
118, in module
   File C:\dev\web2py\gluon\globals.py, line 149, in lambda
 self._caller = lambda f: f()
   File C:\dev\web2py\gluon\tools.py, line 2467, in f
 return action(*a, **b)
   File C:/dev/web2py/applications/dalc/controllers/default.py,
line
100, in members
 db.memberCampaign._plural = 'Campaigns'
   File C:\dev\web2py\gluon\dal.py, line 4981, in __setattr__
 raise SyntaxError, 'Object exists and cannot be redefined:
%s' % key
SyntaxError: Object exists and cannot be redefined: _plural

Just created my environment from trunk.

Thoughts?

 -Jim

On 10/3/2011 12:59 PM, Massimo Di Pierro wrote:

 On Oct 3, 5:07 am, andrej burjaandrej...@gmail.com  wrote:
 hi

 how could i add a sum in the linked table?
 i have person, linked table payments. Opening the payments
table from person
 table, displaying only payments from that person, i would like
to display
 the sum for that person. How can i do that?
 That's a good idea for a new feature. Please open a ticket

 and how to change the label on button 't_payments'?
 db.t_payments._plural = 'My Payments' # requires trunk



 andrej



Re: [web2py] Re: table, grid, smartgrid, getting better

2011-10-03 Thread Anthony
On Monday, October 3, 2011 4:42:17 PM UTC-4, Jim S wrote:

  Thanks Anthony, works perfect.  Yes, it needs to changeable.


I just submitted a patch.

Anthony 


[web2py] Re: anyone using jython with web2py on production

2011-10-03 Thread Chris Clark
Right now it doesn't run. See 
http://code.google.com/p/web2py/issues/detail?id=341
for more detail. If anyone has managed to get it to run please update
the issue with details. There are issues with imports (which can be
hacked around) and the ticketing system crashes.

As Massimo points out if we can get it to work there are known issues
with templates (due to the regex behavior) which were seen with
earlier versions of web2py so for Jython to be viable there are a
significant number of problems to solve first.

RE Speed, I'm actually pretty impressed with Jython's speed but I've
not done any benchmarks. 2.5.2 is noticeably faster than 2.2. Start up
speed can be slow but once it starts running I've had good success
with it (I use it on a few machines where CPython deployment is
tricky). This is general Jython performance observation, web2py and
Jython are not a working combination at the moment.

Chris (note my email address has changed, the domain name is now
Actian not Ingres)


On Oct 3, 1:18 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 My experience is that it relays on the java regular expression parser
 instead of the python one and that result in difference of behavior.

 On Oct 3, 2:09 pm, Phyo Arkar phyo.arkarl...@gmail.com wrote:

  My exprience with jython is , its VERY slow compare to CPython , so No
  I am not going to recommend it.

  On 10/1/11, elffikk elff...@gmail.com wrote:

   hi,

   I am interested to know if there is anyone using jython with web2py in
   production

   - on top of what server
   - with what database
   - what is the memory consumption
   - what is the performance

   thank you




[web2py] Re: Admin security: https vs localhost

2011-10-03 Thread sadik fanan

Hi , i am developing an online booking system on GAE..
.the developement is allmost 
complete...recently i have come to know about brutforce attacks on web based 
application for admin login...
 my application is in web2py framework 
(python)...can anyone here please guide me on a functionality where in , 
the admin 
login will be disabled after 5 wrong password entries ...
..is there any kind of 
plugin available for this,,,
,or any pre existing code that i can put into my code 
to have this doneplease reply on my mail id : sadikfa...@gmail.com
. if the 
above mentioned thing is not possible at all
 in web2py , please suggest other ways 
to make more secured admin login



[web2py] Re: Admin security: https vs localhost

2011-10-03 Thread Anthony
Looks like this has been implemented in admin -- 
see 
http://code.google.com/p/web2py/source/browse/applications/admin/models/access.py#55.
 
Looks like 5 login attempts allowed from a given IP address per hour.

Anthony

On Monday, October 3, 2011 7:16:50 PM UTC-4, sadik fanan wrote:


 Hi , i am developing an online booking system on GAE..
 .the developement is allmost 
 complete...recently i have come to know about brutforce attacks on web 
 based 
 application for admin login...
  my application is in web2py framework 
 (python)...can anyone here please guide me on a functionality where in , 
 the admin 
 login will be disabled after 5 wrong password entries ...
 ..is there any kind of 
 plugin available for this,,,
 ,or any pre existing code that i can put into my code 
 to have this doneplease reply on my mail id : sadik...@gmail.com
 . if the 
 above mentioned thing is not possible at all
  in web2py , please suggest other ways 
 to make more secured admin login



[web2py] CAS question

2011-10-03 Thread mart
Hi all,

I have a central App on our corporate intranet, and multiple instances
of another app residing on multiple build servers.

I would like users to be able to authenticated by registering an
account on the central app (to server as provider), then get access to
all other instances of the other apps (the consumers). But am having
problems with the CAS feature of web2py.

My assumption is that i need to change how auth is being defined in
the consumer's db.py like this:

auth = Auth(db,cas_provider='https://build5.nuance.com/
blueLite_central/default/user/cas')

** build5 being the server that hosts the central app

First, on the consumer app, I did as above

second, I added a user on the central app (the provider),

 third,  I tried to log in on to the consumer app, but got invalid
login

Note: the provider is a full deployement of web2py with administratove
access, while the other apps don't have certs and do not have admin
access (no use of https).

Can anyone see what's wrong with what I am doing?

As usual, any help is much appreciated.

Thanks,
Mart :)




[web2py] Problem with format in DAL table definition ...

2011-10-03 Thread monotasker
What does your model look like?


[web2py] DAL connection to SQL Server 2005 hanging with Linux

2011-10-03 Thread chris_g
I have setup web2py version 1.98.2 on Ubuntu Lucid Lynx. My dal is
connecting to SQL Server 2005 using a connection string like this.

db_connection_string = r'mssql://dbuser:pword92.168.1.1/mydb?
DRIVER=FreeTDS'

After my application has been running for some hours or days, there
seems to some kind of deadlock occurring upon connection to the dal:

db = DAL(config.db_connection_string, migrate=False)

Once this happens in one request it happens in all requests and all
non-static web2py requests time out. I am not seeing any errors in the
logs, apart from being told it has timed out:
[info] [client 192.168.1.231] Request header read timeout

There are at present 33 open connections to the SQL Server db
(including 4 from web2py). From my understanding the maximum number of
connections is 32767.

So I'm curious if anyone else has seen this kind of behaviour or if
there are any suggestions as to how this may be debugged.


[web2py] Re: Google Checkout Plugin Error

2011-10-03 Thread zukunftschauer
Thanks for responding.  As I am just trying to test out the plugin, I
have created a new application specifically for this.  As such, my
files reflect only what is shown in the plugin's model file.

Here are the contents of /var/web2py/applications/
Sample_Google_Checkout/views/default/index.html:

{{extend 'layout.html'}}
img
src={{=URL(request.application,'plugin_google_checkout','button',
dict(next='http://www.google.com'))}} /


Here are the contents of the controller:

def index():
db.plugin_google_checkout_purchase.insert(
 cart_id = 'Sample_Checkout',  # this your cart name
 item_id = 1234,  # this your id for the item
 name=Sample Item 1,
 unit_price=135.25,
 quantity=1)
return dict()

Thanks again for your response.


On Oct 2, 4:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 What's in  /var/web2py/applications/Sample_Google_Checkout/views/
 default/index.html ?

 On Oct 2, 1:26 pm, zukunftschauer zukunftsha...@gmail.com wrote:







  I am trying to evaluate the Google Checkout Plugin, but keep running
  in the same error.  I followed the instructions listed in the Model in
  the plugin.  I am new to web2py, and so far love it, but it you need
  more information than I have provided, please let me know.  I am just
  not experienced enough to track this down, and have tried searching
  everywhere for an answer to no avail.

  I am using the latest web2py (stable) version 1.99.2.  Thanks.

  Traceback (most recent call last):
    File /var/web2py/gluon/restricted.py, line 194, in restricted
      exec ccode in environment
    File /var/web2py/applications/Sample_Google_Checkout/views/default/
  index.html, line 101, in module
    File /var/web2py/gluon/html.py, line 221, in URL
      application = r.application
  AttributeError: 'dict' object has no attribute 'application'

  Error snapshot help

  type 'exceptions.AttributeError'('dict' object has no attribute
  'application')


[web2py] Re: Admin security: https vs localhost

2011-10-03 Thread Massimo Di Pierro
make a file models/plugin_conditionalrecaptcha.py which contains:

MAX_LOGIN_FAILURES = 3
RECAPTCHA_PUBLIC_KEY = ''
RECAPTCHA_PRIVATE_KEY = ''

def _():
from gluon.tools import Recaptcha
key = 'login_from:%s' % request.env.remote_addr
num_login_attempts = cache.ram(key,lambda:0,None)
if num_login_attempts = MAX_LOGIN_FAILURES:
auth.settings.login_captcha = Recaptcha(
   request,RECAPTCHA_PUBLIC_KEY,RECAPTCHA_PRIVATE_KEY)
def login_attempt(form,key=key,n=num_login_attempts+1):
cache.ram(key,lambda n=n:n,0)
def login_success(form,key=key):
cache.ram(key,lambda:0,0)
auth.settings.login_onvalidation.append(login_attempt)
auth.settings.login_onaccept.append(login_success)
_()

On Oct 3, 6:16 pm, sadik fanan sadikfa...@gmail.com wrote:
 Hi , i am developing an online booking system on GAE..
 .the developement is allmost
 complete...recently i have come to know about brutforce attacks on web based
 application for admin login...
  my application is in web2py framework
 (python)...can anyone here please guide me on a functionality where in ,
 the admin
 login will be disabled after 5 wrong password entries ...
 ..is there any kind of
 plugin available for this,,,
 ,or any pre existing code that i can put into my code
 to have this doneplease reply on my mail id : sadikfa...@gmail.com
 . if the
 above mentioned thing is not possible at all
  in web2py , please suggest other ways
 to make more secured admin login


[web2py] Re: CAS question

2011-10-03 Thread Massimo Di Pierro
Perhaps you need to set the cas_domain in the provider?

http://web2py.com/book/default/chapter/08?search=cas_domain

On Oct 3, 7:54 pm, mart msenecal...@gmail.com wrote:
 Hi all,

 I have a central App on our corporate intranet, and multiple instances
 of another app residing on multiple build servers.

 I would like users to be able to authenticated by registering an
 account on the central app (to server as provider), then get access to
 all other instances of the other apps (the consumers). But am having
 problems with the CAS feature of web2py.

 My assumption is that i need to change how auth is being defined in
 the consumer's db.py like this:

 auth = Auth(db,cas_provider='https://build5.nuance.com/
 blueLite_central/default/user/cas')

 ** build5 being the server that hosts the central app

 First, on the consumer app, I did as above

 second, I added a user on the central app (the provider),

  third,  I tried to log in on to the consumer app, but got invalid
 login

 Note: the provider is a full deployement of web2py with administratove
 access, while the other apps don't have certs and do not have admin
 access (no use of https).

 Can anyone see what's wrong with what I am doing?

 As usual, any help is much appreciated.

 Thanks,
 Mart :)


[web2py] Re: Problem with format in DAL table definition ...

2011-10-03 Thread Massimo Di Pierro
I think the problem is here:

field.represent = lambda  rep=field.represent: ... rep(id) 

Do you have a field represent to start with? Looks like you do not.
Even when you do should be rep(id,r) not rep(id).

On Oct 3, 2:34 pm, David Marko dma...@tiscali.cz wrote:
 I'm using common one-to-many scenario with company and emplees. I'm using
 format in table definitions but I cant see company name in exploee list in
 web2py db admin and smartgrid gives me this 

     field.represent = lambda id,r=None,referee=referee,rep=field.represent: 
 A(rep(id),_class=trap(),_href=URL(args=request.args[:args]+['view',referee, 
 id], user_signature=user_signature))
 TypeError: 'NoneType' object is not callable

 What I'm doing wrong or is it something broken? I'm using lates trunk version 
 ...


[web2py] Re: Google Checkout Plugin Error

2011-10-03 Thread Massimo Di Pierro
This is an old plugin... ouch!
Replace this:

img
src={{=URL(request.application,'plugin_google_checkout','button',
dict(next='http://www.google.com'))}} /

with this:

img  src={{=URL('plugin_google_checkout','button',
vars=dict(next='http://www.google.com'))}} /


On Oct 3, 9:18 pm, zukunftschauer zukunftsha...@gmail.com wrote:
 Thanks for responding.  As I am just trying to test out the plugin, I
 have created a new application specifically for this.  As such, my
 files reflect only what is shown in the plugin's model file.

 Here are the contents of /var/web2py/applications/
 Sample_Google_Checkout/views/default/index.html:

 {{extend 'layout.html'}}
 img
 src={{=URL(request.application,'plugin_google_checkout','button',
 dict(next='http://www.google.com'))}} /

 Here are the contents of the controller:

 def index():
     db.plugin_google_checkout_purchase.insert(
      cart_id = 'Sample_Checkout',  # this your cart name
      item_id = 1234,  # this your id for the item
      name=Sample Item 1,
      unit_price=135.25,
      quantity=1)
     return dict()

 Thanks again for your response.

 On Oct 2, 4:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  What's in  /var/web2py/applications/Sample_Google_Checkout/views/
  default/index.html ?

  On Oct 2, 1:26 pm, zukunftschauer zukunftsha...@gmail.com wrote:

   I am trying to evaluate the Google Checkout Plugin, but keep running
   in the same error.  I followed the instructions listed in the Model in
   the plugin.  I am new to web2py, and so far love it, but it you need
   more information than I have provided, please let me know.  I am just
   not experienced enough to track this down, and have tried searching
   everywhere for an answer to no avail.

   I am using the latest web2py (stable) version 1.99.2.  Thanks.

   Traceback (most recent call last):
     File /var/web2py/gluon/restricted.py, line 194, in restricted
       exec ccode in environment
     File /var/web2py/applications/Sample_Google_Checkout/views/default/
   index.html, line 101, in module
     File /var/web2py/gluon/html.py, line 221, in URL
       application = r.application
   AttributeError: 'dict' object has no attribute 'application'

   Error snapshot help

   type 'exceptions.AttributeError'('dict' object has no attribute
   'application')


Re: [web2py] Re: CAS question

2011-10-03 Thread Bruno Rocha
I am curious, are you using default auth tables or custom auth tables?

I am still with errors 'loop redirect' when trying CAS...

On Tue, Oct 4, 2011 at 12:12 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Perhaps you need to set the cas_domain in the provider?

 http://web2py.com/book/default/chapter/08?search=cas_domain

 On Oct 3, 7:54 pm, mart msenecal...@gmail.com wrote:
  Hi all,
 
  I have a central App on our corporate intranet, and multiple instances
  of another app residing on multiple build servers.
 
  I would like users to be able to authenticated by registering an
  account on the central app (to server as provider), then get access to
  all other instances of the other apps (the consumers). But am having
  problems with the CAS feature of web2py.
 
  My assumption is that i need to change how auth is being defined in
  the consumer's db.py like this:
 
  auth = Auth(db,cas_provider='https://build5.nuance.com/
  blueLite_central/default/user/cas')
 
  ** build5 being the server that hosts the central app
 
  First, on the consumer app, I did as above
 
  second, I added a user on the central app (the provider),
 
   third,  I tried to log in on to the consumer app, but got invalid
  login
 
  Note: the provider is a full deployement of web2py with administratove
  access, while the other apps don't have certs and do not have admin
  access (no use of https).
 
  Can anyone see what's wrong with what I am doing?
 
  As usual, any help is much appreciated.
 
  Thanks,
  Mart :)




-- 



--
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 ]


[web2py] Re: CAS question

2011-10-03 Thread Massimo Di Pierro
I re-tested it last week and I cannot reproduce this error.

On Oct 3, 10:18 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 I am curious, are you using default auth tables or custom auth tables?

 I am still with errors 'loop redirect' when trying CAS...

 On Tue, Oct 4, 2011 at 12:12 AM, Massimo Di Pierro 









 massimo.dipie...@gmail.com wrote:
  Perhaps you need to set the cas_domain in the provider?

 http://web2py.com/book/default/chapter/08?search=cas_domain

  On Oct 3, 7:54 pm, mart msenecal...@gmail.com wrote:
   Hi all,

   I have a central App on our corporate intranet, and multiple instances
   of another app residing on multiple build servers.

   I would like users to be able to authenticated by registering an
   account on the central app (to server as provider), then get access to
   all other instances of the other apps (the consumers). But am having
   problems with the CAS feature of web2py.

   My assumption is that i need to change how auth is being defined in
   the consumer's db.py like this:

   auth = Auth(db,cas_provider='https://build5.nuance.com/
   blueLite_central/default/user/cas')

   ** build5 being the server that hosts the central app

   First, on the consumer app, I did as above

   second, I added a user on the central app (the provider),

third,  I tried to log in on to the consumer app, but got invalid
   login

   Note: the provider is a full deployement of web2py with administratove
   access, while the other apps don't have certs and do not have admin
   access (no use of https).

   Can anyone see what's wrong with what I am doing?

   As usual, any help is much appreciated.

   Thanks,
   Mart :)

 --

 --
 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]


[web2py] Re: Problem with login not lasting after page refresh

2011-10-03 Thread pbreit
Might need to see some code. I went to your site and tried to register, 
login and reset password and the pages just seem to refresh without doing 
anything. Can you summarize the nature of the changes you made? Are you 
using version control?

[web2py] Re: Subdomain based on blog users in routes.py

2011-10-03 Thread pbreit
Does doing a simple redirect not work for you?

if request.vars.u:
redirect('%s.mysite.com' % request.vars.u)


[web2py] Re: DAL orderby question: should this work?

2011-10-03 Thread pbreit
I would advise using the more explicit db.person.name since your method 
might break if you have two tables both with a name column.

Re: [web2py] Re: webfaction clean install unable to save any files in admin edit mode

2011-10-03 Thread MidGe
Hi Roberto,

Unfortunately, it failed on the make.  It is missing libxml2 development 
package,

In the error message there is a mention of using libexpat or disabling 
XML...

Anything I can do about this?

Michel


[web2py] Re: CAS question

2011-10-03 Thread mart
sounds good, will try the cas_domain. Thanks for the suggestion.

@ Bruno: I'm using the default auth tables

thanks
Mart :)

On Oct 3, 11:35 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I re-tested it last week and I cannot reproduce this error.

 On Oct 3, 10:18 pm, Bruno Rocha rochacbr...@gmail.com wrote:







  I am curious, are you using default auth tables or custom auth tables?

  I am still with errors 'loop redirect' when trying CAS...

  On Tue, Oct 4, 2011 at 12:12 AM, Massimo Di Pierro 

  massimo.dipie...@gmail.com wrote:
   Perhaps you need to set the cas_domain in the provider?

  http://web2py.com/book/default/chapter/08?search=cas_domain

   On Oct 3, 7:54 pm, mart msenecal...@gmail.com wrote:
Hi all,

I have a central App on our corporate intranet, and multiple instances
of another app residing on multiple build servers.

I would like users to be able to authenticated by registering an
account on the central app (to server as provider), then get access to
all other instances of the other apps (the consumers). But am having
problems with the CAS feature of web2py.

My assumption is that i need to change how auth is being defined in
the consumer's db.py like this:

auth = Auth(db,cas_provider='https://build5.nuance.com/
blueLite_central/default/user/cas')

** build5 being the server that hosts the central app

First, on the consumer app, I did as above

second, I added a user on the central app (the provider),

 third,  I tried to log in on to the consumer app, but got invalid
login

Note: the provider is a full deployement of web2py with administratove
access, while the other apps don't have certs and do not have admin
access (no use of https).

Can anyone see what's wrong with what I am doing?

As usual, any help is much appreciated.

Thanks,
Mart :)

  --

  --
  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]


[web2py] Re: Problem with login not lasting after page refresh

2011-10-03 Thread MidGe
monotasker,

I experience a similar problem but not on fluxflex, on webfaction, and, in 
my case it seems related to uswgi use.

I noticed also that the web2py logo (top left) is duplicated as if I was in 
a recursive mode when another logging is required (almost all pages).

Hope this help


[web2py] Re: Admin security: https vs localhost

2011-10-03 Thread sadik fanan
Massimo Di Pierro massimo.dipierro@... writes:

 
 

Hi , this didnt worked for ...i have tried both the ways mentioned above ...i 
already have access.py in my admin/models folder but it didnt worked outit 
was giving error on keywords like 'DEMO_MODE' and 'restricted'i also tried 
the code snippet mentioned  above but neither is working...please help me 
out..