Re: [web2py] Re: DAL and schema

2012-03-27 Thread adesst
On Tuesday, March 27, 2012 5:35:57 PM UTC+7, spyker wrote:
>
>
>
> On 26 March 2012 20:22, adesst  wrote:
>
>> @Johann, i don't know if you would copy paste the diff i've made into
>> PgAdapter,
>> and do some tests and post the results. Pg and Oracle schema works in
>> the same way.
>>
>>
> I have downloaded and looked at MyDal and the README but I am not sure 
> which 'diff' you refer to.
>
> I have looked at your code buit seems a bit risky for my to jump in before 
> I understand fully what you are doing.
> I will have to spend some time to work through it.
>
> I was hoping that you will open a ticket and that the schema-option may 
> become an official part of DAL.
> Maybe you are working in that direction.
>
> Regards
> Johann 
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>  
Sorry about the confusing 'diff', you could check here 
https://github.com/adesst/web2py, have added postgres.
And i did post the issue here https://github.com/web2py/web2py/issues/6


Hope it helps.


[web2py] Primary Key tables in MSSQL. Cannot get them to work

2012-03-27 Thread Andrew
Hello,
I posted on this issue some time ago and I'm pretty sure it was working 
again after a fix from DenesL.
However I can't get Primary Key tables in MSSQL to work.  They get created 
OK, but I get errors with a Form in a view.
I originally made the Key a string, but then switched to integer just to 
see if it made a difference.  :

*Model:*
dbSQL = DAL('mssql://)
# 1 Column PK
dbSQL.define_table('web2py_int_PK',
Field('Field1', 'integer'),
Field('Field2', 'string', length=20),
format='%(Field1)s',
primarykey = ['Field1'],
migrate=True)

*Controller:*
def web2py_int_PK_form():
form = SQLFORM(dbSQL.web2py_int_PK)
if form.process().accepted:
response.flash = 'form accepted'   
elif form.errors:   
response.flash = 'form has errors'   
else:   
response.flash = 'please fill out the form'
return dict(form=form) 

*View:*
{{extend 'layout.html'}}
Primary Key Form Test
{{=form}}

I get this in the ticket:
File "D:\Mercurial\web2py\gluon\dal.py", line 6912, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: '_id'

It looks like it is trying to retrieve the value for "_id" , but looking at 
the code __init__ for a table, _id never gets set for a table with a 
Primary Key.  (look at lines 6752, 6762, 6772).

Just wondering if something like line 772 in sqlhtml.py (In the SQLFORM 
__init__ method).  "self.id_field_name = table._id.name"  could 
cause the above lookup of the _id key ?  Do Forms work with keyed tables ?

Thanks
Andrew W




[web2py] Re: @auth.requires(lambda: auth.has_membership(VCARD))

2012-03-27 Thread Annet
Wikus,

Thanks for your reply.

You need web2py >= 1.99.3 for the lambda to work.
>

Just upgraded from 1.99.2 to 1.99.7 and it works.


Kind regards,

Annet 


[web2py] Re: New Google Groups functionality

2012-03-27 Thread lyn2py
Excellent, thanks for sharing this.


On Wednesday, March 28, 2012 5:42:17 AM UTC+8, Anthony wrote:
>
> One more thing -- on the far right of the post editing menu is a "{ }" 
> icon that allows you to format text as code. For example:
>
> def index():
> return dict(message='Hello World')
>
>
> Anthony
>
> On Tuesday, March 27, 2012 4:53:01 PM UTC-4, Anthony wrote:
>>
>> Also, in the web interface, you will notice an icon immediately to the 
>> left of the thread title indicating whether it is a discussion, question, 
>> or announcement.
>>
>> On Tuesday, March 27, 2012 4:50:49 PM UTC-4, Anthony wrote:
>>>
>>> Google Groups has added some new functionality that enables us to 
>>> distinguish between discussion, question, and announcement posts. If you 
>>> use the (new) web interface to make a post (
>>> https://groups.google.com/forum/?fromgroups#!forum/web2py), it will now 
>>> default to a "question" post. However, you can easily change that to 
>>> "discussion" or "announcement" once you are creating the post. It is also 
>>> now possible to add a comma separated list of tags to each post. Enjoy.
>>>
>>> Anthony
>>>
>>

[web2py] how to redirect from ajax

2012-03-27 Thread weheh
I'm trying to figure out how the proper syntax to redirect from an ajax 
call using HTTP(200,Location=URL(...)).

The problem is the ajax call points to either an id or an :eval. But I want 
to refresh the entire page -- wiping the slate clean. Is this possible?


[web2py] Re: Form validation on passwords

2012-03-27 Thread cyan

Thanks for the pointer. Anthony.

So now I have the following in my controller:

def register():
 form = SQLFORM.factory( 
 Field('email', requires=[IS_NOT_EMPTY(), IS_EMAIL(forced='^.*\.edu(|\..*)$'
, 
 error_message='email must be .edu address')]), 
 Field('pwd', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=0, upper=1, 
 error_message='minimum 6 characters, and at least 1 uppercase character'),CRYPT
()]), 
 Field('re_pwd', requires=IS_EXPR('value==%s' % repr(request.vars.get('pwd', 
None)), 
 error_message='passwords do not match'))) 

 if form.process().accepted: 
 session.email = form.vars.email 
 session.pwd = form.vars.pwd 
 redirect(URL('registered')) 
 return dict(form=form)


And, for testing, I input the following:

a...@abc.edu

Testpwd

Testpwd


I didn't get any error messages, so presumably all three validations went 
fine. However, using a debugger revealed that form.accepted is still None 
after calling process() on the form. I wonder what went wrong here. Thanks.
On Tuesday, March 27, 2012 5:54:02 PM UTC-4, Anthony wrote:
>
> Here's how auth.register() does it (slightly edited):
>
> requires=IS_EXPR('value==%s' % repr(request.vars.get('password', None)),
>  error_message="Password fields don't match")
>
> Anthony
>
> On Tuesday, March 27, 2012 5:40:29 PM UTC-4, cyan wrote:
>>
>>
>> Hi group,
>>
>> How do I enforce some simple validation for passwords matching on a form 
>> in a controller? All I want to do is to check the second password is the 
>> same as the first one, and here is some code I've come up so far:
>>
>> form = SQLFORM.factory(
>>  Field('email', requires=IS_NOT_EMPTY()),
>>  Field('pwd', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=0, upper
>> =1), CRYPT()]),
>>  Field('re_pwd', requires=IS_MATCH(???)))
>>
>> I am attempting to use the validator 'IS_MATCH()' for the second 
>> password, but not sure how I reference the the input in the first password 
>> field of the same form. Any suggestion would be welcome. Thanks.
>>
>

[web2py] Re: Sum result in DAL

2012-03-27 Thread go94025
works perfectly.  thanks so much for the quick response and explanation.

On Tuesday, March 27, 2012 6:43:45 PM UTC-7, Anthony wrote:
>
> On Tuesday, March 27, 2012 6:25:16 PM UTC-4, go94025 wrote:
>>
>> Hi - new to Web2py and the group.  I'm building an app that will need to 
>> perform Sum and Max against large sets of data.  As I'm getting familiar 
>> with the DAL, I've tried the following (and other combinations) rather than 
>> fall back to db.executesql.  
>>
>> I'm getting the correct result but can't figure out a way to get only the 
>> result number (68) without the (SUM(rates.val02).  Probably missing 
>> something basic but I've tried a lot of combinations and can't seem to get 
>> there.
>>
>> Thanks in advance.
>>
>> Model-
>> db.define_table('rates',
>> Field('rate_name', 'string'),
>> Field('val01', 'integer'),
>> Field('val02', 'integer'),
>>
>> Controller-
>> def sum1():
>> query = db.rates.val02.sum()
>> return dict(sum1 = db().select(query))
>>
>> View-
>> {{=sum1}}
>>
>> Result-
>> SUM(rates.val02)68
>>
>
> The key for the sum is the serialized SQL generated by the DAL, which is 
> "SUM(rates.val02)" (note, technically it is adapter-specific). However, you 
> can use the original object as the key, and it will be serialized to the 
> actual key for you. So, just do:
>
> return dict(sum1 = db().select(query).first(), query=query)
>
> and in the view:
>
> {{=sum1[query]}}
>
> That is equivalent to:
>
> {{=sum1[str(query)]}} 
>
> which is equivalent to:
>
> {{=sum1['SUM(rates.val02)']}} 
>
> Note, I changed sum1 to call the .first() method, which extracts the 
> first (and only) row from the Rows object.
>
> Anthony
>


[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread Anthony

>
> So if I understand this correctly, and also by looking at gluon/tools, 
> setting session.auth = None is tantamount to logging someone off. And 
> auth.log_event(...) is the way to add an entry to the event logger. Sweet 
> and simple. Yes?
>

Yes, I believe so. 


[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread weheh
So if I understand this correctly, and also by looking at gluon/tools, 
setting session.auth = None is tantamount to logging someone off. And 
auth.log_event(...) is the way to add an entry to the event logger. Sweet 
and simple. Yes?

On Wednesday, March 28, 2012 9:05:38 AM UTC+8, Anthony wrote:
>
> On Tuesday, March 27, 2012 6:57:15 PM UTC-4, weheh wrote:
>>
>> I think I want a logout_bare() function so that I can logout via an ajax 
>> call without going through some contortions to avoid auth.logout()'s 
>> redirect.
>>
>> To be more specific, I want a link that says "logout". When clicked, it 
>> logs me out and executes an ajax callback rather than a redirect.
>>
>
> I guess it wouldn't be too hard to write your own function in that case:
>
> def logout_bare():
> if auth.user:
> auth.log_event(auth.messages.logout_log, auth.user)
> session.auth = None
>
> Note, you may want to redirect to a non-protected page if the user happens 
> to be on a protected page when logging out.
>
> Anthony
>


[web2py] Re: Sum result in DAL

2012-03-27 Thread Anthony
On Tuesday, March 27, 2012 6:25:16 PM UTC-4, go94025 wrote:
>
> Hi - new to Web2py and the group.  I'm building an app that will need to 
> perform Sum and Max against large sets of data.  As I'm getting familiar 
> with the DAL, I've tried the following (and other combinations) rather than 
> fall back to db.executesql.  
>
> I'm getting the correct result but can't figure out a way to get only the 
> result number (68) without the (SUM(rates.val02).  Probably missing 
> something basic but I've tried a lot of combinations and can't seem to get 
> there.
>
> Thanks in advance.
>
> Model-
> db.define_table('rates',
> Field('rate_name', 'string'),
> Field('val01', 'integer'),
> Field('val02', 'integer'),
>
> Controller-
> def sum1():
> query = db.rates.val02.sum()
> return dict(sum1 = db().select(query))
>
> View-
> {{=sum1}}
>
> Result-
> SUM(rates.val02)68
>

The key for the sum is the serialized SQL generated by the DAL, which is 
"SUM(rates.val02)" (note, technically it is adapter-specific). However, you 
can use the original object as the key, and it will be serialized to the 
actual key for you. So, just do:

return dict(sum1 = db().select(query).first(), query=query)

and in the view:

{{=sum1[query]}}

That is equivalent to:

{{=sum1[str(query)]}} 

which is equivalent to:

{{=sum1['SUM(rates.val02)']}} 

Note, I changed sum1 to call the .first() method, which extracts the first 
(and only) row from the Rows object.

Anthony


[web2py] Re: Broken application after upgrade.

2012-03-27 Thread web-dev-m
Just continues trying to connect to any application.  The application is 
still under development.  After your suggestion, I dumped my db and deleted 
everything from the databases folder. 

It's working now...not sure what exactly happened.

On Tuesday, March 27, 2012 4:54:51 PM UTC-5, pbreit wrote:
>
> It's weird that one app would affect other apps since usually they are 
> pretty insulated from each other.
>
> Deleting .table files can be a problem. Was the app under development and 
> you wouldn't care if you erased the DB? If so (and it's SQLite), you can 
> delete all the files in the "database" directory and start with a fresh new 
> DB.
>
> When you say that it's not working, how exactly does it behave? Do you get 
> any error messages? Have you touched the routes.py file?
>
> Another thing to consider is downloading a fresh version of Web2py and 
> then copying the applications over one-by-one.
>


[web2py] Sum result in DAL

2012-03-27 Thread go94025
Hi - new to Web2py and the group.  I'm building an app that will need to 
perform Sum and Max against large sets of data.  As I'm getting familiar 
with the DAL, I've tried the following (and other combinations) rather than 
fall back to db.executesql.  

I'm getting the correct result but can't figure out a way to get only the 
result number (68) without the (SUM(rates.val02).  Probably missing 
something basic but I've tried a lot of combinations and can't seem to get 
there.

Thanks in advance.

Model-
db.define_table('rates',
Field('rate_name', 'string'),
Field('val01', 'integer'),
Field('val02', 'integer'),

Controller-
def sum1():
query = db.rates.val02.sum()
return dict(sum1 = db().select(query))

View-
{{=sum1}}

Result-
SUM(rates.val02)68


[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread Anthony
On Tuesday, March 27, 2012 6:57:15 PM UTC-4, weheh wrote:
>
> I think I want a logout_bare() function so that I can logout via an ajax 
> call without going through some contortions to avoid auth.logout()'s 
> redirect.
>
> To be more specific, I want a link that says "logout". When clicked, it 
> logs me out and executes an ajax callback rather than a redirect.
>

I guess it wouldn't be too hard to write your own function in that case:

def logout_bare():
if auth.user:
auth.log_event(auth.messages.logout_log, auth.user)
session.auth = None

Note, you may want to redirect to a non-protected page if the user happens 
to be on a protected page when logging out.

Anthony


[web2py] Re: Fake_migrate with auth

2012-03-27 Thread Brian M
you can do auth.define_tables(fake_migrate = True)

On Tuesday, March 27, 2012 12:27:21 PM UTC-5, Detectedstealth wrote:
>
> How do I do a fake_migrate with the auth table so I don't get the following 
> error? I know the table exists already I just pushed some major changes to my 
> server and now when I run the app I get the tables already exists error. I 
> really don't want to have to delete that table again, consider I have hundred 
> people testing the site..
>
> relation "auth_group" already exists
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>


[web2py] Re: Validating Registration fields

2012-03-27 Thread Anthony
Try

IS_EMPTY_OR(IS_IMAGE())


Anthony

On Tuesday, March 27, 2012 7:12:45 PM UTC-4, Peter G. wrote:
>
> Thanks for the code snippets Anthony--but a minor caveat I didn't realize 
> ahead of time is that the user is free to either upload an image or not. If 
> the user does not upload an image, the IS_IMAGE() validators barks at the 
> user. Is there a easy way of implementing such a logic: "if a file is 
> uploaded, check for IS_IMAGE(), otherwise ignore."?
>
>
> On Thursday, March 22, 2012 3:38:01 PM UTC-7, Anthony wrote:
>>
>> On Thursday, March 22, 2012 6:09:25 PM UTC-4, Peter G. wrote:
>>>
>>> I'm using the auth.settengs.extra_fields to add an extra upload field 
>>> for the user to upload an avatar, how can I add an IS_IMAGE validator to 
>>> the upload field so that the user can't upload random files?
>>
>>
>> When you define the field, you can do:
>>
>> Field('avatar', 'upload', requires=IS_IMAGE())
>>
>> or after the tables have been defined:
>>
>> db.auth_user.avatar.requires = IS_IMAGE()
>>  
>>
>>>
>>> Also, how would I add an IS_ALPHANUMERIC to the built in First name and 
>>> Last name form fields? Right now there are users registering with names 
>>> like "!@#$%^~" and some such...
>>>
>>
>> After the tables have been defined, you can do:
>>
>> db.auth_user.first_name.requires.append(IS_ALPHANUMERIC())
>>
>> That adds the validator to the existing IS_NOT_EMPTY validator.
>>
>> However, I wouldn't use that validator for names because it doesn't allow 
>> valid name characters such as spaces, hyphens, and apostrophes. Anyway, if 
>> you prevent fake names with special characters, those users will just 
>> create fake names with alphanumeric characters, so either way you don't 
>> have a real name.
>>
>> Anthony
>>
>

[web2py] Re: difference between

2012-03-27 Thread weheh
Yay, Anthony! You 'da man. It works now. Phew. But truth be known, I don't 
exactly know what was going on here or what changes made the difference. I 
made the URL change you suggested -- it was some ancient code I had written 
years ago that I had developed a blindness towards 'cause it seemed to 
work. Anyway, I made the change to the URL and removed the leading '/' from 
the paths in the script list. This caused my system to fail. I then 
reordered the web2py_ajax.html loading. The system still failed. I then did 
an update to the latest versions of all my jquery files. And then ... magic 
.. the system worked.

So bottom line, I think there were multiple problems here. One, there was 
an order dependence on loading the javascripts that bit me. Also, there 
were some bugs in the URL encoding. Finally, there may have been a mismatch 
in the versions of the javascript packages getting loaded up. It all added 
up to a snake pit. Thankfully, I'm out of it now. Thanks pbreit for your 
help, too. You guys are great.


On Tuesday, March 27, 2012 11:08:25 PM UTC+8, Anthony wrote:
>
> On Tuesday, March 27, 2012 1:46:50 AM UTC-4, weheh wrote:
>>
>> Ouch, ouch, ouch ... that causes things to really disintegrate! I tend 
>> to agree with your assessment that there's an order dependence 
>> somewhere. But I don't see it, yet.
>>
>
> I think your URL function is wrong -- URL('static', 'js', script) assumes 
> 'static' is the app, 'js' is the controller, and script is the function. 
> Instead, try:
>
> URL('static', 'js%s' % script)
>
> Actually, for readability, I would do 'js/%s' and remove the leading '/' 
> from your script values.
>
> Anthony
>  
>


[web2py] Re: web2py 1.99.7 is OUT

2012-03-27 Thread IVINH

This OK. Thanks.


Vào 21:12:40 UTC+7 Thứ ba, ngày 27 tháng ba năm 2012, Massimo Di Pierro đã 
viết:
>
> Have you checked trunk or the nightly built. I believe this was fixed?
>
> On Tuesday, 27 March 2012 03:56:35 UTC-5, IVINH wrote:
>>
>>
>>
>> In my app, LOAD not work fine with 1.99.7, i'm try a test:
>> 1. copy my view (contain js script), example: index.html to index.load
>> 2. run :  .../index.html and then .../index.load
>>
>> Both work well with the 1.99.4, but the second was not correct with 1.99.7
>> I think this is problem of extension .html & .load
>>  
>>
>>
>> Vào 11:00:15 UTC+7 Thứ ba, ngày 27 tháng ba năm 2012, Anthony đã viết:
>>>
>>> Can you describe the problem? Is the below view the index.load view? 
>>> What is in plugin_app/layout.html? Should that be extended rather than 
>>> included?
>>>
>>> Anthony
>>>
>>> On Monday, March 26, 2012 11:23:34 PM UTC-4, IVINH wrote:



 I have two views similar but different extension (index.html & index.
 load).
 Both work well with the 1.99.4, but index.load was not for 1.99.7?

 My view:

 {{include 'plugin_app/layout.html'}}
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.js')}}"
  
 type="text/javascript">
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pieRenderer.min.js')}}"
  
 type="text/javascript">
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.donutRenderer.min.js')}}"
  
 type="text/javascript">
 >>> href="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.css')}}"
  
 rel="stylesheet" type="text/css" />

 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.barRenderer.min.js')}}"
  
 type="text/javascript">
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.categoryAxisRenderer.min.js')}}"
  
 type="text/javascript">
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pointLabels.min.js')}}"
  
 type="text/javascript">

 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasTextRenderer.min.js')}}"
  
 type="text/javascript">
 >>> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js')}}"
  
 type="text/javascript">

 
 {{=content}}
 




  

 Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di 
 Pierro đã viết:
>
> Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
> compatibility issues.
>
> Massimo
>

 Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di 
 Pierro đã viết:
>
> Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
> compatibility issues.
>
> Massimo
>


[web2py] Re: Validating Registration fields

2012-03-27 Thread Peter G.
Thanks for the code snippets Anthony--but a minor caveat I didn't realize 
ahead of time is that the user is free to either upload an image or not. If 
the user does not upload an image, the IS_IMAGE() validators barks at the 
user. Is there a easy way of implementing such a logic: "if a file is 
uploaded, check for IS_IMAGE(), otherwise ignore."?


On Thursday, March 22, 2012 3:38:01 PM UTC-7, Anthony wrote:
>
> On Thursday, March 22, 2012 6:09:25 PM UTC-4, Peter G. wrote:
>>
>> I'm using the auth.settengs.extra_fields to add an extra upload field for 
>> the user to upload an avatar, how can I add an IS_IMAGE validator to the 
>> upload field so that the user can't upload random files?
>
>
> When you define the field, you can do:
>
> Field('avatar', 'upload', requires=IS_IMAGE())
>
> or after the tables have been defined:
>
> db.auth_user.avatar.requires = IS_IMAGE()
>  
>
>>
>> Also, how would I add an IS_ALPHANUMERIC to the built in First name and 
>> Last name form fields? Right now there are users registering with names 
>> like "!@#$%^~" and some such...
>>
>
> After the tables have been defined, you can do:
>
> db.auth_user.first_name.requires.append(IS_ALPHANUMERIC())
>
> That adds the validator to the existing IS_NOT_EMPTY validator.
>
> However, I wouldn't use that validator for names because it doesn't allow 
> valid name characters such as spaces, hyphens, and apostrophes. Anyway, if 
> you prevent fake names with special characters, those users will just 
> create fake names with alphanumeric characters, so either way you don't 
> have a real name.
>
> Anthony
>


[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread weheh
I think I want a logout_bare() function so that I can logout via an ajax 
call without going through some contortions to avoid auth.logout()'s 
redirect.

To be more specific, I want a link that says "logout". When clicked, it 
logs me out and executes an ajax callback rather than a redirect.


Re: [web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Miguel Lopes
Find it.

titles = "'"+titles.replace('|', "','")+"'"
with:
SCRIPT(" ... jQuery.prettyPhoto.open(**images=%(images)s,titles=[%(**
titles)s]);})" % dict(images=images, titles=titles), _language='javascript')

works! Tested on Firefox and Safari.

Though I've failed to find any references on this (there must be), the
problem seems to be Python string formatting. It seems that  when the value
of a dict is a list (haven't tested for other types such as dict and
tuple?), Python uses repr instead of str, so we end-up with a
representation! This does not happen if titles is a string. Note I'm using
Python 2.5.

Miguel



On Tue, Mar 27, 2012 at 6:46 PM, Derek  wrote:

> Check the meta tag - if it's UTF-8, that's most likely the issue.  You can
> try ISO-8859-1 and see if that works for you.
>
>
> On Tuesday, March 27, 2012 10:41:53 AM UTC-7, Derek wrote:
>>
>> What's the character set in your browser?
>>
>> On Tuesday, March 27, 2012 9:13:14 AM UTC-7, miguel wrote:
>>>
>>> This is not strictly a web2py issue. Though it is a problem that apps
>>> dealing with some character sets must deal with.
>>> I confess that the source of my problem is that I have been delaying
>>> reading-up on encoding and decoding far too long. But I'm pressed for time
>>> and I'm sure that this is a simple issue to many of you.
>>>
>>> Here's is it (slightly embarrassed):
>>>
>>> It works if I hardcode a string in a script helper:
>>>
>>> SCRIPT(" ... jQuery.prettyPhoto.open(**images=%(images)s,titles=['**olá',
>>> 'olé']);})" % dict(...images=images), _language='javascript')
>>>
>>> It also works if (getting titles from the db, where it is stored as
>>> "'olá','olé'" - note single quotes included):
>>>
>>> SCRIPT(" ... 
>>> jQuery.prettyPhoto.open(**images=%(images)s,titles=[%(**titles)]);})"
>>> % dict(images=images, titles=titles), _language='javascript')
>>>
>>> However, if I try to parse from the db (where titles is stored as
>>> "olá|olé", such as:
>>> titles = [title.strip() for title in titles.split('|')]
>>>
>>> The jQuery string is adequately adjusted to receive a list:
>>> SCRIPT(" ... jQuery.prettyPhoto.open(**images=%(images)s,titles=%(**
>>> titles));})" % dict(images=images, titles=titles),
>>> _language='javascript')
>>>
>>> All works but when rendered by the browser I do not get: Olá  instead I
>>> get: olá
>>> The same for Olé and olé
>>>
>>> My goal is to have a user supplied string, such as: olá|olé
>>>
>>> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is
>>> awesome :-)
>>>
>>> Txs for the help,
>>> Miguel
>>>
>>


[web2py] Re: difference between

2012-03-27 Thread Anthony
What is confusing?

On Tuesday, March 27, 2012 6:09:48 PM UTC-4, pbreit wrote:
>
> I'm a little confused. Here's what the most recent code looks like:
>
> === web2py_ajax.html ===
> 
> {{
> response.files.insert(0,URL('static','js/jquery.js'))
> response.files.insert(1,URL('static','css/calendar.css'))
> response.files.insert(2,URL('static','js/calendar.js'))
> response.files.insert(3,URL('static','js/web2py.js'))
> response.include_meta()
> response.include_files()
> }} === layout.html ===   
>   {{
>   response.files.append(URL('static','css/skeleton.css'))
>   response.files.append(URL('static','css/web2py.css'))
>   if response.menu:
>  response.files.append(URL('static','css/superfish.css'))
>  response.files.append(URL('static','js/superfish.js'))
>   pass
>   }}
>
>   {{include 'web2py_ajax.html'}}
>


Re: [web2py] Re: New Google Groups functionality

2012-03-27 Thread Anthony
On Tuesday, March 27, 2012 6:06:17 PM UTC-4, rochacbruno wrote:
>
> is there some markup for doing that on emails?
>

I don't know -- I just discovered this and enabled it in the web interface 
-- not sure what can be done via email.

Anthony 


[web2py] Re: difference between

2012-03-27 Thread pbreit
I'm a little confused. Here's what the most recent code looks like:

=== web2py_ajax.html ===

{{
response.files.insert(0,URL('static','js/jquery.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
}} === layout.html ===   
  {{
  response.files.append(URL('static','css/skeleton.css'))
  response.files.append(URL('static','css/web2py.css'))
  if response.menu:
 response.files.append(URL('static','css/superfish.css'))
 response.files.append(URL('static','js/superfish.js'))
  pass
  }}

  {{include 'web2py_ajax.html'}}


Re: [web2py] Re: New Google Groups functionality

2012-03-27 Thread Bruno Rocha
is there some markup for doing that on emails?

On Tue, Mar 27, 2012 at 6:42 PM, Anthony  wrote:

> One more thing -- on the far right of the post editing menu is a "{ }"
> icon that allows you to format text as code. For example:
>
> def index():
> return dict(message='Hello World')
>
>
> Anthony
>
>
> On Tuesday, March 27, 2012 4:53:01 PM UTC-4, Anthony wrote:
>>
>> Also, in the web interface, you will notice an icon immediately to the
>> left of the thread title indicating whether it is a discussion, question,
>> or announcement.
>>
>> On Tuesday, March 27, 2012 4:50:49 PM UTC-4, Anthony wrote:
>>>
>>> Google Groups has added some new functionality that enables us to
>>> distinguish between discussion, question, and announcement posts. If you
>>> use the (new) web interface to make a post (https://groups.google.com/**
>>> forum/?fromgroups#!forum/**web2py),
>>> it will now default to a "question" post. However, you can easily change
>>> that to "discussion" or "announcement" once you are creating the post. It
>>> is also now possible to add a comma separated list of tags to each post.
>>> Enjoy.
>>>
>>> Anthony
>>>
>>


-- 

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


[web2py] Re: pop-up verification

2012-03-27 Thread pbreit
I have a Jquery dialog on one of my pages that I think does something 
similar. So when the user clicks "list", the dialog pops up and then when 
they press "Ok" it sets the window.location to a new URL. But I'm guessin 
you probably need to do a POST which I'm not quite sure how that would work.


list

$(function() {
$("#dialog-form").dialog({
autoOpen: false,
show: 'fade',
hide: 'fade',
modal: true,
resizable: false,
width: 200,
minHeight: 190,
buttons: {
"Close": function() { $(this).dialog("close"); },
"Ok": function() { window.location = "{{=URL('ebay', 'api', 
args=['list', item.id])}}?ebay_category=" + 
document.getElementById("ebay_category").value; }
}
});

$('#opener').click(function(e) {
e.preventDefault();
$dialog.dialog('open');
});
});


[web2py] Re: Broken application after upgrade.

2012-03-27 Thread pbreit
It's weird that one app would affect other apps since usually they are 
pretty insulated from each other.

Deleting .table files can be a problem. Was the app under development and 
you wouldn't care if you erased the DB? If so (and it's SQLite), you can 
delete all the files in the "database" directory and start with a fresh new 
DB.

When you say that it's not working, how exactly does it behave? Do you get 
any error messages? Have you touched the routes.py file?

Another thing to consider is downloading a fresh version of Web2py and then 
copying the applications over one-by-one.


[web2py] Re: Form validation on passwords

2012-03-27 Thread Anthony
Here's how auth.register() does it (slightly edited):

requires=IS_EXPR('value==%s' % repr(request.vars.get('password', None)),
 error_message="Password fields don't match")

Anthony

On Tuesday, March 27, 2012 5:40:29 PM UTC-4, cyan wrote:
>
>
> Hi group,
>
> How do I enforce some simple validation for passwords matching on a form 
> in a controller? All I want to do is to check the second password is the 
> same as the first one, and here is some code I've come up so far:
>
> form = SQLFORM.factory(
>  Field('email', requires=IS_NOT_EMPTY()),
>  Field('pwd', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=0, upper=
> 1), CRYPT()]),
>  Field('re_pwd', requires=IS_MATCH(???)))
>
> I am attempting to use the validator 'IS_MATCH()' for the second password, 
> but not sure how I reference the the input in the first password field of 
> the same form. Any suggestion would be welcome. Thanks.
>


[web2py] Re: New Google Groups functionality

2012-03-27 Thread Anthony
One more thing -- on the far right of the post editing menu is a "{ }" icon 
that allows you to format text as code. For example:

def index():
return dict(message='Hello World')


Anthony

On Tuesday, March 27, 2012 4:53:01 PM UTC-4, Anthony wrote:
>
> Also, in the web interface, you will notice an icon immediately to the 
> left of the thread title indicating whether it is a discussion, question, 
> or announcement.
>
> On Tuesday, March 27, 2012 4:50:49 PM UTC-4, Anthony wrote:
>>
>> Google Groups has added some new functionality that enables us to 
>> distinguish between discussion, question, and announcement posts. If you 
>> use the (new) web interface to make a post (
>> https://groups.google.com/forum/?fromgroups#!forum/web2py), it will now 
>> default to a "question" post. However, you can easily change that to 
>> "discussion" or "announcement" once you are creating the post. It is also 
>> now possible to add a comma separated list of tags to each post. Enjoy.
>>
>> Anthony
>>
>

[web2py] Form validation on passwords

2012-03-27 Thread cyan

Hi group,

How do I enforce some simple validation for passwords matching on a form in 
a controller? All I want to do is to check the second password is the same 
as the first one, and here is some code I've come up so far:

form = SQLFORM.factory(
 Field('email', requires=IS_NOT_EMPTY()),
 Field('pwd', requires=[IS_NOT_EMPTY(), IS_STRONG(min=6, special=0, upper=1
), CRYPT()]),
 Field('re_pwd', requires=IS_MATCH(???)))

I am attempting to use the validator 'IS_MATCH()' for the second password, 
but not sure how I reference the the input in the first password field of 
the same form. Any suggestion would be welcome. Thanks.


[web2py] skeleton.css resetting possible css mistake

2012-03-27 Thread jep
With web2py 1.99.7 i try to display preformatted code between "   
   " but the result does not look like preformatted text should 
look like. .

In skeleton.css on line 28 i found that  pre is being reset to default 
(inherit) font, I think this might be the cause. 
After I removed pre from line 28 in skeleton.css  it looked ok.

Can somebody confirm this is a mistake ? 


[web2py] LinkedIn Integration - Tutorial needed

2012-03-27 Thread Udi Milo
Hi,

For a while now I've been trying to get the linkedIn module to work as 
described in the book and in different posts around the web, without 
success.
Can someone who has done it please describe how this can be achieved?

Thanks!


Re: [web2py] unable to parse csv file 'NoneType' object is unsubscriptable with list:reference type field

2012-03-27 Thread Richard Vézina
Same thing with trunk...

Richard

On Tue, Mar 27, 2012 at 3:52 PM, Richard wrote:

> This one to :
> https://groups.google.com/forum/?fromgroups#!topic/web2py/H_QqV2g8IgQ
>
> I experimented the problem with 1.99.4 and 1.99.7
>
> What I understand so far is that id_map get None by default, so when it
> get here :
>
> [id_map[ref_table][int(v)] \
>  for v in bar_decode_string('|35|1|')]
>
> It clears that it will raise the exception...
>
> I try to call my import function like this :
>
> def import_csv(table, file):
> table.import_from_csv_file(file, id_map = {})
>
> Noting better.
>
> Please help.
>
> Richard
>
>
> Le mardi 27 mars 2012 15:45:50 UTC-4, Richard a écrit :
>
>> Seems related : https://groups.google.com/**forum/#!topic/web2py/**
>> nYKsFPumXk0 
>>
>>
>>
>> Le mardi 27 mars 2012 15:20:27 UTC-4, Richard a écrit :
>>>
>>> Hello,
>>>
>>> Is it possible the table csv import method be broken?
>>>
>>> When I use list:reference type field I can't import back a exported CSV
>>> with the appadmin.
>>>
>>> I don't understand where the None value could come from...
>>>
>>> When I try to implement my own csv import function base on this thread :
>>> https://groups.google.com/**forum/?fromgroups#!topic/**
>>> web2py/lDi0lLK_Wm0
>>>
>>> That work fine, until I try to import data with list:reference type
>>> field (|id| or |id|id|, etc.)
>>>
>>> I get this traceback :
>>>
>>> for v in bar_decode_string(value)]
>>> TypeError: 'NoneType' object is unsubscriptable
>>>
>>>
>>>-
>>>
>>>
>>>  Function argument list
>>>
>>> (field=, value='|35|1|', id_map=None)
>>>  Code listing
>>>
>>> 5683.
>>> 5684.
>>> 5685.
>>> 5686.
>>> 5687.
>>>
>>> 5688.
>>>
>>> 5689.
>>> 5690.
>>> 5691.
>>> 5692.
>>>
>>> elif field.type.startswith('list:**string'):
>>>
>>> value = bar_decode_string(value)
>>>
>>> elif field.type.startswith(list_**reference_s):
>>>
>>> ref_table = field.type[len(list_reference_**s):].strip()
>>>
>>> value = [id_map[ref_table][int(v)] \
>>>
>>>  for v in bar_decode_string(value)]
>>>
>>> elif field.type.startswith('list:')**:
>>>
>>> value = bar_decode_integer(value)
>>>
>>> elif id_map and field.type.startswith('**reference'):
>>>
>>> try:
>>>
>>>  Variables  global bar_decode_string  
>>> value'|35|1|'
>>> v '35'
>>>
>>> What is exactly id_map?
>>>
>>> I think problem is coming from there...
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>


[web2py] Re: Question about 0.py

2012-03-27 Thread Mike
I just started a brand-new app through the wizard and plugged in my mysql 
database settings during the setup process. I see that in 0.py I have the 
following :

settings.database_uri = 'mysql://user:pass@server/database' (i censored the 
original)

but in db.py it says:

if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL('sqlite://storage.sqlite')

after I changed the db= line to what was in settings.database the mysql 
tables showed up. Before that I did not see them. 

Is this a bug or was there something else I have to toggle after going 
through the app wizard?

Thanks!
Mike

On Monday, February 7, 2011 8:48:09 PM UTC-5, Massimo Di Pierro wrote:
>
> 0.py is not a web2py file. It is created by the wizard. If a variable 
> is not used is a bug in the wizard. 
>
> Massimo 
>
> On Feb 7, 7:21 pm, devGS  wrote: 
> > I saw that object 'settings' is defined at 0.py, but I didn't see any 
> > usage of 'settings'. For instance, in db.py, instead of reusing the 
> > 0.py's 'settings', the stings are redefined, even though realize about 
> > some modules that use 'settings' instead of db.py set variables. Can 
> > this point be cleared please? Why is there mail.settings.XYZ = '...' 
> > instead of 'mail.settings.XYZ = settings.XYZ'? Thanks.



[web2py] Re: New Google Groups functionality

2012-03-27 Thread Anthony
Also, in the web interface, you will notice an icon immediately to the left 
of the thread title indicating whether it is a discussion, question, or 
announcement.

On Tuesday, March 27, 2012 4:50:49 PM UTC-4, Anthony wrote:
>
> Google Groups has added some new functionality that enables us to 
> distinguish between discussion, question, and announcement posts. If you 
> use the (new) web interface to make a post (
> https://groups.google.com/forum/?fromgroups#!forum/web2py), it will now 
> default to a "question" post. However, you can easily change that to 
> "discussion" or "announcement" once you are creating the post. It is also 
> now possible to add a comma separated list of tags to each post. Enjoy.
>
> Anthony
>


[web2py] New Google Groups functionality

2012-03-27 Thread Anthony
Google Groups has added some new functionality that enables us to 
distinguish between discussion, question, and announcement posts. If you 
use the (new) web interface to make a post 
(https://groups.google.com/forum/?fromgroups#!forum/web2py), it will now 
default to a "question" post. However, you can easily change that to 
"discussion" or "announcement" once you are creating the post. It is also 
now possible to add a comma separated list of tags to each post. Enjoy.

Anthony


[web2py] Re: Issue Tracking System Survey

2012-03-27 Thread Anthony
On Tuesday, March 27, 2012 4:18:33 PM UTC-4, Bill Thayer wrote:
>
> Where is the issue tracking system in case I need to log an issue?
>

http://code.google.com/p/web2py/issues/list 


[web2py] Re: Broken application after upgrade.

2012-03-27 Thread web-dev-m
No, After much trying to no avail these are the symptoms:

All Controllers, Views, Tables show up in AppAdmin.
No ability to administrate the DB from AppAdmin.
No ability to connect to any application while the affected
application is installed.

I think somehow my database might have been corrupted.  I was doing
some stupid testing and one of my .table files was corrupted so I
deleted it.  They only store database structure right?...

On Mar 26, 10:28 pm, Massimo Di Pierro 
wrote:
> If this for a specific application? A specific action?
>
>
>
>
>
>
>
> On Monday, 26 March 2012 21:00:33 UTC-5, web-dev-m wrote:
>
> > I am having a strange problem.  I just upgraded from 1.99.2 to 1.99.7
> > (manually by running update-web2py.sh from /scripts as the link was
> > not working in the application).
>
> > I can see my application and all the files are there, but when I try
> > to get into any of the files it doesn't load.  It just hangs at
> > connecting no matter what controller I try to access.
>
> > I then packed it, and reinstalled via Web2py admin interface.  Still
> > no luck.
>
> > Just before I started having this problem, I was having another wierd
> > problem.  I was getting an operational error:no such table after just
> > creating a simple table like I have done many many times.
>
> > Any suggestions?


Re: [web2py] pop-up verification

2012-03-27 Thread Richard Vézina
I think you will have to write a ajax call back to the database that will
look if the data already existing if so trigger your message if not let it
go.

There is the validators but they will not let pass the duplicated data if
you have set your field to unique.

Richard

On Tue, Mar 27, 2012 at 4:14 PM, Larry G. Wapnitsky wrote:

> Last question of the day, I promise...
>
> So, I have data that exists in my database.  If a user enters a value that
> already exists, I want to prompt them with an "are you sure?" type question
> before the function that adds/updates the data continues.
>
> How do I interrupt my current function to do so without leaving the page
> and losing data?
>
> Thanks,
> Larry
>


[web2py] Re: Issue Tracking System Survey

2012-03-27 Thread Bill Thayer
Where is the issue tracking system in case I need to log an issue?

On Tuesday, October 4, 2011 1:29:52 PM UTC-5, petrasadi wrote:
>
> I am currently working on a project meant to improve the current 
> Web2Py Issue Tracking System. 
> Are there any features that could use touch-ups or new features that 
> should be implemented? 
> Looking forward to your suggestions.



[web2py] pop-up verification

2012-03-27 Thread Larry G. Wapnitsky

Last question of the day, I promise...

So, I have data that exists in my database.  If a user enters a value 
that already exists, I want to prompt them with an "are you sure?" type 
question before the function that adds/updates the data continues.


How do I interrupt my current function to do so without leaving the page 
and losing data?


Thanks,
Larry


Re: [web2py] unable to parse csv file 'NoneType' object is unsubscriptable with list:reference type field

2012-03-27 Thread Richard
This one to : 
https://groups.google.com/forum/?fromgroups#!topic/web2py/H_QqV2g8IgQ

I experimented the problem with 1.99.4 and 1.99.7

What I understand so far is that id_map get None by default, so when it get 
here :

[id_map[ref_table][int(v)] \
 for v in bar_decode_string('|35|1|')]

It clears that it will raise the exception...

I try to call my import function like this :

def import_csv(table, file):
table.import_from_csv_file(file, id_map = {})

Noting better.

Please help.

Richard


Le mardi 27 mars 2012 15:45:50 UTC-4, Richard a écrit :
>
> Seems related : https://groups.google.com/forum/#!topic/web2py/nYKsFPumXk0
>
>
>
> Le mardi 27 mars 2012 15:20:27 UTC-4, Richard a écrit :
>>
>> Hello,
>>
>> Is it possible the table csv import method be broken?
>>
>> When I use list:reference type field I can't import back a exported CSV 
>> with the appadmin.
>>
>> I don't understand where the None value could come from...
>>
>> When I try to implement my own csv import function base on this thread : 
>> https://groups.google.com/forum/?fromgroups#!topic/web2py/lDi0lLK_Wm0
>>
>> That work fine, until I try to import data with list:reference type field 
>> (|id| or |id|id|, etc.)
>>
>> I get this traceback :
>>
>> for v in bar_decode_string(value)]
>> TypeError: 'NoneType' object is unsubscriptable
>>
>>  
>>-  
>>
>>
>>  Function argument list
>>
>> (field=, value='|35|1|', id_map=None)
>>  Code listing
>>
>> 5683.
>> 5684.
>> 5685.
>> 5686.
>> 5687.
>>
>> 5688.
>>
>> 5689.
>> 5690.
>> 5691.
>> 5692.
>>
>> elif field.type.startswith('list:string'):
>>
>> value = bar_decode_string(value)
>>
>> elif field.type.startswith(list_reference_s):
>>
>> ref_table = field.type[len(list_reference_s):].strip()
>>
>> value = [id_map[ref_table][int(v)] \
>>
>>  for v in bar_decode_string(value)]
>>
>> elif field.type.startswith('list:'):
>>
>> value = bar_decode_integer(value)
>>
>> elif id_map and field.type.startswith('reference'):
>>
>> try:
>>
>>  Variables  global bar_decode_string  
>> value'|35|1|' 
>> v '35'
>>
>> What is exactly id_map?
>>
>> I think problem is coming from there...
>>
>> Thanks
>>
>> Richard
>>
>

Re: [web2py] unable to parse csv file 'NoneType' object is unsubscriptable with list:reference type field

2012-03-27 Thread Richard
Seems related : https://groups.google.com/forum/#!topic/web2py/nYKsFPumXk0



Le mardi 27 mars 2012 15:20:27 UTC-4, Richard a écrit :
>
> Hello,
>
> Is it possible the table csv import method be broken?
>
> When I use list:reference type field I can't import back a exported CSV 
> with the appadmin.
>
> I don't understand where the None value could come from...
>
> When I try to implement my own csv import function base on this thread : 
> https://groups.google.com/forum/?fromgroups#!topic/web2py/lDi0lLK_Wm0
>
> That work fine, until I try to import data with list:reference type field 
> (|id| or |id|id|, etc.)
>
> I get this traceback :
>
> for v in bar_decode_string(value)]
> TypeError: 'NoneType' object is unsubscriptable
>
>  
>-  
>
>
>  Function argument list
>
> (field=, value='|35|1|', id_map=None)
>  Code listing
>
> 5683.
> 5684.
> 5685.
> 5686.
> 5687.
>
> 5688.
>
> 5689.
> 5690.
> 5691.
> 5692.
>
> elif field.type.startswith('list:string'):
>
> value = bar_decode_string(value)
>
> elif field.type.startswith(list_reference_s):
>
> ref_table = field.type[len(list_reference_s):].strip()
>
> value = [id_map[ref_table][int(v)] \
>
>  for v in bar_decode_string(value)]
>
> elif field.type.startswith('list:'):
>
> value = bar_decode_integer(value)
>
> elif id_map and field.type.startswith('reference'):
>
> try:
>
>  Variables  global bar_decode_string  
> value'|35|1|' 
> v '35'
>
> What is exactly id_map?
>
> I think problem is coming from there...
>
> Thanks
>
> Richard
>


[web2py] unable to parse csv file 'NoneType' object is unsubscriptable with list:reference type field

2012-03-27 Thread Richard Vézina
Hello,

Is it possible the table csv import method be broken?

When I use list:reference type field I can't import back a exported CSV
with the appadmin.

I don't understand where the None value could come from...

When I try to implement my own csv import function base on this thread :
https://groups.google.com/forum/?fromgroups#!topic/web2py/lDi0lLK_Wm0

That work fine, until I try to import data with list:reference type field
(|id| or |id|id|, etc.)

I get this traceback :

for v in bar_decode_string(value)]
TypeError: 'NoneType' object is unsubscriptable


   -


Function argument list

(field=, value='|35|1|', id_map=None)
Code listing

5683.
5684.
5685.
5686.
5687.
5688.

5689.
5690.
5691.
5692.

elif field.type.startswith('list:string'):
value = bar_decode_string(value)
elif field.type.startswith(list_reference_s):
ref_table = field.type[len(list_reference_s):].strip()
value = [id_map[ref_table][int(v)] \
 for v in bar_decode_string(value)]

elif field.type.startswith('list:'):
value = bar_decode_integer(value)
elif id_map and field.type.startswith('reference'):
try:

Variablesglobal bar_decode_stringvalue'|35|1|'v
'35'

What is exactly id_map?

I think problem is coming from there...

Thanks

Richard


Re: [web2py] Re: Fake_migrate with auth

2012-03-27 Thread Bruce Wade
Yes I think you are probably right. It is a shame that we can use auth for
this kind of situation.

On Tue, Mar 27, 2012 at 11:34 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I think the best way to avoid this is to define custom auth tables and
> then set them to migrate=false.
>
> Richard
>
>
> On Tue, Mar 27, 2012 at 1:40 PM, Bruce Wade  wrote:
>
>> Tried fake_migrate_all which allowed the page to loaded. However now when
>> I try to login I get an error that auth_user.username doesn't exist. When I
>> go to the database administration in admin, I get the following error when
>> clicking on auth_user,
>>
>>  current transaction is aborted, commands
>> ignored until end of transaction block
>>
>> On Tue, Mar 27, 2012 at 10:27 AM, Bruce Wade wrote:
>>
>>> How do I do a fake_migrate with the auth table so I don't get the following 
>>> error? I know the table exists already I just pushed some major changes to 
>>> my server and now when I run the app I get the tables already exists error. 
>>> I really don't want to have to delete that table again, consider I have 
>>> hundred people testing the site..
>>>
>>> relation "auth_group" already exists
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.warplydesigned.com
>>> http://www.fitnessfriendsfinder.com
>>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>


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


Re: [web2py] Re: DAL or SQL?

2012-03-27 Thread Keith Edmunds
On Sun, 25 Mar 2012 16:41:09 -0700 (PDT), niph...@gmail.com said:

> Doh, you're right. All the "datetime" api on fields are extracting, not 
> converting the actual value

Yes, and I've also found that, with Sqlite at least, web2py doesn't
carry out datetime arithmetic correctly within the DAL (not entirely
Web2py's fault).

Rather than have another field in the table for duration, which could
easily get out of sync with start/stop times, I created a view instead:

CREATE VIEW v_durations as select
id,f_date,f_start,f_end,strftime('%s',t_periods.f_end)-strftime('%s',t_periods.f_start)
as f_duration,f_category,f_task,f_user from t_periods;

I use that view, rather than the t_periods table, for reporting. It's
defined in the model as migrate=false, and it works really well. If I move
to another database (probably MySQL for production), I only need to create
one new view. This way, edits to the table are no problem, and the
duration from the view is always correct.
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


Re: [web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Derek
Right, I was asking what the page shows as the character set. I was not so 
good at asking for what I wanted.

On Tuesday, March 27, 2012 11:28:37 AM UTC-7, miguel wrote:
>
>
> No dia 27 de Mar de 2012 17:41, "Derek"  escreveu:
> >
> > What's the character set in your browser?
> >
> I have safari set for default. But I don't think that's the problem, 
> because if I hardcode the string there is no problem.
> I'm certainly missing something, but the culprit operation seems to be the 
> string parsing, not the browser rendering:
>
> titles = [title.strip() for title in titles.split('|')]
>
> Miguel 
>  


[web2py] Re: changelog

2012-03-27 Thread Massimo Di Pierro
My bad. The header should have been 1.99.5-1.99.7. The change log is the 
same. .7 was released two days after .4 to fix some bugs but no new 
features.


On Tuesday, 27 March 2012 12:59:21 UTC-5, Derek wrote:
>
> The link right on the download page.
>
> http://web2py.com/examples/default/download
>
>
> http://web2py.com/examples/default/changelog
>
>
> On Tuesday, March 27, 2012 7:10:34 AM UTC-7, Massimo Di Pierro wrote:
>>
>> Where are you looking for the changelog?
>>
>> On Tuesday, 27 March 2012 02:09:45 UTC-5, RyanTheLeach wrote:
>>>
>>> Just a heads up, the current stable version according to the download 
>>> site is 1.99.7 but the changelog only goes up to 1.99.5 :S 
>>
>>

[web2py] Re: Date field mask or another value

2012-03-27 Thread Massimo Di Pierro
Does it need to be a date field? It not have a day so it will create some 
problems. You can make it a string field

Field('A0514_DT_FIN',requires=IS_EMPTY_OR(IS_MATCH('\d{6}')))




On Tuesday, 27 March 2012 10:05:11 UTC-5, Adriano Almeida wrote:
>
> Hi, 
>
> I want a field (may be string,date or number, no prob) to have a 
> format of MM (valid year and month) or if it is left null, to be 
> 99. How Could I accomplished that? 
>
> I have tried : 
> Field('A0514_DT_FIN','date',notnull=True, label= 'Dt Fim (MM)', 
> default= '99') 
>
> and then the check: 
> db.tb0514_bihc_consultor_nivel.A0514_DT_FIN.requires = 
> IS_EMPTY_OR(IS_DATE(format=T('%Y%m'), error_message='formato deve ser 
> MM! ou vazio')) 
>
> It does not work as 99 is not a valid month and  is not a valid 
> year. 
>
> Any ideas? 
>
>

Re: [web2py] Re: Fake_migrate with auth

2012-03-27 Thread Richard Vézina
I think the best way to avoid this is to define custom auth tables and then
set them to migrate=false.

Richard

On Tue, Mar 27, 2012 at 1:40 PM, Bruce Wade  wrote:

> Tried fake_migrate_all which allowed the page to loaded. However now when
> I try to login I get an error that auth_user.username doesn't exist. When I
> go to the database administration in admin, I get the following error when
> clicking on auth_user,
>
>  current transaction is aborted, commands
> ignored until end of transaction block
>
> On Tue, Mar 27, 2012 at 10:27 AM, Bruce Wade  wrote:
>
>> How do I do a fake_migrate with the auth table so I don't get the following 
>> error? I know the table exists already I just pushed some major changes to 
>> my server and now when I run the app I get the tables already exists error. 
>> I really don't want to have to delete that table again, consider I have 
>> hundred people testing the site..
>>
>> relation "auth_group" already exists
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.warplydesigned.com
>> http://www.fitnessfriendsfinder.com
>>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>


Re: [web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Miguel Lopes
No dia 27 de Mar de 2012 17:46, "Derek"  escreveu:
>
> Check the meta tag - if it's UTF-8, that's most likely the issue.  You
can try ISO-8859-1 and see if that works for you.
>
Txs. Will also check that.


Re: [web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Miguel Lopes
No dia 27 de Mar de 2012 17:41, "Derek"  escreveu:
>
> What's the character set in your browser?
>
I have safari set for default. But I don't think that's the problem,
because if I hardcode the string there is no problem.
I'm certainly missing something, but the culprit operation seems to be the
string parsing, not the browser rendering:

titles = [title.strip() for title in titles.split('|')]

Miguel


[web2py] Re: changelog

2012-03-27 Thread Derek
The link right on the download page.

http://web2py.com/examples/default/download


http://web2py.com/examples/default/changelog


On Tuesday, March 27, 2012 7:10:34 AM UTC-7, Massimo Di Pierro wrote:
>
> Where are you looking for the changelog?
>
> On Tuesday, 27 March 2012 02:09:45 UTC-5, RyanTheLeach wrote:
>>
>> Just a heads up, the current stable version according to the download 
>> site is 1.99.7 but the changelog only goes up to 1.99.5 :S 
>
>

[web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Derek
Sorry, I am slow today. your "meta charset" tag in your layout - it's in 
the header. If it's UTF-8, it's wrong.

On Tuesday, March 27, 2012 10:46:27 AM UTC-7, Derek wrote:
>
> Check the meta tag - if it's UTF-8, that's most likely the issue.  You can 
> try ISO-8859-1 and see if that works for you.
>
> On Tuesday, March 27, 2012 10:41:53 AM UTC-7, Derek wrote:
>>
>> What's the character set in your browser?
>>
>> On Tuesday, March 27, 2012 9:13:14 AM UTC-7, miguel wrote:
>>>
>>> This is not strictly a web2py issue. Though it is a problem that apps 
>>> dealing with some character sets must deal with.
>>> I confess that the source of my problem is that I have been delaying 
>>> reading-up on encoding and decoding far too long. But I'm pressed for time 
>>> and I'm sure that this is a simple issue to many of you.
>>>
>>> Here's is it (slightly embarrassed):
>>>
>>> It works if I hardcode a string in a script helper:
>>>
>>> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=['olá', 
>>> 'olé']);})" % dict(...images=images), _language='javascript')
>>>
>>> It also works if (getting titles from the db, where it is stored as 
>>> "'olá','olé'" - note single quotes included):
>>>
>>> SCRIPT(" ... 
>>> jQuery.prettyPhoto.open(images=%(images)s,titles=[%(titles)]);})" % 
>>> dict(images=images, titles=titles), _language='javascript')
>>>
>>> However, if I try to parse from the db (where titles is stored as 
>>> "olá|olé", such as:
>>> titles = [title.strip() for title in titles.split('|')]
>>>
>>> The jQuery string is adequately adjusted to receive a list:
>>> SCRIPT(" ... 
>>> jQuery.prettyPhoto.open(images=%(images)s,titles=%(titles));})" 
>>> % dict(images=images, titles=titles), _language='javascript')
>>>
>>> All works but when rendered by the browser I do not get: Olá  instead I 
>>> get: olá
>>> The same for Olé and olé
>>>
>>> My goal is to have a user supplied string, such as: olá|olé
>>>
>>> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is 
>>> awesome :-)
>>>
>>> Txs for the help,
>>> Miguel
>>>
>>

[web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Derek
Check the meta tag - if it's UTF-8, that's most likely the issue.  You can 
try ISO-8859-1 and see if that works for you.

On Tuesday, March 27, 2012 10:41:53 AM UTC-7, Derek wrote:
>
> What's the character set in your browser?
>
> On Tuesday, March 27, 2012 9:13:14 AM UTC-7, miguel wrote:
>>
>> This is not strictly a web2py issue. Though it is a problem that apps 
>> dealing with some character sets must deal with.
>> I confess that the source of my problem is that I have been delaying 
>> reading-up on encoding and decoding far too long. But I'm pressed for time 
>> and I'm sure that this is a simple issue to many of you.
>>
>> Here's is it (slightly embarrassed):
>>
>> It works if I hardcode a string in a script helper:
>>
>> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=['olá', 
>> 'olé']);})" % dict(...images=images), _language='javascript')
>>
>> It also works if (getting titles from the db, where it is stored as 
>> "'olá','olé'" - note single quotes included):
>>
>> SCRIPT(" ... 
>> jQuery.prettyPhoto.open(images=%(images)s,titles=[%(titles)]);})" % 
>> dict(images=images, titles=titles), _language='javascript')
>>
>> However, if I try to parse from the db (where titles is stored as 
>> "olá|olé", such as:
>> titles = [title.strip() for title in titles.split('|')]
>>
>> The jQuery string is adequately adjusted to receive a list:
>> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=%(titles));})" 
>> % dict(images=images, titles=titles), _language='javascript')
>>
>> All works but when rendered by the browser I do not get: Olá  instead I 
>> get: olá
>> The same for Olé and olé
>>
>> My goal is to have a user supplied string, such as: olá|olé
>>
>> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is 
>> awesome :-)
>>
>> Txs for the help,
>> Miguel
>>
>

[web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Derek
What's the character set in your browser?

On Tuesday, March 27, 2012 9:13:14 AM UTC-7, miguel wrote:
>
> This is not strictly a web2py issue. Though it is a problem that apps 
> dealing with some character sets must deal with.
> I confess that the source of my problem is that I have been delaying 
> reading-up on encoding and decoding far too long. But I'm pressed for time 
> and I'm sure that this is a simple issue to many of you.
>
> Here's is it (slightly embarrassed):
>
> It works if I hardcode a string in a script helper:
>
> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=['olá', 
> 'olé']);})" % dict(...images=images), _language='javascript')
>
> It also works if (getting titles from the db, where it is stored as 
> "'olá','olé'" - note single quotes included):
>
> SCRIPT(" ... 
> jQuery.prettyPhoto.open(images=%(images)s,titles=[%(titles)]);})" % 
> dict(images=images, titles=titles), _language='javascript')
>
> However, if I try to parse from the db (where titles is stored as 
> "olá|olé", such as:
> titles = [title.strip() for title in titles.split('|')]
>
> The jQuery string is adequately adjusted to receive a list:
> SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=%(titles));})" 
> % dict(images=images, titles=titles), _language='javascript')
>
> All works but when rendered by the browser I do not get: Olá  instead I 
> get: olá
> The same for Olé and olé
>
> My goal is to have a user supplied string, such as: olá|olé
>
> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is 
> awesome :-)
>
> Txs for the help,
> Miguel
>


[web2py] Re: Fake_migrate with auth

2012-03-27 Thread Bruce Wade
Tried fake_migrate_all which allowed the page to loaded. However now when I
try to login I get an error that auth_user.username doesn't exist. When I
go to the database administration in admin, I get the following error when
clicking on auth_user,

 current transaction is aborted, commands
ignored until end of transaction block
On Tue, Mar 27, 2012 at 10:27 AM, Bruce Wade  wrote:

> How do I do a fake_migrate with the auth table so I don't get the following 
> error? I know the table exists already I just pushed some major changes to my 
> server and now when I run the app I get the tables already exists error. I 
> really don't want to have to delete that table again, consider I have hundred 
> people testing the site..
>
> relation "auth_group" already exists
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.warplydesigned.com
> http://www.fitnessfriendsfinder.com
>



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


[web2py] Fake_migrate with auth

2012-03-27 Thread Bruce Wade
How do I do a fake_migrate with the auth table so I don't get the
following error? I know the table exists already I just pushed some
major changes to my server and now when I run the app I get the tables
already exists error. I really don't want to have to delete that table
again, consider I have hundred people testing the site..

relation "auth_group" already exists


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


[web2py] Re: sqlite to postgres

2012-03-27 Thread nick name
On Tuesday, March 27, 2012 11:26:17 AM UTC-4, Marco Tulio wrote:
>
> How do I get the data that was on my app (on the sqlite database).


Web2py comes with scripts/cpdb.py, which copies databases from one 
connection string to another with lots of other goodies.

see 
http://web2py.com/books/default/chapter/29/6#Copy-data-from-one-db-into-another 
(if it doesn't get you to the right place, look for "cpdb" in the page)


[web2py] Re: problem with encoding in javascript from the server

2012-03-27 Thread Miguel Lopes
No dia 27 de Mar de 2012 16:13, "Miguel Lopes" 
escreveu:
>
>
> BTW this is a prettyPhoto widget I developed for plugin_wiki, which is
awesome :-)
>

I mean plugin_wiki is awesome :-)
lol


[web2py] problem with encoding in javascript from the server

2012-03-27 Thread Miguel Lopes
This is not strictly a web2py issue. Though it is a problem that apps
dealing with some character sets must deal with.
I confess that the source of my problem is that I have been delaying
reading-up on encoding and decoding far too long. But I'm pressed for time
and I'm sure that this is a simple issue to many of you.

Here's is it (slightly embarrassed):

It works if I hardcode a string in a script helper:

SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=['olá',
'olé']);})" % dict(...images=images), _language='javascript')

It also works if (getting titles from the db, where it is stored as
"'olá','olé'" - note single quotes included):

SCRIPT(" ...
jQuery.prettyPhoto.open(images=%(images)s,titles=[%(titles)]);})" %
dict(images=images, titles=titles), _language='javascript')

However, if I try to parse from the db (where titles is stored as "olá|olé",
such as:
titles = [title.strip() for title in titles.split('|')]

The jQuery string is adequately adjusted to receive a list:
SCRIPT(" ... jQuery.prettyPhoto.open(images=%(images)s,titles=%(titles));})"
% dict(images=images, titles=titles), _language='javascript')

All works but when rendered by the browser I do not get: Olá  instead I
get: olá
The same for Olé and olé

My goal is to have a user supplied string, such as: olá|olé

BTW this is a prettyPhoto widget I developed for plugin_wiki, which is
awesome :-)

Txs for the help,
Miguel


Re: [web2py] Re: Customizing a widget

2012-03-27 Thread Larry G. Wapnitsky

Thank you, Bruno and Anthony.   Perfect.

On 3/27/2012 12:06 PM, Anthony wrote:

You can use a dictionary, list of tuples, or a separate "labels" argument:

IS_IN_SET({'b':'black', 'w':'white'})
IS_IN_SET([('b', 'black'), ('w', 'white')])
IS_IN_SET(['b', 'w'], labels=['black', 'white'])

Anthony

On Tuesday, March 27, 2012 11:56:48 AM UTC-4, Larry Wapnitsky wrote:

Forgive my N00b-ness - not a web developer (but I've said that before)

I have the following code in an app I'm writing:

Field('b_or_w', 'string', length=1,
widget=SQLFORM.widgets.radio.widget,
requires=IS_IN_SET(['b','w']), default='b')

How do I customize this so that, instead of *b* and *w* appearing
on my form, I can get *black* and *white*, but the former is what
is entered into my database?

(clear as mud, right?)

Thanks,
Larry



[web2py] Re: sqlite to postgres

2012-03-27 Thread Anthony
http://web2py.com/books/default/chapter/29/6#CSV-(all-tables-at-once)


On Tuesday, March 27, 2012 11:26:17 AM UTC-4, Marco Tulio wrote:
>
> Hi!
>
> I was using sqlite as my database for a few projects, but decided to go to 
> postgres.
>
> While to web2py going from one to another is pretty much a connection 
> string that you'll change, there's still one problem remaining. 
>
> How do I get the data that was on my app (on the sqlite database). 
>
> On a small application, I managed to do that by exporting a csv file on 
> the old app and importing it on the new one. And that's it. 
>
> But I have another app that has quite a few tables now... wich means that 
> I'd have to copy several cvs and import them. 
>
> Question is: isn't there an easier way to do it? (to backup a sqlite 
> database and restore it as postgres in one piece?)
>
> If there isn't, that means that worst case scenario, I'll have to 
> export/import csv's corresponding to my tables. I can do that... 
> but there really isn't another way ?
>
> Thanks!
> -- 
> []'s
> Marco Tulio
>
>

[web2py] Re: Customizing a widget

2012-03-27 Thread Anthony
You can use a dictionary, list of tuples, or a separate "labels" argument:

IS_IN_SET({'b':'black', 'w':'white'})
IS_IN_SET([('b', 'black'), ('w', 'white')])
IS_IN_SET(['b', 'w'], labels=['black', 'white'])

Anthony

On Tuesday, March 27, 2012 11:56:48 AM UTC-4, Larry Wapnitsky wrote:
>
> Forgive my N00b-ness - not a web developer (but I've said that before)
>
> I have the following code in an app I'm writing:
>
> Field('b_or_w', 'string', length=1, widget=SQLFORM.widgets.radio.widget, 
> requires=IS_IN_SET(['b','w']), default='b')
>
> How do I customize this so that, instead of *b* and *w* appearing on my 
> form, I can get *black* and *white*, but the former is what is entered 
> into my database?
>
> (clear as mud, right?)
>
> Thanks,
> Larry
>


Re: [web2py] Customizing a widget

2012-03-27 Thread Bruno Rocha
Field('b_or_w', 'string', length=1, widget=SQLFORM.widgets.radio.widget,
requires=IS_IN_SET(*[('b', 'black'),('w', 'white')]*), default='b')

On Tue, Mar 27, 2012 at 12:56 PM, Larry Wapnitsky  wrote:

> Field('b_or_w', 'string', length=1, widget=SQLFORM.widgets.radio.widget,
> requires=IS_IN_SET(['b','w']), default='b')
>



-- 

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


Re: [web2py] Re: executing javascript after accepting a form

2012-03-27 Thread José Luis Redrejo Rodríguez
It works perfectly. Thanks very much Anthony.

Sushant: I didn't want to change my code to an ajax form. I wanted to
keep it the way it was. Thanks for your suggestion anyway.

Regards.

2012/3/27 Anthony :
> Yes, response.js only works for requests for components (made via a
> client-side call to web2py_ajax_page(), which is called when you use the
> LOAD helper in the view). You might try something like this:
>
> def index():
>     ...
>     if form.accepts(request.vars):
>         js = SCRIPT('$(function() {$("#dialog-message").dialog({modal:
> true});});', _type='text/javascript')
>     else:
>         js = ''
>     ...
>     return dict(form=form, js=js)
>
> and then somewhere in your index.html view:
>
> {{=js}}
>
> Anthony
>
>
> On Tuesday, March 27, 2012 8:31:14 AM UTC-4, José L. wrote:
>>
>> Hi, I'm having problems trying to show a modal window after the user
>> submits correctly a form.
>> I've tried to do it with:
>>
>> def index():
>> 
>>         if form.accepts(request.vars):
>>             response.js='$( "#dialog-message" ).dialog({ modal: true
>> });'
>> ...
>>
>> being #dialog-message a div in the same index.html page, but response.js
>> doesn't do anything, and it seems to work only inside componentes.
>>
>> Any idea to get this funcionality working?
>> Thanks.


Re: [web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread Jonathan Lundell
On Mar 27, 2012, at 7:35 AM, Anthony wrote:
> Routes looks OK -- is that the entire routes.py file? Any app-specific routes?

It does look OK, though keep in mind that setting the default a/c/f in a 
parametric router is subtly different from setting them outside the router.

Do you get any more information in the invalid-request messages? They've been 
enhanced (mostly, anyway) to give some indication of just what was invalid 
about them.

> 
> Anthony
> 
> On Tuesday, March 27, 2012 7:46:02 AM UTC-4, vtgorilla wrote:
> I just launched it this morning: http://RosterBrain.com 
> 
> I was having a lot of trouble getting routes.py to work with my form 
> submits so I just stripped it for the time being. Is there anything 
> wrong with the following syntax? 
> 
> routers = dict( 
> BASE = dict( 
> default_application = 'welcome', 
> default_controller = 'default', 
> default_function = 'index' 
> ) 
> ) 
> 
> This would sporadically give me invalid requests on form submits and 
> when using the admin interface. Any ideas? 




[web2py] Customizing a widget

2012-03-27 Thread Larry Wapnitsky
Forgive my N00b-ness - not a web developer (but I've said that before)

I have the following code in an app I'm writing:

Field('b_or_w', 'string', length=1, widget=SQLFORM.widgets.radio.widget, 
requires=IS_IN_SET(['b','w']), default='b')

How do I customize this so that, instead of *b* and *w* appearing on my 
form, I can get *black* and *white*, but the former is what is entered into 
my database?

(clear as mud, right?)

Thanks,
Larry


[web2py] sqlite to postgres

2012-03-27 Thread Marco Tulio Cicero de M. Porto
Hi!

I was using sqlite as my database for a few projects, but decided to go to
postgres.

While to web2py going from one to another is pretty much a connection
string that you'll change, there's still one problem remaining.

How do I get the data that was on my app (on the sqlite database).

On a small application, I managed to do that by exporting a csv file on the
old app and importing it on the new one. And that's it.

But I have another app that has quite a few tables now... wich means that
I'd have to copy several cvs and import them.

Question is: isn't there an easier way to do it? (to backup a sqlite
database and restore it as postgres in one piece?)

If there isn't, that means that worst case scenario, I'll have to
export/import csv's corresponding to my tables. I can do that...
but there really isn't another way ?

Thanks!
-- 
[]'s
Marco Tulio


[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread Anthony

>
> I kept having trouble after I took the routes.py out, and I think my 
> issue was that web2py wasn't always figuring out my 
> redirect(URL('pagename'))'s correctly. I explicitly added in the app 
> and controller names to all the redirects and it solved whatever was 
> happening.


When you do URL('pagename') it takes 'pagename' as the function and assumes 
the current request.application and request.controller as the application 
and controller (it does *not* assume the default application and controller 
as specified in routes.py). If you're staying with the same app, you can 
safely exclude the app from URL(), but it's generally safest to include the 
controller (makes it easier to understand the code as well).

Anthony 


[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread vtgorilla
That was the entire file. I only have the one public facing app, so I
didn't try to do anything fancy with it yet.

I kept having trouble after I took the routes.py out, and I think my
issue was that web2py wasn't always figuring out my
redirect(URL('pagename'))'s correctly. I explicitly added in the app
and controller names to all the redirects and it solved whatever was
happening.

I had it up for testing on FluxFlex with no problem, but I have it on
WebFaction now and that's when the issues started.

Thanks for adding to the poweredby site! It's famous now!

On Mar 27, 10:35 am, Anthony  wrote:
> Nice. Just added tohttp://web2py.com/poweredby.
>
> Routes looks OK -- is that the entire routes.py file? Any app-specific
> routes?
>
> Anthony
>
>
>
>
>
>
>
> On Tuesday, March 27, 2012 7:46:02 AM UTC-4, vtgorilla wrote:
>
> > I just launched it this morning:http://RosterBrain.com
>
> > I was having a lot of trouble getting routes.py to work with my form
> > submits so I just stripped it for the time being. Is there anything
> > wrong with the following syntax?
>
> > routers = dict(
> >     BASE = dict(
> >         default_application = 'welcome',
> >         default_controller = 'default',
> >         default_function = 'index'
> >     )
> > )
>
> > This would sporadically give me invalid requests on form submits and
> > when using the admin interface. Any ideas?
>
> > Thanks,
> > Brad


[web2py] Re: Problem with GAE and Cloud SQL

2012-03-27 Thread Anthony
Can you submit an issue about 
this: http://code.google.com/p/web2py/issues/list

Anthony

On Tuesday, March 27, 2012 5:41:55 AM UTC-4, Matt wrote:
>
> I've managed to figure out a solution. (Not sure if it's 100% correct 
> though but it seems to work fine).
>
> The GoogleSqlAdapter needs the following change:
>
> class GoogleSQLAdapter(UseDatabaseStoredFile,MySQLAdapter):
> uploads_in_blob = True
>
> Hope this helps somebody else.
>
> Matt
>
> On Tuesday, 27 March 2012 11:21:57 UTC+13, Matt wrote:
>>
>> Hi there,
>>
>> I'm trying to install a web2py application on GAE using Cloud SQL.
>>
>> When I try and submit a form that contains an upload field I get the 
>> following exception:
>>
>> dal.py", line 6124, in store os.makedirs(path)
>> AttributeError: 'module' object has no attribute 'makedirs'
>>
>> I'm currently running on web2py-1.99.7-stable.
>>
>> Any suggestions in fix this or is this a bug with the combination of GAE 
>> and Cloud SQL?
>>
>> Thanks in advance,
>> Matt
>>
>

[web2py] Re: difference between

2012-03-27 Thread Anthony
On Tuesday, March 27, 2012 1:46:50 AM UTC-4, weheh wrote:
>
> Ouch, ouch, ouch ... that causes things to really disintegrate! I tend 
> to agree with your assessment that there's an order dependence 
> somewhere. But I don't see it, yet.
>

I think your URL function is wrong -- URL('static', 'js', script) assumes 
'static' is the app, 'js' is the controller, and script is the function. 
Instead, try:

URL('static', 'js%s' % script)

Actually, for readability, I would do 'js/%s' and remove the leading '/' 
from your script values.

Anthony
 


[web2py] Date field mask or another value

2012-03-27 Thread Adriano Almeida
Hi,

I want a field (may be string,date or number, no prob) to have a
format of MM (valid year and month) or if it is left null, to be
99. How Could I accomplished that?

I have tried :
Field('A0514_DT_FIN','date',notnull=True, label= 'Dt Fim (MM)',
default= '99')

and then the check:
db.tb0514_bihc_consultor_nivel.A0514_DT_FIN.requires =
IS_EMPTY_OR(IS_DATE(format=T('%Y%m'), error_message='formato deve ser
MM! ou vazio'))

It does not work as 99 is not a valid month and  is not a valid
year.

Any ideas?



[web2py] Re: executing javascript after accepting a form

2012-03-27 Thread Anthony
Yes, response.js only works for requests for components (made via a 
client-side call to web2py_ajax_page(), which is called when you use the 
LOAD helper in the view). You might try something like this:

def index():
...
if form.accepts(request.vars):
js = SCRIPT('$(function() {$("#dialog-message").dialog({modal: 
true});});', _type='text/javascript')
else:
js = ''
...
return dict(form=form, js=js)

and then somewhere in your index.html view:

{{=js}}

Anthony

On Tuesday, March 27, 2012 8:31:14 AM UTC-4, José L. wrote:
>
> Hi, I'm having problems trying to show a modal window after the user 
> submits correctly a form.
> I've tried to do it with:
>
> def index():
> 
> if form.accepts(request.vars):
> response.js='$( "#dialog-message" ).dialog({ modal: true   });'
> ...
>
> being #dialog-message a div in the same index.html page, but response.js 
> doesn't do anything, and it seems to work only inside componentes.
>
> Any idea to get this funcionality working?
> Thanks.
>


[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread Anthony

>
> I want something like this to work, but it doesn't, obviously. 
>
> def logout(): 
> auth.logout() 
> response.js = 'alert("goodbye world");' 
> from gluon import HTTP 
> HTTP(202) 
> return dict() 
>
> I've also tried auth.settings.logout_onlogout = [onlogoutfunction] 
> but that's not working for me either.


auth.logout() does a redirect, so the above won't make it to your HTTP(202) 
call. Also, response.js only works for Ajax requests for components (i.e., 
client-side calls to web2py_ajax_page(), which is what the LOAD helper 
does).

How is the logout request made from the browser? If it is a regular full 
page request, your controller needs to return a full page (probably via the 
typical post-logout redirect), and that page then needs to include the 
relevant JS code (e.g., in a 

[web2py] Re: executing javascript after accepting a form

2012-03-27 Thread Sushant Taneja
Hi,

If you are submitting your form via ajax then you can use eval to call a JS 
function.
You can check out the syntax here : 
http://web2py.com/books/default/chapter/29/11#Eval-target

create a JS function 
showDialog(){

// write code here
}

in the controller write the return statement as :

return "showDialog()"

Hope it helps !


On Tuesday, March 27, 2012 6:01:14 PM UTC+5:30, José L. wrote:
>
> Hi, I'm having problems trying to show a modal window after the user 
> submits correctly a form.
> I've tried to do it with:
>
> def index():
> 
> if form.accepts(request.vars):
> response.js='$( "#dialog-message" ).dialog({ modal: true   });'
> ...
>
> being #dialog-message a div in the same index.html page, but response.js 
> doesn't do anything, and it seems to work only inside componentes.
>
> Any idea to get this funcionality working?
> Thanks.
>


[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread Anthony
Nice. Just added to http://web2py.com/poweredby.

Routes looks OK -- is that the entire routes.py file? Any app-specific 
routes?

Anthony

On Tuesday, March 27, 2012 7:46:02 AM UTC-4, vtgorilla wrote:
>
> I just launched it this morning: http://RosterBrain.com 
>
> I was having a lot of trouble getting routes.py to work with my form 
> submits so I just stripped it for the time being. Is there anything 
> wrong with the following syntax? 
>
> routers = dict( 
> BASE = dict( 
> default_application = 'welcome', 
> default_controller = 'default', 
> default_function = 'index' 
> ) 
> ) 
>
> This would sporadically give me invalid requests on form submits and 
> when using the admin interface. Any ideas? 
>
> Thanks, 
> Brad



[web2py] Re: DAL Challenge

2012-03-27 Thread Udi Milo
Thanks!

I'm trying to follow the logic of your suggestion all the way to rendering 
it, tell me if you have a better idea:
once I hold the list of articles I want to show, I run over the list and 
get all the comment ids, I issue a large query with the ids of all comments 
for all articles together, pass it to the view as a large dictionary that 
has a key of article id and value list of comments and use it like that?


On Tuesday, March 27, 2012 6:11:46 AM UTC-4, Wikus van de Merwe wrote:
>
> When working with GAE datastore you want to execute minimum number of 
> queries necessary to avoid delays and
> limit the use of DB API calls. Fetching comments one by one is not the 
> best option then (even if done with ajax).
>
> Probably the most efficient way would be to store the list of comment ids 
> as an attribute of each article entity. Then
> you could get all comment ids with a single query. Having the ids you 
> could build a list of GAE keys, and fetch all
> needed comment entities at once. We discussed that recently here:
> https://groups.google.com/d/topic/web2py/7dvo_jqIR38/discussion
>
> I'm also guessing that this might be quite common GAE use case and you 
> might find a better solution already optimised
> for this on GAE forum. The other option is to show comments only on the 
> article individual page (not on the list of articles).
>
> If you use the wrapper for caching, then you could memorize the entire 
> response, so this is very efficient as the views
> are not rendered but read straight from cache. If you need some extra 
> parametrisation inside the controller you could
> either move some of the code to a separate function which output is cached 
> or simply cache only the queries:
> http://web2py.com/books/default/chapter/29/6#Caching-selects
>
>

[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread Massimo Di Pierro
:-)

On Tuesday, 27 March 2012 06:46:02 UTC-5, vtgorilla wrote:
>
> I just launched it this morning: http://RosterBrain.com 
>
> I was having a lot of trouble getting routes.py to work with my form 
> submits so I just stripped it for the time being. Is there anything 
> wrong with the following syntax? 
>
> routers = dict( 
> BASE = dict( 
> default_application = 'welcome', 
> default_controller = 'default', 
> default_function = 'index' 
> ) 
> ) 
>
> This would sporadically give me invalid requests on form submits and 
> when using the admin interface. Any ideas? 
>
> Thanks, 
> Brad



[web2py] Re: Indentation Error in web2py web file editor

2012-03-27 Thread Massimo Di Pierro
This should have been fixed with the new web editor.

On Tuesday, 27 March 2012 06:00:08 UTC-5, gubbanoa wrote:
>
> Version 1.99.1 (2011-09-22 16:59:24) stable
>
>

[web2py] Re: DAL Challenge

2012-03-27 Thread Massimo Di Pierro
I guess we could modify the cache object to to this automagically. Open a 
ticket about it.

On Monday, 26 March 2012 17:57:15 UTC-5, Udi Milo wrote:
>
> Hi guys,
>
> I have an entity called article.
> I want to build the ability to comment on each article. comment at least 
> need (created_on, user_id, article_id, text)
> I'm running on GAE.
>
> On my index page I'm showing 30-60 articles and I want each article to 
> have its comments showing. how would you do it?
> a. sending the data when the page loads? if so, how? DAL or DAL + cache?
> b. load without it and use ajax to call each item separately?
>
> also, a random cache question:
>
> @cache('key',5)
> function test(x):
>return x
>
> Can I somehow get my parameter x into the key?
>


[web2py] Re: web2py 1.99.7 is OUT

2012-03-27 Thread Massimo Di Pierro
Have you checked trunk or the nightly built. I believe this was fixed?

On Tuesday, 27 March 2012 03:56:35 UTC-5, IVINH wrote:
>
>
>
> In my app, LOAD not work fine with 1.99.7, i'm try a test:
> 1. copy my view (contain js script), example: index.html to index.load
> 2. run :  .../index.html and then .../index.load
>
> Both work well with the 1.99.4, but the second was not correct with 1.99.7
> I think this is problem of extension .html & .load
>  
>
>
> Vào 11:00:15 UTC+7 Thứ ba, ngày 27 tháng ba năm 2012, Anthony đã viết:
>>
>> Can you describe the problem? Is the below view the index.load view? What 
>> is in plugin_app/layout.html? Should that be extended rather than included?
>>
>> Anthony
>>
>> On Monday, March 26, 2012 11:23:34 PM UTC-4, IVINH wrote:
>>>
>>>
>>>
>>> I have two views similar but different extension (index.html & index.
>>> load).
>>> Both work well with the 1.99.4, but index.load was not for 1.99.7?
>>>
>>> My view:
>>>
>>> {{include 'plugin_app/layout.html'}}
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pieRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.donutRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> href="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.css')}}"
>>>  
>>> rel="stylesheet" type="text/css" />
>>>
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.barRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.categoryAxisRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pointLabels.min.js')}}"
>>>  
>>> type="text/javascript">
>>>
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasTextRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>>
>>> 
>>> {{=content}}
>>> 
>>>
>>>
>>>
>>>
>>>  
>>>
>>> Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di Pierro 
>>> đã viết:

 Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
 compatibility issues.

 Massimo

>>>
>>> Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di Pierro 
>>> đã viết:

 Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
 compatibility issues.

 Massimo

>>>

[web2py] Re: web2py 1.99.7 is OUT

2012-03-27 Thread Massimo Di Pierro
Please check trunk. I believe this was fixed.

On Tuesday, 27 March 2012 03:56:35 UTC-5, IVINH wrote:
>
>
>
> In my app, LOAD not work fine with 1.99.7, i'm try a test:
> 1. copy my view (contain js script), example: index.html to index.load
> 2. run :  .../index.html and then .../index.load
>
> Both work well with the 1.99.4, but the second was not correct with 1.99.7
> I think this is problem of extension .html & .load
>  
>
>
> Vào 11:00:15 UTC+7 Thứ ba, ngày 27 tháng ba năm 2012, Anthony đã viết:
>>
>> Can you describe the problem? Is the below view the index.load view? What 
>> is in plugin_app/layout.html? Should that be extended rather than included?
>>
>> Anthony
>>
>> On Monday, March 26, 2012 11:23:34 PM UTC-4, IVINH wrote:
>>>
>>>
>>>
>>> I have two views similar but different extension (index.html & index.
>>> load).
>>> Both work well with the 1.99.4, but index.load was not for 1.99.7?
>>>
>>> My view:
>>>
>>> {{include 'plugin_app/layout.html'}}
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pieRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.donutRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> href="{{=URL(r=request,c='static',f='plugin_chart/jqplot/jquery.jqplot.css')}}"
>>>  
>>> rel="stylesheet" type="text/css" />
>>>
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.barRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.categoryAxisRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.pointLabels.min.js')}}"
>>>  
>>> type="text/javascript">
>>>
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasTextRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>> >> src="{{=URL(r=request,c='static',f='plugin_chart/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js')}}"
>>>  
>>> type="text/javascript">
>>>
>>> 
>>> {{=content}}
>>> 
>>>
>>>
>>>
>>>
>>>  
>>>
>>> Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di Pierro 
>>> đã viết:

 Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
 compatibility issues.

 Massimo

>>>
>>> Vào 05:29:43 UTC+7 Thứ hai, ngày 05 tháng ba năm 2012, Massimo Di Pierro 
>>> đã viết:

 Same as 1.99.5 and 1.99.6 but should solve all the outstanding 
 compatibility issues.

 Massimo

>>>

[web2py] Re: changelog

2012-03-27 Thread Massimo Di Pierro
Where are you looking for the changelog?

On Tuesday, 27 March 2012 02:09:45 UTC-5, RyanTheLeach wrote:
>
> Just a heads up, the current stable version according to the download site 
> is 1.99.7 but the changelog only goes up to 1.99.5 :S 



[web2py] Re: how to get logout() to launch an ajax call

2012-03-27 Thread Massimo Di Pierro
I do not understand what you try to accomplish. What is this line supposed 
to do?
HTTP(202) 


On Tuesday, 27 March 2012 01:01:23 UTC-5, weheh wrote:
>
> I want something like this to work, but it doesn't, obviously. 
>
> def logout(): 
> auth.logout() 
> response.js = 'alert("goodbye world");' 
> from gluon import HTTP 
> HTTP(202) 
> return dict() 
>
> I've also tried auth.settings.logout_onlogout = [onlogoutfunction] 
> but that's not working for me either. 
>
> Can anyone shed light on this, please? Thanks.



[web2py] Re: How to Save Query in Session

2012-03-27 Thread Massimo Di Pierro
Sorry. Stupid me. I responded from my phone and I did not see your entire 
post.

Ignore my post and thanks for the recipe. :-)

Massimo

On Monday, 26 March 2012 22:47:24 UTC-5, Limedrop wrote:
>
> Huh? I'm sorry but I don't understand. 
>
> On Mar 27, 4:28 pm, Massimo Di Pierro  
> wrote: 
> > you cannot. 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Monday, 26 March 2012 21:09:49 UTC-5, Limedrop wrote: 
> > 
> > > Just in case any of you want to do this...I've written a routine that 
> > > enables you to save a Query/Expression object in the session. 
> > 
> > > I have a controller that uses a form to build a relatively complex 
> > > query and I want other controllers to use that query to generate 
> > > reports and graphs.  I initially explored saving the query in the 
> > > session as a string, but it just wasn't working for me so I bit the 
> > > bullet and wrote a seralization routine that takes a Query object and 
> > > extracts it into a dictionary strucuture.  There's another function 
> > > that does the reverse. 
> > 
> > > It's all here in this slice: 
> > >http://www.web2pyslices.com/slice/show/1489/save-query-in-session 
> > 
> > > It needs more testing for edge cases (I just don't know enough about 
> > > the DAL to do all of that).  I've written it as a module, but 
> > > ultimately it would be nice to have something like it as a method 
> > > within the gluon.dal.Query class itself?  Better yet, get the 
> > > framework to automatically invoke it when saving a Query/Expression to 
> > > session (like it does for rows).



[web2py] Re: How to allow Image Upload and Border Selection preview before saving to permanent table

2012-03-27 Thread mwk
Thanks Bruno,
The css sounds like a good choice and I use that for final display,
trick is I don't know how to get a preview/play around mode first.

Do I need to have one db.tablename for the image preview upload and
then another db.tablename for the final saved version?

Currently I have one db.table for storing the upload image and border
choice id, but i dont know how to get it so they can preview and play
around with borders first before saving it off.

I'm looking at an image preview uploader jquery plugin but I don't
know how to configure it on web2py.  It calls for some server settings
and only shows php sample
Would you mind taking a look and letting me know how to configure it
if you get a chance?

its here:  http://css-tricks.com/ajax-image-uploading/


Thanks a ton.

On Mar 27, 6:18 am, Bruno Rocha  wrote:
> There are many ways of doing that, one option is to overlay the image with
> the border images using CSS background clipping, so you can save the file
> and the ID of the border, so when you show this in view you choose the
> border dynamically.
>
> If you want to save the image with border on disk then you have to take a
> look at the PIL documentation.
>
> Another option is aviary APIhttp://www.aviary.com/web
>
> On Tue, Mar 27, 2012 at 10:04 AM, mwk  wrote:
> > Hi Massimo and All,
>
> > I want a user to be able to upload an image and choose a border to
> > surround it from a choice of images I have in the database.  I want
> > them to be able to play around and see what looks best to them before
> > saving their final border choice and uploaded image to the database.
> > I don't know how to do this.  Can someone please provide some sample
> > code that will get me going?
>
> > Thanks a bunch
> > Web2py_Superfan
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: Rocket errors on importing python library

2012-03-27 Thread Rohan
any updates?

On Monday, 26 March 2012 20:03:07 UTC+5:30, Rohan wrote:
>
> Web2py Version 1.99.7 (2012-03-04 22:12:08) stable
> Python 2.7.2+
>
> I am trying to load external library from python (
> http://pypi.python.org/pypi/readability-lxml/0.2.3)
>
> import urllib2
> import readability
> page = urllib2.urlopen(url)
> html = page.read()
>
> page is fetched properly but in my console I am getting Rocket errors. If 
> i comment 'import readability' or not use this lib then no rocket errors 
> are published.
>
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
> DEBUG:Rocket.Monitor:In "receive timed-out connections" loop.
> DEBUG:Rocket.Monitor:Received a timed out connection.
> DEBUG:Rocket.Monitor:Adding connection to monitor list.
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
> ...
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
> DEBUG:Rocket.Errors.ThreadPool:Examining ThreadPool. 10 threads and 0 Q'd 
> conxions
> ...
>
> and it get keep on printing same message over and over again. I have not 
> changed any values in rocket.py. 
>
> Is this expected and Is there any way I can disable this?  With this 
> continuous printing actual debug messages are getting lost, making dev 
> really hard.
>
>

Re: [web2py] How to allow Image Upload and Border Selection preview before saving to permanent table

2012-03-27 Thread Bruno Rocha
There are many ways of doing that, one option is to overlay the image with
the border images using CSS background clipping, so you can save the file
and the ID of the border, so when you show this in view you choose the
border dynamically.

If you want to save the image with border on disk then you have to take a
look at the PIL documentation.

Another option is aviary API http://www.aviary.com/web

On Tue, Mar 27, 2012 at 10:04 AM, mwk  wrote:

> Hi Massimo and All,
>
> I want a user to be able to upload an image and choose a border to
> surround it from a choice of images I have in the database.  I want
> them to be able to play around and see what looks best to them before
> saving their final border choice and uploaded image to the database.
> I don't know how to do this.  Can someone please provide some sample
> code that will get me going?
>
> Thanks a bunch
> Web2py_Superfan




-- 

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


[web2py] How to allow Image Upload and Border Selection preview before saving to permanent table

2012-03-27 Thread mwk
Hi Massimo and All,

I want a user to be able to upload an image and choose a border to
surround it from a choice of images I have in the database.  I want
them to be able to play around and see what looks best to them before
saving their final border choice and uploaded image to the database.
I don't know how to do this.  Can someone please provide some sample
code that will get me going?

Thanks a bunch
Web2py_Superfan


[web2py] Re: web2py file location

2012-03-27 Thread genesisk
Great!

Thank you Ron, and lyn2py for your help!



On Tuesday, March 27, 2012 4:19:22 PM UTC+9, Ron McOuat wrote:
>
> Have you done a right click on web2py.app and then Show Contents from the 
> pop up menu. You should see a Contents directory which you can now explore.



[web2py] Dotcloud now with support for websockets is += 1 service ?

2012-03-27 Thread smogzer
Hi folks,

I recently read about websockets and saw a video by Bruno Rocha showing the
use of comet and web2py and it seems like a technology with lots
of potential.
What i would like to know is that if it is possible to replace comet with
some server side service provided by dotcloud, so that web2py +
postgres/mongo + websockets == 2 services instead of 3, and therefore keep
prototyping apps right there on the free dotcloud account.

http://techcrunch.com/2012/03/27/open-paas-dotcloud-adds-support-for-websockets-vertical-scaling-and-more/

http://blog.dotcloud.com

Thanks in advance.


[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread vtgorilla
Yes, but I borrowed inspiration heavily from another design.

On Mar 27, 8:15 am, lyn2py  wrote:
> Very nice theme!
> Did you design it yourself?
>
>
>
>
>
>
>
> On Tuesday, March 27, 2012 7:46:02 PM UTC+8, vtgorilla wrote:
>
> > I just launched it this morning:http://RosterBrain.com
>
> > I was having a lot of trouble getting routes.py to work with my form
> > submits so I just stripped it for the time being. Is there anything
> > wrong with the following syntax?
>
> > routers = dict(
> >     BASE = dict(
> >         default_application = 'welcome',
> >         default_controller = 'default',
> >         default_function = 'index'
> >     )
> > )
>
> > This would sporadically give me invalid requests on form submits and
> > when using the admin interface. Any ideas?
>
> > Thanks,
> > Brad


[web2py] executing javascript after accepting a form

2012-03-27 Thread José L .
Hi, I'm having problems trying to show a modal window after the user 
submits correctly a form.
I've tried to do it with:

def index():

if form.accepts(request.vars):
response.js='$( "#dialog-message" ).dialog({ modal: true   });'
...

being #dialog-message a div in the same index.html page, but response.js 
doesn't do anything, and it seems to work only inside componentes.

Any idea to get this funcionality working?
Thanks.


[web2py] Re: Check out my new site! (also trouble with routes.py)

2012-03-27 Thread lyn2py
Very nice theme!
Did you design it yourself? 

On Tuesday, March 27, 2012 7:46:02 PM UTC+8, vtgorilla wrote:
>
> I just launched it this morning: http://RosterBrain.com 
>
> I was having a lot of trouble getting routes.py to work with my form 
> submits so I just stripped it for the time being. Is there anything 
> wrong with the following syntax? 
>
> routers = dict( 
> BASE = dict( 
> default_application = 'welcome', 
> default_controller = 'default', 
> default_function = 'index' 
> ) 
> ) 
>
> This would sporadically give me invalid requests on form submits and 
> when using the admin interface. Any ideas? 
>
> Thanks, 
> Brad



Re: [web2py] Check out my new site! (also trouble with routes.py)

2012-03-27 Thread Johann Spies
On 27 March 2012 13:46, vtgorilla  wrote:

> I just launched it this morning: http://RosterBrain.com
>
>
>

it looks impressive but you have got no rugby, cricket and tennis there!  :)

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: web2py file location

2012-03-27 Thread lyn2py
Specifically, /Programming/Python/web2py/applications/sample/

On Tuesday, March 27, 2012 12:35:40 PM UTC+8, genesisk wrote:
>
> I would think so too but I don't see any!
> Is there any other possibilities?
> Is it hidden somewhere?
>
> Please help me out
> Thanks.
>
>
>
> On Tuesday, March 27, 2012 11:52:47 AM UTC+9, lyn2py wrote:
>>
>> It would be /Programming/Python/web2py/
>
>

[web2py] Re: Using single instance of LibreOffice to convert documents - is this safe?

2012-03-27 Thread Cliff
Thanks Wilkus.

Further research this AM says Libre/Open Office does not multi-thread
well.

The scheduler is just what I need.

On Mar 27, 6:33 am, Wikus van de Merwe 
wrote:
> If this processing is done after the form submission you can delegate that
> to a background task.
> Having a queue of tasks end executing them one by one should solve the
> concurrent access
> problem. Check out the book section on 
> scheduler:http://web2py.com/books/default/chapter/29/4#Scheduler-%28experimenta...


[web2py] Check out my new site! (also trouble with routes.py)

2012-03-27 Thread vtgorilla
I just launched it this morning: http://RosterBrain.com

I was having a lot of trouble getting routes.py to work with my form
submits so I just stripped it for the time being. Is there anything
wrong with the following syntax?

routers = dict(
BASE = dict(
default_application = 'welcome',
default_controller = 'default',
default_function = 'index'
)
)

This would sporadically give me invalid requests on form submits and
when using the admin interface. Any ideas?

Thanks,
Brad


[web2py] Re: Indentation Error in web2py web file editor

2012-03-27 Thread gubbanoa
Version 1.99.1 (2011-09-22 16:59:24) stable



  1   2   >