Re: [web2py] Re: session.token does not get picked up by default value for database entry

2012-01-18 Thread Anthony
On Wednesday, January 18, 2012 11:45:33 PM UTC-5, tsvim wrote:
>
> I think I got it, but I don't understand the solution. If I understand 
> correctly, since the model is run before the controller, default is set to 
> None. But why does lambda solve this?
>

When you set the default to a callable (such as a lambda), it doesn't get 
evaluated until the actual insert is done. By the time the insert happens, 
session.table_token has already been created, so the lambda will return the 
token instead of None.

Anthony 


Re: [web2py] Re: session.token does not get picked up by default value for database entry

2012-01-18 Thread Tsvi Mostovicz
I think I got it, but I don't understand the solution. If I understand
correctly, since the model is run before the controller, default is set to
None. But why does lambda solve this?

Sent from my phone

On 18 בינו 2012, at 23:39, Anthony  wrote:

At the time you assign the default value, session.table_token is None, so
that is the default value. Instead, you can either assign the default value
after you create the session.table_token, or use a lambda:

db._common_fields.append(Field('request_tenant', default=lambda:
session.table_token))

Anthony

On Wednesday, January 18, 2012 3:17:55 PM UTC-5, tsvim wrote:
>
> Hi all,
>
> I get the following weird behavior. I defined a common_fields, being
> request_tenant as such:
>
>
> db._common_fields.append(Field('request_tenant',default=session.table_token,writable=False))
>
> session.table_token is a uuid generated by  the controller.
> There I have the following code:
>
> session.table_token = generate_table_token()
>
> if db(db.table).isempty():
>field_name = 'MyField'
>db.table.insert(name=field_name)
>populate(db.table2,100)
>
> But for some reason it won't take the default value for request_tenant the
> first time. When I reload the page it creates new entriees with the session
> variable correct this time.
>
> I suppose session.table_token does not get evaluated when I first generate
> it, so how can I get the requested behavior? (Both with populate and insert)
>
> Thanks a million for your help,
>
> Tsvi
>


[web2py] Re: Postgres unknown reference field type

2012-01-18 Thread Massimo Di Pierro
from the error looks like you have

Field('Client', 'db.Client'),

instead of

Field('Client', db.Client),

is that possible?

On Jan 18, 6:25 pm, Simon Ashley  wrote:
> Moving from SQLite to Postgres and when running Database
> Administration we're getting unknown field type errors when using a db
> reference i.e. Field('Client', db.Client)
> Any advice or work arounds?
>
> TIA,
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 204, in restricted
>     exec ccode in environment
>   File "C:/web2py/applications/OAS/models/oa.py", line 358, in
> 
>     Field('Interpretation_Type', db.Interpretation_Type))
>   File "C:\web2py\gluon\dal.py", line 5114, in define_table
>     polymodel=polymodel)
>   File "C:\web2py\gluon\dal.py", line 624, in create_table
>     (field.type, field.name)
> SyntaxError: Field: unknown field type: db.Client for Client
>
> Code listing:
>               precision, scale = map(int,field.type[8:-1].split(','))
>                 ftype = self.types[field.type[:7]] % \
>                     dict(precision=precision,scale=scale)
>             elif not field.type in self.types:
>                 raise SyntaxError, 'Field: unknown field type: %s for
> %s' % \
>                     (field.type, field.name)
>
> Model:
>   db.define_table('Client',
>       Field('Company', 'string'),
>       Field('Address', 'string'),
>       Field('Town', 'string'),
>       Field('State', 'string'),
>       Field('Zip', 'string'),
>       Field('Activity', 'integer'),
>       Field('Account', 'integer'),
>       format='%(Company)s')
>
>   db.define_table('Contact',
>       Field('Client', db.Client),
>       Field('Surname', 'string'),
>       Field('First_Name', 'string'),
>       Field('Position', 'string'),
>       Field('Department', 'string'),
>       Field('eMail', 'string'),
>       Field('Mobile', 'string'),
>       Field('Phone', 'string'),
>       Field('Fax', 'string'),
>       format='%(Surname)s - %(First_Name)s')
>
> Environment:
>   Windows 7 64bit
>   Current Postgresql (64bit) with psycopy2
>   web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
> 4, 51, 15), 'stable')
>   Python 2.7.2: C:\Python27\python.exe


Re: [web2py] [off topic] Announcement

2012-01-18 Thread mikech
Congratulations!

Re: [web2py] Re: SQLFORM.smartgrid query/search don't work for related tables

2012-01-18 Thread Jim Steil

Adnan

I did not get this working, but that doesn't mean it has been resolved.  
I've given up on the search that is included in grid/smartgrid and have 
been working on a solution whereby you can override the default behavior 
and provide your own.  I've got a ticket open 
(http://code.google.com/p/web2py/issues/detail?id=523) and am just 
waiting for Massimo to look it over and get it in trunk.


I've been using my mod'd sqlhtml.py for some time and it is working 
really well for me.  I'm hoping my mod can get into trunk.  If it does I 
will then write up a little demo of how it all works.  It is really 
quite simple then to provide your own search capabilities with the 
ability to easily customize it for different pages.


-Jim

On 1/18/2012 1:59 PM, Adi wrote:

Hi Jim,
Did you get this working, since I too don't see the referenced field 
in a query?


Thanks,
Adnan

No virus found in this message.
Checked by AVG - www.avg.com 
Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12



--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell


Re: [web2py] Postgres unknown reference field type

2012-01-18 Thread Richard Vézina
Try migrate = false,  fake migrate = true to fix web2py metadata... Since
you change from sqlite to postgres web2py maybe is mixed up.

Richard

On Wed, Jan 18, 2012 at 7:25 PM, Simon Ashley  wrote:

> Moving from SQLite to Postgres and when running Database
> Administration we're getting unknown field type errors when using a db
> reference i.e. Field('Client', db.Client)
> Any advice or work arounds?
>
> TIA,
>
> Traceback (most recent call last):
>  File "C:\web2py\gluon\restricted.py", line 204, in restricted
>exec ccode in environment
>  File "C:/web2py/applications/OAS/models/oa.py", line 358, in
> 
>Field('Interpretation_Type', db.Interpretation_Type))
>  File "C:\web2py\gluon\dal.py", line 5114, in define_table
>polymodel=polymodel)
>  File "C:\web2py\gluon\dal.py", line 624, in create_table
>(field.type, field.name)
> SyntaxError: Field: unknown field type: db.Client for Client
>
> Code listing:
>  precision, scale = map(int,field.type[8:-1].split(','))
>ftype = self.types[field.type[:7]] % \
>dict(precision=precision,scale=scale)
>elif not field.type in self.types:
>raise SyntaxError, 'Field: unknown field type: %s for
> %s' % \
>(field.type, field.name)
>
> Model:
>  db.define_table('Client',
>  Field('Company', 'string'),
>  Field('Address', 'string'),
>  Field('Town', 'string'),
>  Field('State', 'string'),
>  Field('Zip', 'string'),
>  Field('Activity', 'integer'),
>  Field('Account', 'integer'),
>  format='%(Company)s')
>
>  db.define_table('Contact',
>  Field('Client', db.Client),
>  Field('Surname', 'string'),
>  Field('First_Name', 'string'),
>  Field('Position', 'string'),
>  Field('Department', 'string'),
>  Field('eMail', 'string'),
>  Field('Mobile', 'string'),
>  Field('Phone', 'string'),
>  Field('Fax', 'string'),
>  format='%(Surname)s - %(First_Name)s')
>
> Environment:
>  Windows 7 64bit
>  Current Postgresql (64bit) with psycopy2
>  web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
> 4, 51, 15), 'stable')
>  Python 2.7.2: C:\Python27\python.exe
>
>
>


[web2py] Re: dynamic SQLForm.factory from query

2012-01-18 Thread web-dev-m
Awesome.  So easy, I dont know why I didnt think of that.  Thank you.

On Jan 18, 1:57 am, Annet  wrote:
> Did you have a look at the wiki example in the web2py 
> book:http://www.web2py.com/books/default/chapter/29/3#A-wiki?
>
> Instead of a 'page' table you have the table from which you retrieve
> the list and, just like in the example, a table to store the comments.
> page_id in your case becomes list_id.
>
> I don't see why you need the fields and counter variable. I would move
> the for loop to the view and do something like:
>
> {{for row in rows:}}
>   
>     {{=row.field_name}}
>     {{=A('Add comment',_href=URL('addComment',args=row.id))}}
>   
> {{pass}}
>
> .. and in the addComment function something like:
>
> db.comment.list_id.default=request.args(0)
> form=crud.create(table=db.comment)
>
> I hope this helps you solve the problem.
>
> Kind regards,
>
> Annet


Re: [web2py] Re: There is no web2py homebrew for OS X

2012-01-18 Thread Christopher Steel
I though the pypi package was automated now?




[web2py] Postgres unknown reference field type

2012-01-18 Thread Simon Ashley
Moving from SQLite to Postgres and when running Database
Administration we're getting unknown field type errors when using a db
reference i.e. Field('Client', db.Client)
Any advice or work arounds?

TIA,

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
  File "C:/web2py/applications/OAS/models/oa.py", line 358, in

Field('Interpretation_Type', db.Interpretation_Type))
  File "C:\web2py\gluon\dal.py", line 5114, in define_table
polymodel=polymodel)
  File "C:\web2py\gluon\dal.py", line 624, in create_table
(field.type, field.name)
SyntaxError: Field: unknown field type: db.Client for Client

Code listing:
  precision, scale = map(int,field.type[8:-1].split(','))
ftype = self.types[field.type[:7]] % \
dict(precision=precision,scale=scale)
elif not field.type in self.types:
raise SyntaxError, 'Field: unknown field type: %s for
%s' % \
(field.type, field.name)

Model:
  db.define_table('Client',
  Field('Company', 'string'),
  Field('Address', 'string'),
  Field('Town', 'string'),
  Field('State', 'string'),
  Field('Zip', 'string'),
  Field('Activity', 'integer'),
  Field('Account', 'integer'),
  format='%(Company)s')

  db.define_table('Contact',
  Field('Client', db.Client),
  Field('Surname', 'string'),
  Field('First_Name', 'string'),
  Field('Position', 'string'),
  Field('Department', 'string'),
  Field('eMail', 'string'),
  Field('Mobile', 'string'),
  Field('Phone', 'string'),
  Field('Fax', 'string'),
  format='%(Surname)s - %(First_Name)s')

Environment:
  Windows 7 64bit
  Current Postgresql (64bit) with psycopy2
  web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
4, 51, 15), 'stable')
  Python 2.7.2: C:\Python27\python.exe




[web2py] Workflow engine for web2py

2012-01-18 Thread António Ramos
is it dificult to do something like this in web2py?

http://blog.aizatto.com/2009/12/07/ruby-on-rails-finite-state-machine-plugin-workflow/


[web2py] Re: PyCharm for web2py development -- interest in a third-party plugin?

2012-01-18 Thread mikech
I also wonder who could've set that bad tone, I haven't seen anything on 
the request list.

Re: SOLVED Re: [web2py] Re: matplotlib plugin

2012-01-18 Thread Massimo Di Pierro
Not sure I understand the question.

You need two functions. One returns the image. One returns the view
that embeds the image.

On Jan 18, 3:24 pm, andrej burja  wrote:
> thank you
>
> this is working example
>
> controller:
> import os, tempfile
> os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp()
> import cStringIO
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
> import numpy as np
>
> def draw():
>     x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
>     y = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84,
> 4.82, 5.68])
>     matplotlib.pyplot.clf()
>     plt.plot(x, y,'ro-')
>     plt.ylabel('label y')
>
>     body = cStringIO.StringIO()
>     plt.savefig(body)
>     return body.getvalue()
>
> def image():
>     return dict(a=IMG(_src=URL('draw'+'.png')))
>
> view:
> {{extend 'layout.html'}}
> This is the graf/image.html template
> {{=a}}
>
> just one question: how can i omit function slika? how can i include 'return
> dict(...' in funtion draw()?
>
> andrej


[web2py] Re: Alternative for GROUP BY in app-engine

2012-01-18 Thread howesc
the GAE pricing for data reads is pretty clear now, $0.70/ Million Ops, 
each row read counts as a read op, and the size of the row does not matter.


[web2py] Re: What is google app engine , and how to use it with web2py

2012-01-18 Thread howesc
Google App Engine is a cloud based computing environment.  it's best to get 
info about it from the source: http://code.google.com/appengine/  it has 
advantages and dis-advantages as do all environments.  the largest thing to 
consider is the google Big Table datastore as it compares to traditional 
SQL system.  there are other restrictions to make the cloud environment 
work.

see "Deploying on Google App Engine" here: 
http://web2py.com/books/default/chapter/29/13

good luck!

cfh


[web2py] Re: Web2py and Paypal

2012-01-18 Thread howesc
hmmm, i don't know about "best", but here is an integration i did a few 
years ago: http://www.web2pyslices.com/slices/take_slice/106  i'm not sure 
how paypal has changed since then, this may no longer be a good way to do 
the integrationbut feel free to evaluate and use if you desire.


[web2py] sqlhtml unicode error

2012-01-18 Thread Alan Etkin
I am trying to generate sqltables with the experimental IMAPAdapter
select output, but with some rows, an exception is raised at the
sqlhtml module. It has to do with unicode and charsets when sqlhtml
processes the rows object returned by the adapter's select method, but
I cannot find a proper way of solving it. Here is the error trace:

Traceback (most recent call last):
  File "/home/alan/web2py-hg/gluon/restricted.py", line 204, in
restricted
exec ccode in environment
  File "/home/alan/web2py-hg/applications/queries/views/default/
index.html", line 126, in 
  File "/home/alan/web2py-hg/gluon/globals.py", line 181, in write
self.body.write(xmlescape(data))
  File "/home/alan/web2py-hg/gluon/html.py", line 114, in xmlescape
return data.xml()
  File "/home/alan/web2py-hg/gluon/dal.py", line 7442, in xml
return sqlhtml.SQLTABLE(self).xml()
  File "/home/alan/web2py-hg/gluon/sqlhtml.py", line 2197, in __init__
ur = unicode(r, 'utf8')
  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position
1227-1229: invalid data

I found a workaround to avoid the exception but I doubt it's the
correct fix, because it just prevents web2py to create the unicode
object and use the raw input instead.

This is the workaround: (gluon/sqlhtml.py Line 2196)

try:
ur = unicode(r, 'utf-8')
except UnicodeDecodeError, e:
ur = r

Replacing this line:
ur = unicode(r, 'utf8')

When creating the Row objects at the adapter, I have to handle
different encodings depending on the message. What would be an
appropiate way of encoding data before creating the Row objects, so
unicode errors can be avoided?

This is the adapter method i am using to store the parse input for
each text field

def encode_text(self, text, charset, errors="replace"):
""" convert text for mail to unicode"""
if text is None:
text = ""
else:
if charset is not None:
text = unicode(text, charset, errors)
else:
text = unicode(text, "utf-8", errors)
return text

Thanks

I am using the last source hg version (1.99.4) with Python 2.6.5 on a
Mandriva GNU/Linux machine.


[web2py] Re: session.token does not get picked up by default value for database entry

2012-01-18 Thread Anthony
At the time you assign the default value, session.table_token is None, so 
that is the default value. Instead, you can either assign the default value 
after you create the session.table_token, or use a lambda:

db._common_fields.append(Field('request_tenant', default=lambda: 
session.table_token))

Anthony

On Wednesday, January 18, 2012 3:17:55 PM UTC-5, tsvim wrote:
>
> Hi all,
>
> I get the following weird behavior. I defined a common_fields, being 
> request_tenant as such:
>
>
> db._common_fields.append(Field('request_tenant',default=session.table_token,writable=False))
>
> session.table_token is a uuid generated by  the controller.
> There I have the following code:
>
> session.table_token = generate_table_token()
>
> if db(db.table).isempty():
>field_name = 'MyField'
>db.table.insert(name=field_name)
>populate(db.table2,100)
>
> But for some reason it won't take the default value for request_tenant the 
> first time. When I reload the page it creates new entriees with the session 
> variable correct this time.
>
> I suppose session.table_token does not get evaluated when I first generate 
> it, so how can I get the requested behavior? (Both with populate and insert)
>
> Thanks a million for your help,
>
> Tsvi
>


SOLVED Re: [web2py] Re: matplotlib plugin

2012-01-18 Thread andrej burja
thank you

this is working example

controller:
import os, tempfile
os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp()
import cStringIO
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np

def draw():
x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5])
y = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 
4.82, 5.68])
matplotlib.pyplot.clf()
plt.plot(x, y,'ro-')
plt.ylabel('label y')

body = cStringIO.StringIO()
plt.savefig(body) 
return body.getvalue()

def image():
return dict(a=IMG(_src=URL('draw'+'.png')))

view:
{{extend 'layout.html'}}
This is the graf/image.html template
{{=a}}

just one question: how can i omit function slika? how can i include 'return 
dict(...' in funtion draw()?

andrej


[web2py] Re: Working XMLRPC code failing on new web2py version ?...

2012-01-18 Thread fpp

On 18 jan, 18:46, Martin Weissenboeck  wrote:
> Hi, I am interested to run web2py on an android tablet pc. Please could you
> describe what you have done?

I think I should, yes :-)

As often, it is not difficult, but not trivial either because Android
is strange, with plenty of small pitfalls, not much documentation,
etc.

Mostly I cobbled together a lot of hints and fixes I found in blogs or
forums all over the place, until it worked :-)

This would be the right place to sum it up, to help other people
getting started, and for others to add what I missed.

I will do it in a separate thread, as it may need several posts, and
to make it easier to find later.

It will take some time to sum up the bits and pieces (I didn't take
notes, as usual :-), but I'll post a basic Howto later this week...

fp


[web2py] Re: Working XMLRPC code failing on new web2py version ?...

2012-01-18 Thread fpp
Massimo, thanks a lot for taking the time to look into this !

So :

1) as usual, you are right :-)

2) your "quick fix" doesn't work, maybe because my column type is
datetime.date, not datetime.datetime ?

3) it doesn't matter for now, because I added a three-line hack
instead to replace the datetime.date objects with strings before
uploading, so everything works again :-)

4) I understand that using an "internal object" is bad practice and
leads to this sort of breakage.
What should I use instead in this case, to avoid this in the
future ?...

Many thanks,
fp

PS: having web2py in my pocket never ceases to amaze me... Sharp
Zaurus, then Nokia N810 and N900, now an Android phone... it just
works :-)


On 18 jan, 15:55, Massimo Di Pierro 
wrote:
> Got it. The problem is that you are using an internal object here
> (rows.response)
>
>     status, response.flash = client.accept(rows.colnames,
> rows.response)
>
> and something has changed in there. Notice the error is not in the
> server but in the client. rows is a Rows object generated by
> db().select().
> Somehow before, it was returning strings for dates. Now it is
> returning datetime.date objects from data and the ServerProxy client
> does not know how to serialize that. when sending the request to the
> server.
>
> Try replace
>
>     client = xmlrpclib.ServerProxy(target+'/current/
> handle',allow_none=True)
>
> with
>
>     client = xmlrpclib.ServerProxy(target+'/current/
> handle',allow_none=True,use_datetime=True)
>


Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-18 Thread monotasker
Well, I'd really like to use pydev, but I just find that it's too resource 
intensive. I do a lot of work on a souped up netbook and eclipse *really* 
churns. PyCharm is a Java application too, but it positively sings beside 
eclipse. I'm generally really committed to open source (I eat sleep and 
breathe Ubuntu) but in this case I've had to compromise because of my needs.


Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-18 Thread monotasker
Sorry for the delayed response. I'm going to have to ask them about docs. I 
haven't found them in the obvious places.


[web2py] session.token does not get picked up by default value for database entry

2012-01-18 Thread tsvim
Hi all,

I get the following weird behavior. I defined a common_fields, being 
request_tenant as such:

db._common_fields.append(Field('request_tenant',default=session.table_token,writable=False))

session.table_token is a uuid generated by  the controller.
There I have the following code:

session.table_token = generate_table_token()

if db(db.table).isempty():
   field_name = 'MyField'
   db.table.insert(name=field_name)
   populate(db.table2,100)

But for some reason it won't take the default value for request_tenant the 
first time. When I reload the page it creates new entriees with the session 
variable correct this time.

I suppose session.table_token does not get evaluated when I first generate 
it, so how can I get the requested behavior? (Both with populate and insert)

Thanks a million for your help,

Tsvi


Re: [web2py] TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Marin Pranjić
I tried to create an event (just for testing) and got an error when tried
to submit.
Actually, I was redirected to http://tymr.com/event/draft/697 which is
e404-not found


Marin


Re: [web2py] Re: SQLFORM.smartgrid query/search don't work for related tables

2012-01-18 Thread Adi
Hi Jim,
Did you get this working, since I too don't see the referenced field in a 
query? 

Thanks,
Adnan


[web2py] Re: Inherit type from parent

2012-01-18 Thread Massimo Di Pierro
Nice. Thank you. Will commit it tonight.

On Jan 18, 1:41 pm, Tsvi Mostovicz  wrote:
> Massimo,
>
> I submitted issue 625 with a patch to populate.py which allows it to take
> the compute field into consideration when populating the database.
>
> Thanks,
>
> Tsvi Mostovicz
> ttm...@gmail.comwww.linkedin.com/in/tsvim
>
>
>
>
>
>
>
> On Mon, Jan 16, 2012 at 22:45, Anthony  wrote:
> > No, I don't think populate looks at the compute attribute -- it just looks
> > at the field type and generates an appropriate value.
>
> > On Monday, January 16, 2012 3:21:16 PM UTC-5, tsvim wrote:
>
> >> Could be it works, but for populate it doesn't. I was hoping to generate
> >> a rule that would force populate to behave correctly.
> >> For the user I can obviously deal with it in AJAX. Is it possible that
> >> populate disregards the compute field?
>
> >> Tsvi Mostovicz
> >> ttm...@gmail.com
> >>www.linkedin.com/in/tsvim
>
> >> On Mon, Jan 16, 2012 at 08:35, Anthony  wrote:
>
> >>> db.define_table('accounts',
>                  Field('name','string'),
>                  Field('parent_account','**refere**nce accounts'),
>                  Field('account_type','string'))
>
>  What I'm trying to achieve is to create a tree-like structure. So we
>  have 5 "root" accounts, which can each hold some sub-accounts etc.
>  Now the account_type must be the same for all the children of a certain
>  account. So the root accounts pre-determine all of the children's account
>  type, rendering it unwritable for a child account.
>  For some reason the following didn't work for me:
>
>  account_types = ['a','b','c']
>  db.accounts.account_type.**requi**res  = IS_IN_SET(account_types)
>  db.accounts.account_type.**requi**red  = True
>  db.accounts.account_type.**compu**te = lambda x:
>  x['parent_account'].account_**ty**pe
>  db.accounts.account_type.**write**able = lambda x:
>  (x['parent_account'] == 0)
>
> >>> For the "compute" attribute, maybe:
>
> >>> db.accounts.account_type.**compute = lambda r:
> >>> db.accounts[r.parent_account].**account_type if r.parent_account else
> >>> None
>
> >>> However, I don't think you can set the "writeable" attribute this way
> >>> because you won't know if a parent account is going to be specified until
> >>> after the new record is submitted, which happens after you have to decide
> >>> whether to make the account_type field writeable. Instead you might need
> >>> some client side JS and Ajax to dynamically set the account_type if the
> >>> user selects a parent_account in the form.
>
> >>> Anthony


[web2py] Re: Request to tag releases on github repo

2012-01-18 Thread Massimo Di Pierro
I will study this...

On Jan 18, 12:26 pm, Alvaro Lizama Molina  wrote:
> Master branch must be de stable release and de devel branch for the trunk :)
>
> We should implement this workflow is a easy way to work with git
>
>  http://nvie.com/posts/a-successful-git-branching-model/
>
> 2012/1/18 Massimo Di Pierro 
>
> > Will do.
>
> > On Jan 18, 10:17 am, Praneeth  wrote:
> > > Hello Massimo,
>
> > > It would be great if you could tag a release while committing to github.
> > > It will enable us to fetch the latest stable release from github easily
> > > - Instead of looking at the VERSION file and backtracking the commit no
> > > to checkout to.
>
> > > Thanks,
> > > Praneeth
>
> --
> Alvaro Lizama Molina  -http://alvarolizama.net


Re: [web2py] Re: Inherit type from parent

2012-01-18 Thread Tsvi Mostovicz
Massimo,

I submitted issue 625 with a patch to populate.py which allows it to take
the compute field into consideration when populating the database.

Thanks,


Tsvi Mostovicz
ttm...@gmail.com
www.linkedin.com/in/tsvim



On Mon, Jan 16, 2012 at 22:45, Anthony  wrote:

> No, I don't think populate looks at the compute attribute -- it just looks
> at the field type and generates an appropriate value.
>
>
> On Monday, January 16, 2012 3:21:16 PM UTC-5, tsvim wrote:
>
>> Could be it works, but for populate it doesn't. I was hoping to generate
>> a rule that would force populate to behave correctly.
>> For the user I can obviously deal with it in AJAX. Is it possible that
>> populate disregards the compute field?
>>
>> Tsvi Mostovicz
>> ttm...@gmail.com
>> www.linkedin.com/in/tsvim
>>
>>
>>
>> On Mon, Jan 16, 2012 at 08:35, Anthony  wrote:
>>
>>> db.define_table('accounts',
 Field('name','string'),
 Field('parent_account','**refere**nce accounts'),
 Field('account_type','string'))

 What I'm trying to achieve is to create a tree-like structure. So we
 have 5 "root" accounts, which can each hold some sub-accounts etc.
 Now the account_type must be the same for all the children of a certain
 account. So the root accounts pre-determine all of the children's account
 type, rendering it unwritable for a child account.
 For some reason the following didn't work for me:

 account_types = ['a','b','c']
 db.accounts.account_type.**requi**res  = IS_IN_SET(account_types)
 db.accounts.account_type.**requi**red  = True
 db.accounts.account_type.**compu**te = lambda x:
 x['parent_account'].account_**ty**pe
 db.accounts.account_type.**write**able = lambda x:
 (x['parent_account'] == 0)

>>>
>>> For the "compute" attribute, maybe:
>>>
>>> db.accounts.account_type.**compute = lambda r:
>>> db.accounts[r.parent_account].**account_type if r.parent_account else
>>> None
>>>
>>> However, I don't think you can set the "writeable" attribute this way
>>> because you won't know if a parent account is going to be specified until
>>> after the new record is submitted, which happens after you have to decide
>>> whether to make the account_type field writeable. Instead you might need
>>> some client side JS and Ajax to dynamically set the account_type if the
>>> user selects a parent_account in the form.
>>>
>>> Anthony
>>>
>>>
>>


Re: [web2py] TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Ovidio Marinho
 I felt a little heavy, you can say something?



   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil

Apóio



2012/1/18 Francisco Costa 

> Hi,
>
> TYMR is a social network (developed in web2py) for creating, managing
> & promote any type of events.
>
> This all-in-one solution is private at the moment, but the web2py
> community can be a part of this exclusive network by registering here:
> http://tymr.com/register/web2py
>
> Any feedback is truly appreciated.
>
> Francisco
>


Re: [web2py] Re: TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Ovidio Marinho
Very Good, the code be available?



   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil

Apóio



2012/1/18 Javier Quarite 

> The inside looks amazing!
>
> I'll try it later today, thanks!
>
> Javier Q
>


[web2py] Web2py and Paypal

2012-01-18 Thread Web2Py Freak
Dear All ,

What is the best way to integrate Paypal with web2py ?


Re: [web2py] Re: TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Javier Quarite
The inside looks amazing!

I'll try it later today, thanks!

Javier Q


[web2py] Re: TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Ross Peoples
Looks very cool!

[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
Put the jquery stuff in a file and include it in any view where you
want to call the dialog function.

The document.write just adds a container for the dialog box. You could
just as easily put the html in the page directly but I put it here so
that it is all together in one js file which can be included anywhere.

Yes you just do _onclick="javascript:dialog({{=_link}})

Not sure how you would get it to work with auth.requires_login(). If
you are on a completely different website then there is no way of
showing a dialog with the original page underneath. So you would
probably need to replace the login view with another view that then
calls dialog(url).

web2py_ajax_page is a function in web2py.js. I don't think it is
documented but you can read the code to see what it is doing. It is
quite short.

I am not sure about the open and close so you will need to experiment.
I think the open will be just before the return at the end of user.
The close may not be necessary as the dialog will close anyway if you
navigate to another page.


On Jan 18, 5:28 pm, Annet  wrote:
> Hi,
>
> Thanks for your reply, I am not sure I completely understand your
> solution.
>
> In which file(s) do I put the following lines of code:
>
> > // create dialogbox
> > document.write("")
> > $(document).ready(function(){
> >         $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> > 'auto'});
>
> > })
>
> > // open url in dialog box
> > function dialog(url) {
> >         web2py_ajax_page("get", url, null , 'dialogdiv')}
>
> Does document.write(...) replace this part of your previous reply:
>
> 
>
> why document.write()? does it create sort of a container for the
> entire default/user.html view?
>
> > ... and then you can just replace any url with
> > dialog(url) and it will show up  in a dialog.
>
> You mean replace this: href="{{=_link}}" in the auth_menu rendering
> with something like:
>
> _onclick="javascript:dialog({{=_link}})
>
> What about web2py's internal behaviour of opening the login function
> whenever a function is decorated @auth.requires_login()
>
> I searched the book for web2py_ajax_page but could find anything,
> where is this functionality documented?
>
> Kind regards,
>
> Annet.


Re: [web2py] Re: grid doesn't like requires?

2012-01-18 Thread Martin Weissenboeck
Thank you very much - that is the solution! I have spent some hours...
Therefore I think, this is a very important hint - is it in the book?

2012/1/18 Massimo Di Pierro 

> A field has two attributes, requires and represent. If web2py finds a
> 'reference auth_user" but no requires, it assumes
>
> db.report.person.requires=IS_IN_DB(db, db.auth_user.id,
> db.auth_user._format)
> db.report.person.represent = lambda id: db.auth_user._format %
> db.auth_user[id]
>
> If you give a custom requires, you also need a custom represent or you
> do not get one.
>
> In your case it would be easier to do:
>
> db.auth_user._format = '%(last_name)s'
>
> and use the default ones.
>

Ok, I will try this too. But my example is very simplified, the real
application needs a little bit more code.

>
> On Jan 18, 9:05 am, Martin Weissenboeck  wrote:
> > Hi,
> >
> > that's my model
> >
> > db.define_table('report',
> >Field('person', 'reference auth_user',
> >  #requires=IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ),  #
>  <--
> > look here
> >),
> >Field('text'),)
> >
> > and that's a function:
> >
> > def report():
> > grid =  SQLFORM.smartgrid(db.auth_user,
> > linked_tables=['report'],
> > user_signature = False)
> > return locals()
> >
> > No problems with a comment in line 3.
> > After removing the '#' and activating line 3 my grid doesn't show the
> name
> > of the person but only the record number (the id).
> >
> > Why?
> >
> > I have tried:
> >
> > IS_IN_DB(db, db.auth_user.id, "%(last_name)s" )
> > IS_IN_DB(db, db.auth_user, "%(last_name)s" )
> > IS_IN_DB(db, 'auth_user.id', "%(last_name)s" )
> > IS_IN_DB(db, db.auth_user)
> >
> > Regards, Martin
>


[web2py] TYMR - web2py social network - Invitations for this community

2012-01-18 Thread Francisco Costa
Hi,

TYMR is a social network (developed in web2py) for creating, managing
& promote any type of events.

This all-in-one solution is private at the moment, but the web2py
community can be a part of this exclusive network by registering here:
http://tymr.com/register/web2py

Any feedback is truly appreciated.

Francisco


Re: [web2py] Re: Request to tag releases on github repo

2012-01-18 Thread Alvaro Lizama Molina
Master branch must be de stable release and de devel branch for the trunk :)

We should implement this workflow is a easy way to work with git

 http://nvie.com/posts/a-successful-git-branching-model/

2012/1/18 Massimo Di Pierro 

> Will do.
>
> On Jan 18, 10:17 am, Praneeth  wrote:
> > Hello Massimo,
> >
> > It would be great if you could tag a release while committing to github.
> > It will enable us to fetch the latest stable release from github easily
> > - Instead of looking at the VERSION file and backtracking the commit no
> > to checkout to.
> >
> > Thanks,
> > Praneeth
>



-- 
Alvaro Lizama Molina  - http://alvarolizama.net


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread Annet

> I forgot you also need to include in your controller instructions to
> open and close the dialog e.g.


How would I include that in the user function:

def user():
form=auth()
if isinstance(form,FORM):
if 'auth' in globals():
if not auth.is_logged_in():
form[0][-1]
[1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location='%s';"%URL('admin','index')))
else:
form[0][-1]
[1].append(INPUT(_type="button",_value="Cancel",_onclick="window.location='%s';"%URL('admin','admin')))
if request.args(0)=='login':
form.element(_type='submit')['_value']='Login'
if request.args(0)=='not_authorized':
auth.messages.logged_out='Insufficient privileges, you are
logged out'
redirect(URL('user',args='logout'))
return dict(form=form)


Kind regards,

Annet.



> if form.process(.
>     response.js="$('#dialogdiv').dialog('close');"
>     elif form.errors:
>         pass
>     else:
>         response.js="$('#dialogdiv').dialog('open').focus();"
>
> On Jan 18, 1:44 pm, apple  wrote:
>
>
>
>
>
>
>
> > Ah you want the whole URL to be in a dialog. I spent ages figuring
> > this out and the answer is already included in web2py!! You just
> > include the code below and then you can just replace any url with
> > dialog(url) and it will show up  in a dialog. Brilliant!!
>
> > // create dialogbox
> > document.write("")
> > $(document).ready(function(){
> >         $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> > 'auto'});
>
> > })
>
> > // open url in dialog box
> > function dialog(url) {
> >         web2py_ajax_page("get", url, null , 'dialogdiv')}
>
> > 
> > you can get rid of the dialog bar in css:
>
> > .ui-dialog-titlebar { display:none; }
> > 
>
> > I don't know why you have scroll bars in your dialog because I don't.
>
> > On Jan 18, 8:44 am, Annet  wrote:
>
> > > Does the first problem has anything to do with auth_menu:
>
> > > in menu.py:
>
> > > if 'auth' in globals():
> > >     if not auth.is_logged_in():
> > >         response.auth_menu = [
> > >             ['Login',request.function=='user' and
> > > request.args(0)=='login',URL('default','user/login')],
> > >             ['Gebruikersnaam opvragen',request.function=='user' and
> > > request.args(0)=='retrieve_username',URL('default','user/
> > > retrieve_username')],
> > >             ['Wachtwoord opvragen',request.function=='user'and
> > > request.args(0)=='request_reset_password',URL('default','user/
> > > request_reset_password')]]
> > >     else:
> > >         response.auth_menu = [
> > >             ['Logout',request.function=='user'and
> > > request.args(0)=='logout',URL('default','user/logout')],
> > >             ['Profiel wijzigen',request.function=='user' and
> > > request.args(0)=='profile',URL('default','user/profile')],
> > >             ['Wachtwoord wijzigen',request.function=='user' and
> > > request.args(0)=='change_password',URL('default','user/
> > > change_password')]]
>
> > > in admin/index.html:
>
> > > 
> > >   {{if response.auth_menu:}}
> > >     
> > >       {{for _name,_active,_link in response.auth_menu:}}
> > >          > > style="padding-right: 6px;">{{=_name}}
> > >       {{pass}}
> > >     
> > >   {{pass}}
> > >  
>
> > > Annet.


Re: [web2py] Working XMLRPC code failing on new web2py version ?...

2012-01-18 Thread Martin Weissenboeck
Hi, I am interested to run web2py on an android tablet pc. Please could you
describe what you have done?

Thx, Martin
Am 17.01.2012 20:49 schrieb "fpp" :

> Hi,
>
> I have this very old web2py app that has been working 24/7 since early
> 2008...
>
> One instance runs on my phone (Nokia N900, a Linux device), another on
> my home server (also Linux).
>
> The mobile instance frequently "pushes" database records to the server
> instance, using XMLRPC, by calling the relevant method on the remote,
> something like :
>
>client = xmlrpclib.ServerProxy(target+'/current/handle',
> allow_none=True)
>rows = db(db.current.id>0).select()
>status, response.flash = client.accept(rows.colnames,
> rows.response)
>
> This has been running flawlessly for four years, although both ends
> have sometimes been upgraded :
>
> * the mobile instance runs a semi-recent version of web2py (1.94.5) on
> an old version of Python (2.5.4)
> * the server instance does the opposite (Python 2.7  and web2py
> 1.56.1 !)
> * so this is a fairly change-resistant combination so far...
>
> However, today I tried the latest web2py (1.99.4), because I wanted to
> host the mobile instance on an Android phone. After fighting my way
> through Android and SL4A to the underlying Linux core, I got it to run
> nicely, except for that "push" code above, which fails on the third
> line with :
>
>  TypeError: cannot marshal  objects
>
> Now, obviously, one of the columns in rows.response contains a
> datetime.date value. But why is this suddenly a problem ? I moved the
> whole thing to a Windows box (with Python 2.6.5) and got the same
> result.
>
> Could this be caused by the newer version of web2py ? Where to start
> looking ?
>
> Thanks for any ideas,
> fp
>


[web2py] Problem with DB2 and text field type when accessing db2 using ODBC ...

2012-01-18 Thread David Marko
I'm trying to make alive the existing application with DB2 database 
(currently running with PostgreSQL 9.x with no problem). I'm using latest 
DB2 Express version and I just find out, that all fields defined in DAL as 
'text' are created in DB2 as 'CLOB' datatype. Table is created succesfully 
but web2py(or rather pyodbc driver ???) cant access it back and I' getting 
this error message:
 ('ODBC data type -99 is not supported. Cannot read 
column VALUE.', 'HY000') 

Can anyone help with this? Is there someone using web2py with db2 
succesfully ? I know its probably  not the usual configuration.

David


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread Annet
Hi,

Thanks for your reply, I am not sure I completely understand your
solution.

In which file(s) do I put the following lines of code:

> // create dialogbox
> document.write("")
> $(document).ready(function(){
>         $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> 'auto'});
>
> })
>
> // open url in dialog box
> function dialog(url) {
>         web2py_ajax_page("get", url, null , 'dialogdiv')}


Does document.write(...) replace this part of your previous reply:



why document.write()? does it create sort of a container for the
entire default/user.html view?


> ... and then you can just replace any url with
> dialog(url) and it will show up  in a dialog.

You mean replace this: href="{{=_link}}" in the auth_menu rendering
with something like:

_onclick="javascript:dialog({{=_link}})


What about web2py's internal behaviour of opening the login function
whenever a function is decorated @auth.requires_login()

I searched the book for web2py_ajax_page but could find anything,
where is this functionality documented?


Kind regards,

Annet.


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
I forgot you also need to include in your controller instructions to
open and close the dialog e.g.

if form.process(.
response.js="$('#dialogdiv').dialog('close');"
elif form.errors:
pass
else:
response.js="$('#dialogdiv').dialog('open').focus();"

On Jan 18, 1:44 pm, apple  wrote:
> Ah you want the whole URL to be in a dialog. I spent ages figuring
> this out and the answer is already included in web2py!! You just
> include the code below and then you can just replace any url with
> dialog(url) and it will show up  in a dialog. Brilliant!!
>
> // create dialogbox
> document.write("")
> $(document).ready(function(){
>         $('#dialogdiv').dialog({autoOpen : false, modal : false, width :
> 'auto'});
>
> })
>
> // open url in dialog box
> function dialog(url) {
>         web2py_ajax_page("get", url, null , 'dialogdiv')}
>
> 
> you can get rid of the dialog bar in css:
>
> .ui-dialog-titlebar { display:none; }
> 
>
> I don't know why you have scroll bars in your dialog because I don't.
>
> On Jan 18, 8:44 am, Annet  wrote:
>
>
>
>
>
>
>
> > Does the first problem has anything to do with auth_menu:
>
> > in menu.py:
>
> > if 'auth' in globals():
> >     if not auth.is_logged_in():
> >         response.auth_menu = [
> >             ['Login',request.function=='user' and
> > request.args(0)=='login',URL('default','user/login')],
> >             ['Gebruikersnaam opvragen',request.function=='user' and
> > request.args(0)=='retrieve_username',URL('default','user/
> > retrieve_username')],
> >             ['Wachtwoord opvragen',request.function=='user'and
> > request.args(0)=='request_reset_password',URL('default','user/
> > request_reset_password')]]
> >     else:
> >         response.auth_menu = [
> >             ['Logout',request.function=='user'and
> > request.args(0)=='logout',URL('default','user/logout')],
> >             ['Profiel wijzigen',request.function=='user' and
> > request.args(0)=='profile',URL('default','user/profile')],
> >             ['Wachtwoord wijzigen',request.function=='user' and
> > request.args(0)=='change_password',URL('default','user/
> > change_password')]]
>
> > in admin/index.html:
>
> > 
> >   {{if response.auth_menu:}}
> >     
> >       {{for _name,_active,_link in response.auth_menu:}}
> >          > style="padding-right: 6px;">{{=_name}}
> >       {{pass}}
> >     
> >   {{pass}}
> >  
>
> > Annet.


[web2py] Re: UnicodeEncodeError on GAE

2012-01-18 Thread Massimo Di Pierro
What line?

On Jan 17, 10:16 pm, ttsujie  wrote:
> First I don't know that it's need to update default version setting
> after update version at app.yaml.
> After update default version, that go good.
> I'm sorry for lack of my GAE knowlege.
> (I'm ashamed..)
>
> Anyway if someone encounter the same problem, this thread is useful.
> (I'm not sure this is the best way or not. But it's good in my case.)
>
> gluon/html.py modified.
>          else:
> -            _value = str(self['_value'])
> +            if isinstance(self['_value'],unicode):
> +                _value = self['_value'].encode('utf-8')
> +            else:
> +                _value = str(self['_value'])
>          if t == 'checkbox' and not '_checked' in self.attributes:
>
> On 1月18日, 午前9:26, ttsujie  wrote:
>
>
>
>
>
>
>
> > Thank you for replay.
>
> > I tried, but the same error message.
> > (app_devserver NG, GAE NG)
>
> > I think it's strange that error message is "UnicodeEncodeError", is
> > not "UnicodeDecodeError"...
>
> > On 1月18日, 午前7:44, howesc  wrote:
>
> > > try decode instead of encode (the string is encoded in utf-8 and you are
> > > trying to decode):
>
> > > mystr.decode("utf-8")
>
> > > it was a different but similar problem that i had on GAE that i solved 
> > > this
> > > way.
>
> > > good luck!
>
> > > cfh


[web2py] Re: Request to tag releases on github repo

2012-01-18 Thread Massimo Di Pierro
Will do.

On Jan 18, 10:17 am, Praneeth  wrote:
> Hello Massimo,
>
> It would be great if you could tag a release while committing to github.
> It will enable us to fetch the latest stable release from github easily
> - Instead of looking at the VERSION file and backtracking the commit no
> to checkout to.
>
> Thanks,
> Praneeth


[web2py] Re: Too many redirects when trying to use interactive demo

2012-01-18 Thread Massimo Di Pierro
Any chance you can open the browser, clear cache. list the steps you
take until you encounter the problem.
This is clearly something subtle and fixing is very valuable to us.
Other apps may have this problem and we do not know.
Thanks for your help on this.

Massimo

On Jan 18, 4:15 am, Michael Aye  wrote:
> Hi Massimo,
> here I am.
> I tried other browsers as well, so it seems to be more fundamental then my
> Mac.
> Asked a windows users as well, and he get's the same error. So it looks
> more and more likely (even so I don't understand this stuff) that something
> with our department's network setup is weird? I don't understand if that's
> even possible? How can I find out?
>
> Best regards,
> Michael


[web2py] Re: grid doesn't like requires?

2012-01-18 Thread Massimo Di Pierro
A field has two attributes, requires and represent. If web2py finds a
'reference auth_user" but no requires, it assumes

db.report.person.requires=IS_IN_DB(db, db.auth_user.id,
db.auth_user._format)
db.report.person.represent = lambda id: db.auth_user._format %
db.auth_user[id]

If you give a custom requires, you also need a custom represent or you
do not get one.

In your case it would be easier to do:

db.auth_user._format = '%(last_name)s'

and use the default ones.

On Jan 18, 9:05 am, Martin Weissenboeck  wrote:
> Hi,
>
> that's my model
>
> db.define_table('report',
>    Field('person', 'reference auth_user',
>      #requires=IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ),  #  <--
> look here
>    ),
>    Field('text'),)
>
> and that's a function:
>
> def report():
>     grid =  SQLFORM.smartgrid(db.auth_user,
>         linked_tables=['report'],
>         user_signature = False)
>     return locals()
>
> No problems with a comment in line 3.
> After removing the '#' and activating line 3 my grid doesn't show the name
> of the person but only the record number (the id).
>
> Why?
>
> I have tried:
>
> IS_IN_DB(db, db.auth_user.id, "%(last_name)s" )
> IS_IN_DB(db, db.auth_user, "%(last_name)s" )
> IS_IN_DB(db, 'auth_user.id', "%(last_name)s" )
> IS_IN_DB(db, db.auth_user)
>
> Regards, Martin


[web2py] Request to tag releases on github repo

2012-01-18 Thread Praneeth

Hello Massimo,

It would be great if you could tag a release while committing to github. 
It will enable us to fetch the latest stable release from github easily 
- Instead of looking at the VERSION file and backtracking the commit no 
to checkout to.


Thanks,
Praneeth


Re: [web2py] Re: Too many redirects when trying to use interactive demo

2012-01-18 Thread Marin Pranjić
firefox on ubuntu

no problems

On Wed, Jan 18, 2012 at 4:53 PM, Anthony  wrote:

> I'm not experiencing any redirects (Windows IE and Chrome).
>
> Anthony
>
>
> On Wednesday, January 18, 2012 9:42:59 AM UTC-5, Massimo Di Pierro wrote:
>
>> Thank you Michael,
>>
>> I will play some more with it today. I may come back with some
>> questions...
>>
>> I anybody else having problems with redirects in
>> http://web2py.com/demo_admin
>> ?
>> Please me know it would help isolate the problem. I suspect it is a
>> session issue since I fiddle with admin authentication to make the
>> demo admin work.
>>
>> massimo
>>
>>
>>
>> On Jan 18, 4:15 am, Michael Aye  wrote:
>> > Hi Massimo,
>> > here I am.
>> > I tried other browsers as well, so it seems to be more fundamental then
>> my
>> > Mac.
>> > Asked a windows users as well, and he get's the same error. So it looks
>> > more and more likely (even so I don't understand this stuff) that
>> something
>> > with our department's network setup is weird? I don't understand if
>> that's
>> > even possible? How can I find out?
>> >
>> > Best regards,
>> > Michael
>>
>


[web2py] Re: Too many redirects when trying to use interactive demo

2012-01-18 Thread Anthony
I'm not experiencing any redirects (Windows IE and Chrome).

Anthony

On Wednesday, January 18, 2012 9:42:59 AM UTC-5, Massimo Di Pierro wrote:
>
> Thank you Michael, 
>
> I will play some more with it today. I may come back with some 
> questions... 
>
> I anybody else having problems with redirects in 
> http://web2py.com/demo_admin 
> ? 
> Please me know it would help isolate the problem. I suspect it is a 
> session issue since I fiddle with admin authentication to make the 
> demo admin work. 
>
> massimo 
>
>
>
> On Jan 18, 4:15 am, Michael Aye  wrote: 
> > Hi Massimo, 
> > here I am. 
> > I tried other browsers as well, so it seems to be more fundamental then 
> my 
> > Mac. 
> > Asked a windows users as well, and he get's the same error. So it looks 
> > more and more likely (even so I don't understand this stuff) that 
> something 
> > with our department's network setup is weird? I don't understand if 
> that's 
> > even possible? How can I find out? 
> > 
> > Best regards, 
> > Michael



[web2py] Re: string not recognized

2012-01-18 Thread Anthony
You could also define the string in the controller and pass it to the view:

def action():
return dict(mystring=PRE('{{this is a string}}'))

View:
{{=mystring}}

Or if you need to do this frequently in views, you could define a special 
helper:

class BRACE(DIV):
def xml(self):
return '{{' + self._xml()[1] + '}}'

{{=BRACE('this is a string'}}

will output:

{{this is a string}}

Anthony

On Wednesday, January 18, 2012 9:46:33 AM UTC-5, Massimo Di Pierro wrote:
>
> Because the {{ }} operator have precedence over everything else. 
> when web2py finds 
>
> {{=PRE("{{this is a string}}"))} 
>
> interprets it as 
>
> OPEN{{  =PRE("{{this is a stringCLOSE}}"))} 
>
> when you want to put < and > in HTML you have to escape them with < 
> and > 
>
> similarly if you want to put {{ and }} inside web2py views you have to 
> escape them. In your case the simples solution is: 
>
> {{=PRE("{"+"{this is a string}"+}"))} 
>
>
>
>
> On Jan 18, 7:59 am, davidjensen  wrote: 
> > It bombs on PRE, CODE, and now XML 
> > 
> > On Jan 18, 3:13 am, nils  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Hi, 
> > > Could you not use {{=XML(string...)}} 
> > > Regards, 
> > > Nils 
> > > On Jan 18, 2012 9:43 a.m., "davidjensen"  
> wrote: 
> > 
> > > > This is not recognized asa string: 
> > > > "{{this is a string}}" in: 
> > > > {{=PRE("{{this is a string}}"))}in a web page 
> > > > but it works on the command line: 
> > > > >>PRE("{{this is a string}}").xml()



Re: [web2py] grid doesn't like requires?

2012-01-18 Thread Bruce Wade
Have you tried removing the last , after the IS_IN_DB()?

On Wed, Jan 18, 2012 at 7:05 AM, Martin Weissenboeck wrote:

> Hi,
>
> that's my model
>
> db.define_table('report',
>Field('person', 'reference auth_user',
>  #requires=IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ),  #
>  <-- look here
>),
>Field('text'),)
>
>
> and that's a function:
>
> def report():
> grid =  SQLFORM.smartgrid(db.auth_user,
> linked_tables=['report'],
> user_signature = False)
> return locals()
>
>
> No problems with a comment in line 3.
> After removing the '#' and activating line 3 my grid doesn't show the name
> of the person but only the record number (the id).
>
> Why?
>
> I have tried:
>
> IS_IN_DB(db, db.auth_user.id, "%(last_name)s" )
> IS_IN_DB(db, db.auth_user, "%(last_name)s" )
> IS_IN_DB(db, 'auth_user.id', "%(last_name)s" )
> IS_IN_DB(db, db.auth_user)
>
>
> Regards, Martin
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: There is no web2py homebrew for OS X

2012-01-18 Thread Alvaro Lizama Molina
Not change soo fast, de current version must be in pypi ande develop en
git, must be branches for github for devel and mater(current stable
version).

Only need little code organization

2012/1/17 pbreit 

> Web2py changes too fast to use anything but source, in my opinion.




-- 
Alvaro Lizama Molina  - http://alvarolizama.net


[web2py] grid doesn't like requires?

2012-01-18 Thread Martin Weissenboeck
Hi,

that's my model

db.define_table('report',
   Field('person', 'reference auth_user',
 #requires=IS_IN_DB(db, db.auth_user.id, "%(last_name)s" ),  #  <--
look here
   ),
   Field('text'),)


and that's a function:

def report():
grid =  SQLFORM.smartgrid(db.auth_user,
linked_tables=['report'],
user_signature = False)
return locals()


No problems with a comment in line 3.
After removing the '#' and activating line 3 my grid doesn't show the name
of the person but only the record number (the id).

Why?

I have tried:

IS_IN_DB(db, db.auth_user.id, "%(last_name)s" )
IS_IN_DB(db, db.auth_user, "%(last_name)s" )
IS_IN_DB(db, 'auth_user.id', "%(last_name)s" )
IS_IN_DB(db, db.auth_user)


Regards, Martin


Re: [web2py] What is google app engine , and how to use it with web2py

2012-01-18 Thread Javier Quarite
On Wed, Jan 18, 2012 at 9:42 AM, Web2Py Freak wrote:

> Dear All ,
>
> i am going to build a online music training center , so a lot have
> recommended me with the GAE , i dont know what is it and , i really
> dont know from where to start  , i need help guys because this is
> something so big for python and web2py and us the web2py developers
> so we can prove to others how strong web2py is .. and i want to use a
> lot of plugins and stuff that are tested  , so any ideas guys and i
> really dont understand what is gae , and why to use it ? so if anyone
> have an idea from where should i start ??
>

Once upon a time I uploaded a web2py project there :D
well as far as a I know is the place where you can put your application
(like a hosting).
You can use dotcloud if you need to deploy your application, also heroku
has python support (but I haven't tried with web2py. I use heroku for RoR
applications)

Hope it helps :)

Javier


[web2py] Re: Working XMLRPC code failing on new web2py version ?...

2012-01-18 Thread Massimo Di Pierro
Got it. The problem is that you are using an internal object here
(rows.response)

status, response.flash = client.accept(rows.colnames,
rows.response)

and something has changed in there. Notice the error is not in the
server but in the client. rows is a Rows object generated by
db().select().
Somehow before, it was returning strings for dates. Now it is
returning datetime.date objects from data and the ServerProxy client
does not know how to serialize that. when sending the request to the
server.

Try replace

client = xmlrpclib.ServerProxy(target+'/current/
handle',allow_none=True)

with

client = xmlrpclib.ServerProxy(target+'/current/
handle',allow_none=True,use_datetime=True)


On Jan 17, 1:49 pm, fpp  wrote:
> Hi,
>
> I have this very old web2py app that has been working 24/7 since early
> 2008...
>
> One instance runs on my phone (Nokia N900, a Linux device), another on
> my home server (also Linux).
>
> The mobile instance frequently "pushes" database records to the server
> instance, using XMLRPC, by calling the relevant method on the remote,
> something like :
>
>         client = xmlrpclib.ServerProxy(target+'/current/handle',
> allow_none=True)
>         rows = db(db.current.id>0).select()
>         status, response.flash = client.accept(rows.colnames,
> rows.response)
>
> This has been running flawlessly for four years, although both ends
> have sometimes been upgraded :
>
> * the mobile instance runs a semi-recent version of web2py (1.94.5) on
> an old version of Python (2.5.4)
> * the server instance does the opposite (Python 2.7  and web2py
> 1.56.1 !)
> * so this is a fairly change-resistant combination so far...
>
> However, today I tried the latest web2py (1.99.4), because I wanted to
> host the mobile instance on an Android phone. After fighting my way
> through Android and SL4A to the underlying Linux core, I got it to run
> nicely, except for that "push" code above, which fails on the third
> line with :
>
>   TypeError: cannot marshal  objects
>
> Now, obviously, one of the columns in rows.response contains a
> datetime.date value. But why is this suddenly a problem ? I moved the
> whole thing to a Windows box (with Python 2.6.5) and got the same
> result.
>
> Could this be caused by the newer version of web2py ? Where to start
> looking ?
>
> Thanks for any ideas,
> fp


[web2py] Re: string not recognized

2012-01-18 Thread Massimo Di Pierro
Because the {{ }} operator have precedence over everything else.
when web2py finds

{{=PRE("{{this is a string}}"))}

interprets it as

OPEN{{  =PRE("{{this is a stringCLOSE}}"))}

when you want to put < and > in HTML you have to escape them with <
and >

similarly if you want to put {{ and }} inside web2py views you have to
escape them. In your case the simples solution is:

{{=PRE("{"+"{this is a string}"+}"))}




On Jan 18, 7:59 am, davidjensen  wrote:
> It bombs on PRE, CODE, and now XML
>
> On Jan 18, 3:13 am, nils  wrote:
>
>
>
>
>
>
>
> > Hi,
> > Could you not use {{=XML(string...)}}
> > Regards,
> > Nils
> > On Jan 18, 2012 9:43 a.m., "davidjensen"  wrote:
>
> > > This is not recognized asa string:
> > > "{{this is a string}}"     in:
> > > {{=PRE("{{this is a string}}"))}    in a web page
> > > but it works on the command line:
> > > >>PRE("{{this is a string}}").xml()


[web2py] Re: Too many redirects when trying to use interactive demo

2012-01-18 Thread Massimo Di Pierro
Thank you Michael,

I will play some more with it today. I may come back with some
questions...

I anybody else having problems with redirects in http://web2py.com/demo_admin
?
Please me know it would help isolate the problem. I suspect it is a
session issue since I fiddle with admin authentication to make the
demo admin work.

massimo



On Jan 18, 4:15 am, Michael Aye  wrote:
> Hi Massimo,
> here I am.
> I tried other browsers as well, so it seems to be more fundamental then my
> Mac.
> Asked a windows users as well, and he get's the same error. So it looks
> more and more likely (even so I don't understand this stuff) that something
> with our department's network setup is weird? I don't understand if that's
> even possible? How can I find out?
>
> Best regards,
> Michael


[web2py] What is google app engine , and how to use it with web2py

2012-01-18 Thread Web2Py Freak
Dear All ,

i am going to build a online music training center , so a lot have
recommended me with the GAE , i dont know what is it and , i really
dont know from where to start  , i need help guys because this is
something so big for python and web2py and us the web2py developers
so we can prove to others how strong web2py is .. and i want to use a
lot of plugins and stuff that are tested  , so any ideas guys and i
really dont understand what is gae , and why to use it ? so if anyone
have an idea from where should i start ??


[web2py] Too many redirects when trying to use interactive demo

2012-01-18 Thread Michael Aye
Hi Massimo,
here I am.
I tried other browsers as well, so it seems to be more fundamental then my 
Mac.
Asked a windows users as well, and he get's the same error. So it looks 
more and more likely (even so I don't understand this stuff) that something 
with our department's network setup is weird? I don't understand if that's 
even possible? How can I find out?

Best regards,
Michael


[web2py] Re: Working XMLRPC code failing on new web2py version ?...

2012-01-18 Thread fpp
On 17 jan, 21:58, Massimo Di Pierro 
wrote:
> Please open a ticket. What's the latest version that worked? Can you
> show how you expose the service?

The last version I used is 1.94.5 from march/april last year.
Are older web2py archives available somewhere for testing ?...

Here is the code I'm using, it's pretty basic.
It all happens in one controller, which is the same on both
instances :

def upload():
""" Try to send all current records to a remote instance for
replication ; optionally archive them to local History """
response.view = "basic.html"
response.title = "Upload records "
if not response.flash : response.flash = "Uncheck the 'Move' box
while you're testing your upload parameters !"

response.local_styles = """
#target_id { width: 20em; }
"""

parms = db(db.params.id == 1).select()[0]
target = parms.remote_host if parms.remote_host else 'http://
localhost:8000/'+request.application
form = FORM(P("Upload all current records to remote instance
at:"),
   P(INPUT(_type="text", _name="target",
_id="target_id", _value=target, requires=IS_URL())),
   P(INPUT(_type="checkbox", _name="archive",
value=True, _id="cb"),
  LABEL(" Move uploaded records to the History
list", _for="cb")),
   P(INPUT(_type="submit",_value="Upload")))

if form.accepts(request.vars, session, keepvalues=True) :
import xmlrpclib
move = request.vars.archive
target = request.vars.target
client = xmlrpclib.ServerProxy(target+'/current/handle',
allow_none=True)
rows = db(db.current.id>0).select()
status, response.flash = client.accept(rows.colnames,
rows.response)
if status == 'OK' :
db(db.params.id == 1).select()
[0].update_record(remote_host=target)
if move and status == 'OK' :
for record in rows :
record.pop('update_record', None)
record.pop('delete_record', None)
id = record.pop('id', None)
db.history.insert(**record)
db(db.current.id>0).delete()
response.flash += " and moved to History"

return dict(form=form)

# xmlrpc handshake function
def handle(): return response.xmlrpc(request,[accept])

def accept(columns,rows):
""" Receive records from a remote instance and add them to the
local Current list """
j=len('current.')
if not session.accept_uploads :
return 'NOK', "The remote host is not accepting uploads at
this time"
try:
for row in rows:
items=dict([(columns[i][j:],row[i]) for i in
range(len(columns)) if columns[i][-3:]!='id'])
db.current.insert(**items)
return 'OK', "%d entries uploaded to remote host's Current
list" % len(rows)
except :
return 'NOK', "There was an error at the remote host during
the upload"


[web2py] Re: string not recognized

2012-01-18 Thread davidjensen
It bombs on PRE, CODE, and now XML

On Jan 18, 3:13 am, nils  wrote:
> Hi,
> Could you not use {{=XML(string...)}}
> Regards,
> Nils
> On Jan 18, 2012 9:43 a.m., "davidjensen"  wrote:
>
>
>
>
>
>
>
> > This is not recognized asa string:
> > "{{this is a string}}"     in:
> > {{=PRE("{{this is a string}}"))}    in a web page
> > but it works on the command line:
> > >>PRE("{{this is a string}}").xml()


[web2py] Re: Is this a bug? Restrictions in model file names

2012-01-18 Thread Ross Peoples
You will find that the underscore is required for a lot file names, not 
just models, as using a hypen in a variable name is invalid in Python. 
Modules are the same way. You can't do this:

import my-module

The Python syntax is invalid. The same is true for models. I believe it 
also applies to controllers and views.


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread apple
Ah you want the whole URL to be in a dialog. I spent ages figuring
this out and the answer is already included in web2py!! You just
include the code below and then you can just replace any url with
dialog(url) and it will show up  in a dialog. Brilliant!!

// create dialogbox
document.write("")
$(document).ready(function(){
$('#dialogdiv').dialog({autoOpen : false, modal : false, width :
'auto'});
})

// open url in dialog box
function dialog(url) {
web2py_ajax_page("get", url, null , 'dialogdiv')
}

you can get rid of the dialog bar in css:

.ui-dialog-titlebar { display:none; }


I don't know why you have scroll bars in your dialog because I don't.







On Jan 18, 8:44 am, Annet  wrote:
> Does the first problem has anything to do with auth_menu:
>
> in menu.py:
>
> if 'auth' in globals():
>     if not auth.is_logged_in():
>         response.auth_menu = [
>             ['Login',request.function=='user' and
> request.args(0)=='login',URL('default','user/login')],
>             ['Gebruikersnaam opvragen',request.function=='user' and
> request.args(0)=='retrieve_username',URL('default','user/
> retrieve_username')],
>             ['Wachtwoord opvragen',request.function=='user'and
> request.args(0)=='request_reset_password',URL('default','user/
> request_reset_password')]]
>     else:
>         response.auth_menu = [
>             ['Logout',request.function=='user'and
> request.args(0)=='logout',URL('default','user/logout')],
>             ['Profiel wijzigen',request.function=='user' and
> request.args(0)=='profile',URL('default','user/profile')],
>             ['Wachtwoord wijzigen',request.function=='user' and
> request.args(0)=='change_password',URL('default','user/
> change_password')]]
>
> in admin/index.html:
>
> 
>   {{if response.auth_menu:}}
>     
>       {{for _name,_active,_link in response.auth_menu:}}
>          style="padding-right: 6px;">{{=_name}}
>       {{pass}}
>     
>   {{pass}}
>  
>
> Annet.


[web2py] Problem with Rocket and --interfaces

2012-01-18 Thread Ross Peoples
Rocket doesn't seem to like the --interfaces parameter. This is my command 
line string:

python web2py.py -a "" 
--interfaces="0.0.0.0:8001:/home/ross/Desktop/web2py/scripts/service/ca.crt:/home/ross/Desktop/web2py/scripts/service/ca.key"

When this is run, I get the following:

ERROR:Rocket.Errors.Port8001:Socket "0.0.0.0:8001 in use by other process 
and it won't share.
WARNING:Rocket.Errors.Port8001:Listener started when not ready.

However, nothing else is using port 8001 except web2py. If I use this, then 
it works fine:

python web2py.py -a "" -i 0.0.0.0 -p 8001 
-c /home/ross/Desktop/web2py/scripts/service/ca.crt 
-k /home/ross/Desktop/web2py/scripts/service/ca.key

But for some reason, the --interfaces parameter does not work. If I don't 
use quotations (") around it, then web2py starts up on port 8001, but not 
using SSL, just regular HTTP.


[web2py] web2py components and browser history

2012-01-18 Thread LightDot
Ok, guys & gals, I'm in dire need of some advice.

I'm using web2py components extensively and they work fine, of course. But 
I need to find a solution to make browser history aware of components being 
loaded.

I'm aware of projects such as:
- history.js ( https://github.com/balupton/History.js/ )
- jquery-hashchange-plugin ( 
http://benalman.com/projects/jquery-hashchange-plugin/ )
- http://www.adequatelygood.com/2010/7/Saner-HTML5-History-Management
and info such as this:
- https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

I tried working with jquery-hashchange-plugin but to no avail. So while I 
continue troubleshooting, testing and pulling my hair out, I'd like to ask 
for group's experiences. What technique do you use and how have you 
integrated it with web2py?

I'm currently only looking to handle a straightforward back / forward in a 
browser after a single web2py component load. I'd like it to work as far 
back as IE8, but even if only modern browsers are supported, that would be 
fine.

Any advice would be greatly appreciated!


[web2py] Is this a bug? Restrictions in model file names

2012-01-18 Thread Chris
Just had a little surprise -- feels like a bug to me but let's hear
from the experts.

Having read in the web2py book that models are executed in name-sort
order, I changed the names of my model files to have more explicit
ordering -- from db.py and appconfig.py to 100-db.py and 000-
appconfig.py.  Next run of my app had many errors.  Changed the names
back, all is well.  Tried 000appconfig.py and 100db.py, also fine.
The hyphen was the proximate cause of the problem.

Took a look at gluon source -- the root cause seems to be this:

   models = listdir(path, '^\w+\.py$',0,sort=False)


This re spec (using \w) only matches file names using a-z, A-Z, 0-9
plus _   ... no match on hyphen

Generalizing a bit.  It seems like compileapp.py uses inconsistent
specs with listdir().  compile_models and compile_controllers use '.+
\.py$', which will match any file name up to the '.py' part.
compile_views does something more complicated (I don't really
understand the re spec) but it includes \w .   run_models uses '^w+\.py
$', which is more restrictive than what compile_models uses.

The same could be true in other gluon modules -- I didn't look
further.  I'm using version 1.99.2

In summary, it seems like web2py doesn't have a consistent rule for
what file names are allowed in the compile & run subfolders (models,
controllers, views).  If true -- this could lead to subtle bugs and
hard-to-diagnose problems.  If true -- would it make sense to adopt
one consistent allowable-name convention for all web2py files, or be
explicit about the current rules and issue log warnings when a file in
a standard directory is being skipped over due to file name not
matching the convention?

Personally I kind of like the option to rename a file and have it not
execute -- kind of like commenting out a file rather than having to
move in & out of the standard folders.  If the current approach should
persist, then my personal practice will be to add a leading hyphen to
file names to "comment out".

Thanks all


[web2py] Re: Python / web2py or.... the learning path?

2012-01-18 Thread Simon Lukell
Does anyone have an opinion about the web2py video lectures from
codeschool.org ? I had a look at the first video and I thought it was
quite a nice intro:

http://www.youtube.com/playlist?list=PL978B2CE2D788F745


[web2py] Re: Alternative for GROUP BY in app-engine

2012-01-18 Thread sabbir
Hi,

Thanks for the reply.

Yes for this specific project, I have managed to generate some monthly
computed data at the entry time, so that I can show reports like
accounts ledger, receive-payment in month range. Still this is in
adequate, but okay for now. For another project that I am trying to
migrate on app-engine, I am thinking of pushing data to google fusion
table for reporting purpose, so end users (mostly excel wizard, but
non programmer) can have self service on adhoc analysis.

If there were some reference to the cost of processing data by reading
a record set (say of 100k record) it could have helped decide some
aspects.

regards,
sabbir


On Jan 9, 2:30 am, howesc  wrote:
> some thoughts:
>
>  - i have cron jobs that run roll-up reports on a scheduled basis on GAE.
> they select all rows, bucket them, and store the data in an easy to query
> table.  this should be replaced by the recently released Map-Reduce API for
> app engine.
>  - i am beginning to experiment with Google Cloud Sql for storing stats
> data.  this will allow my admins to run arbitrary stats reports at the
> expense of data duplication.  cloud SQL itself is in (private?) beta still
> and pricing has not been announced.
>
> cfh


Re: [web2py] string not recognized

2012-01-18 Thread nils
Hi,
Could you not use {{=XML(string...)}}
Regards,
Nils
On Jan 18, 2012 9:43 a.m., "davidjensen"  wrote:

> This is not recognized asa string:
> "{{this is a string}}" in:
> {{=PRE("{{this is a string}}"))}in a web page
> but it works on the command line:
> >>PRE("{{this is a string}}").xml()
>


[web2py] use the VideoLibrary from web2py appliances

2012-01-18 Thread Web2Py Freak
Dear all ,
how can i use the  VideoLibrary from web2py appliances  , i installed
the pack to my web2py but its not converting any videos !! , how can
i
fix it  and is this application can be used in in a website and i can
deploy it ??


[web2py] string not recognized

2012-01-18 Thread davidjensen
This is not recognized asa string:
"{{this is a string}}" in:
{{=PRE("{{this is a string}}"))}in a web page
but it works on the command line:
>>PRE("{{this is a string}}").xml()


[web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Dan
Cool, How can i forgot the executesql!
thank you very much!!!

On Jan 18, 4:19 pm, Bruno Rocha  wrote:
> So you can use:
>
> results = msdb.execute_sql("SELECT * FROM table.")
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread Annet
Does the first problem has anything to do with auth_menu:


in menu.py:

if 'auth' in globals():
if not auth.is_logged_in():
response.auth_menu = [
['Login',request.function=='user' and
request.args(0)=='login',URL('default','user/login')],
['Gebruikersnaam opvragen',request.function=='user' and
request.args(0)=='retrieve_username',URL('default','user/
retrieve_username')],
['Wachtwoord opvragen',request.function=='user'and
request.args(0)=='request_reset_password',URL('default','user/
request_reset_password')]]
else:
response.auth_menu = [
['Logout',request.function=='user'and
request.args(0)=='logout',URL('default','user/logout')],
['Profiel wijzigen',request.function=='user' and
request.args(0)=='profile',URL('default','user/profile')],
['Wachtwoord wijzigen',request.function=='user' and
request.args(0)=='change_password',URL('default','user/
change_password')]]



in admin/index.html:


  {{if response.auth_menu:}}

  {{for _name,_active,_link in response.auth_menu:}}
{{=_name}}
  {{pass}}

  {{pass}}
 



Annet.


[web2py] Re: jQuery UI modal form dialog and user function.

2012-01-18 Thread Annet
Hi,

Thanks for your reply, I almost got the modal form dialog to work ...

First the form dialog doesn't appear as a modal dialog, it leaves the
original page, i.e. the url changes from: http://127.0.0.1:8000/init/admin/index
to http://127.0.0.1:8000/init/default/user/login, therefore the
underlying page isn't visible. Consequently, when the user clicks the
dialog's close button he ends up with an empty page:
http://127.0.0.1:8000/init/default/user/login

How do I correct this behaviour?

Second, is there a way to get rid of the ui-dialog-titlebar and the
scrollbars?


Thanks for your help.


Annet.


[web2py] use pdfminor in web2py

2012-01-18 Thread kasun perera
Hi all

I have installed PDFMiner a tool for extracting information from PDF 
document and convert in to text. 
http://www.unixuser.org/~euske/python/pdfminer/
 From command line I can manually convert PDF files to text. But I want to 
use this functionality in my web2py application. In my application I 
have uploaded PDF files and I need to extract the text from those files and 
parse the sentences. Can anyone give me a lead how to use this PDFMiner 
functionality inside the web2py to extract the text from PDF?

thanks 

Kasun


Re: [web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Bruno Rocha
So you can use:

results = msdb.execute_sql("SELECT * FROM table.")


-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Dan
Thanks a lot, Bruno.

That really helps, but since my legacy DBs are too much and too
complex (MSSQL Server are only readable to me), I decide to create my
own connections and queries to my MSSQL Server.
Thanks again.

On Jan 18, 3:57 pm, Bruno Rocha  wrote:
> You need to map the existent table and set migrate=False, also you will
> need to specify which field is the 'id' or primary keys, and for all fields
> you need to tell the datatype.
>
> msdb.define_table(
>                             'test',
>                             FIeld('cod', 'id'),
>                             Field('field1', "datatype"),
>                             Field('field2', "datatype"),
>                             migrate=False
>                            )
>
> look 
> here:http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-key...
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]