[web2py] Re: web2py 2.17.1

2018-08-20 Thread Bob St John
I just downloaded 2.17.1 and it works great... thankyou!

However I am a bit confused with the pyDAL that came with it... _version_ = 
17.11
Same version 17.11 when I downloaded pyDAL using pip
Is this the latest pyDAL 18.08 only without the _version_ number updated?


On Sunday, August 5, 2018 at 6:12:25 PM UTC-7, Massimo Di Pierro wrote:
>
> Hello everybody,
>
> I released pyDAL 18.08 and web2py 2.17.1
> They mostly contain bug fixes as well as better support for python 3 and 
> bootstrap 4 by default.
> Thanks to all those who contributed!
>
> Please check them out and report any issue with them.
>
> I have a been a little slow checking this group because of lots of 
> traveling but I will do my best to catch up. :-)
>
> Massimo
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to solve vertical alignment too high of SQLForm read-only field

2016-11-30 Thread Bob St John
see also 
https://groups.google.com/forum/?fromgroups#!searchin/web2py/misaligned%7Csort:relevance/web2py/6Qbcr8nuey8/nVzxMOxxt_gJ

On Monday, November 21, 2016 at 7:42:54 AM UTC-8, Martin de Groot wrote:
>
> In a SQLForm all widget-controls of writable fields are nicely, correctly 
> vertically aligned with the preceding label.
>
> However, when one adds db.table.field.writable = False in the 
> contrller-action function the widget-control is correctly changed from an 
> input control to a read-only control, but the text of the field's value is 
> placed noticeably higher than the text of the preceding label.
>
> I have been looking into the html source code of the resulting page, to 
> see if I could figure out which style I could apply in an extra .css file 
> statement, but I cannot  find anything.
>
> I am sure many other users have observed this vertical alignment being too 
> high , especially if the text in the field is just on one line.
>
> I would very much appreciate it if anyone can suggest a solution for this. 
> Apart from making a custom form, which is a lot more work than using the 
> SQLForm generated code.
>
> Martin de Groot
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Looping over applications

2016-03-15 Thread Bob St John
This is not a problem, but I would like to confirm that this pseudo code is 
best practice.

I have a single instance of web2py (2.13.4) with multiple applications, 
each application has its own MySQL database.

'init' is my control application which I use for administration.

In 'init' I want to access each of the other applications' databases.


for each app in applications:
db_app = DAL(app_uri, pool_size=5, ...)
..
read/write to db_app
..
db_app.commit()
db_app.close()


During testing I stressed this loop without a problem:

for i in range(200):
for each app in applications:
db_app = DAL(app_uri, pool_size=5, ...)
..
read/write to db_app
..
db_app.commit()
db_app.close()

Without the db_app.close() it would fail by running out of connections.

Is there anything about this approach I should be concerned with? Will the 
db_app.close() affect other users in the applications?

Thank-you for your advice!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Form misalignment with bootstrap3_inline

2015-08-14 Thread Bob St John
Using web2py 2.12.2 with formstyle = bootstrap3_inline

Problem:
When displaying a SQLFORM with readonly=True the field labels and values do 
not line up horizontally. I have a screen image, but the following gives 
you an idea of what it looks like... 

Bob
First Name  # without fix (Note that the misalignment 
is exaggerated here..)

I added 2 lines of code (see #bob's fix below) to 
'formstyle_bootstrap3_inline_factory' in gluon/sqlhtml.py which solved this 
misalignment.

First Name  Bob # with fix


def formstyle_bootstrap3_inline_factory(col_label_size=3):
 bootstrap 3 horizontal form layout

Note:
Experimental!

def _inner(form, fields):
form.add_class('form-horizontal')
label_col_class = col-sm-%d % col_label_size
col_class = col-sm-%d % (12 - col_label_size)
offset_class = col-sm-offset-%d % col_label_size
parent = CAT()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class=col_class)
if isinstance(controls, INPUT):
if controls['_type'] == 'submit':
controls.add_class('btn btn-primary')
_controls = DIV(controls, _class=%s %s % (col_class, 
offset_class))
if controls['_type'] == 'button':
controls.add_class('btn btn-default')
elif controls['_type'] == 'file':
controls.add_class('input-file')
elif controls['_type'] in ('text', 'password'):
controls.add_class('form-control')
elif controls['_type'] == 'checkbox':
label['_for'] = None
label.insert(0, controls)
_controls = DIV(DIV(label, _help, _class=checkbox),
_class=%s %s % (offset_class, 
col_class))
label = ''
elif isinstance(controls, (SELECT, TEXTAREA)):
controls.add_class('form-control')

elif isinstance(controls, SPAN):
_controls = P(controls.components,
  _class=form-control-static %s % col_class)
elif isinstance(controls, UL):
for e in controls.elements(input):
e.add_class('form-control')
# bob's fix
elif controls is None or isinstance(controls, basestring):
_controls = P(controls, _class=form-control-static %s % 
col_class)
# end bob's fix
if isinstance(label, LABEL):
label['_class'] = 'control-label %s' % label_col_class

parent.append(DIV(label, _controls, _class='form-group', 
_id=id))
return parent
return _inner

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: sessions piling up

2015-08-13 Thread Bob St John


On Monday, August 10, 2015 at 8:44:40 AM UTC-7, Massimo Di Pierro wrote:

 You seem to have an old version of session2strash.py. The new one only 
 uses self.expiration and not expiration.

 On Sunday, 9 August 2015 10:15:57 UTC-5, Bob St John wrote:

 Using 2.12.1

 I run a small site... about 200 members who login (some using the 
 'Remember me for 30 days') plus about 1500 public visitors per day. The 
 sessions are stored in the file system. I run the sessions2trash.py script 
 once a day. I have noticed the sessions are increasing by about 1000 per 
 day which did not seem right. I made the following changes to trash() and 
 now the sessions remaining after being 'trashed' is about 200-300, which 
 seems correct. I think the problem was when a large expiration was saved 
 (30 days) and the next expired public sessions were not trashed


 CURRENT TRASH:
 def trash(self):
 Trash expired sessions.
 now = datetime.datetime.now()
 for item in self.get():
 status = 'OK'
 last_visit = item.last_visit_default()

 try:
 session = item.get()
 if session.auth:
 if session.auth.expiration and not self.force:
 self.expiration = session.auth.expiration
 if session.auth.last_visit:
 last_visit = session.auth.last_visit
 except:
 pass

 age = 0
 if last_visit:
 age = total_seconds(now - last_visit)

 if age  self.expiration or not self.expiration:
 item.delete()
 status = 'trashed'

 if self.verbose  1:
 print 'key: %s' % str(item)
 print 'expiration: %s seconds' % self.expiration
 print 'last visit: %s' % str(last_visit)
 print 'age: %s seconds' % age
 print 'status: %s' % status
 print ''
 elif self.verbose  0:
 print('%s %s' % (str(item), status))

 MODIFIED TRASH:
 def trash(self):
 Trash expired sessions.
 now = datetime.datetime.now()
 for item in self.get():
 status = 'OK'
 last_visit = item.last_visit_default()
 expiration = self.expiration ### added this

 try:
 session = item.get()
 if session.auth:
 if session.auth.expiration and not self.force:
 ###self.expiration = session.auth.expiration
 expiration = session.auth.expiration
 if session.auth.last_visit:
 last_visit = session.auth.last_visit
 except:
 pass

 age = 0
 if last_visit:
 age = total_seconds(now - last_visit)

 ###if age  self.expiration or not self.expiration:
 if age  expiration or not expiration:
 item.delete()
 status = 'trashed'

 if self.verbose  1:
 print 'key: %s' % str(item)
 print 'expiration: %s seconds' % self.expiration
 print 'last visit: %s' % str(last_visit)
 print 'age: %s seconds' % age
 print 'status: %s' % status
 print ''
 elif self.verbose  0:
 print('%s %s' % (str(item), status))





I am using the latest version of sessions2trash.py as shown in the CURRENT 
TRASH above. I added counters to see how many sessions were being trashed, 
and how many were being left alone. This information is included in a 
reporting task I run every night as well.

The following are the results from the reporting task using the CURRENT 
TRASH above, as in the latest sessions2trash.py. I only added counters. As 
you can see the session files are stacking up by about 1000/day.

COMPLETED | start: 2015-08-02 21:31:10 | duration: 55 seconds | output: 
6989 ok, 3731 trashed
COMPLETED | start: 2015-08-03 03:05:14 | duration: 38 seconds | output: 
7138 ok, 152 trashed
COMPLETED | start: 2015-08-04 03:05:09 | duration: 51 seconds | output: 
8040 ok, 495 trashed
COMPLETED | start: 2015-08-05 03:05:17 | duration: 67 seconds | output: 
9491 ok, 1120 trashed
COMPLETED | start: 2015-08-06 03:05:09 | duration: 52 seconds | output: 
10944 ok, 125 trashed
COMPLETED | start: 2015-08-07 03:05:05 | duration: 60 seconds | output: 
11753 ok, 800 trashed
COMPLETED | start: 2015-08-08 03:05:16 | duration: 29 seconds | output: 
12709 ok, 404 trashed
COMPLETED | start: 2015-08-09 03:05:05 | duration: 61 seconds | output: 
13760 ok, 217 trashed

At this point I modified the sessions2trash.py as shown in the MODIFIED 
TRASH above. You can see the results are now stable, and what I expect from 
my site.

COMPLETED | start: 2015-08-09 06:45:19 | duration: 7 seconds

[web2py] sessions piling up

2015-08-09 Thread Bob St John
Using 2.12.1

I run a small site... about 200 members who login (some using the 'Remember 
me for 30 days') plus about 1500 public visitors per day. The sessions are 
stored in the file system. I run the sessions2trash.py script once a day. I 
have noticed the sessions are increasing by about 1000 per day which did 
not seem right. I made the following changes to trash() and now the 
sessions remaining after being 'trashed' is about 200-300, which seems 
correct. I think the problem was when a large expiration was saved (30 
days) and the next expired public sessions were not trashed


CURRENT TRASH:
def trash(self):
Trash expired sessions.
now = datetime.datetime.now()
for item in self.get():
status = 'OK'
last_visit = item.last_visit_default()

try:
session = item.get()
if session.auth:
if session.auth.expiration and not self.force:
self.expiration = session.auth.expiration
if session.auth.last_visit:
last_visit = session.auth.last_visit
except:
pass

age = 0
if last_visit:
age = total_seconds(now - last_visit)

if age  self.expiration or not self.expiration:
item.delete()
status = 'trashed'

if self.verbose  1:
print 'key: %s' % str(item)
print 'expiration: %s seconds' % self.expiration
print 'last visit: %s' % str(last_visit)
print 'age: %s seconds' % age
print 'status: %s' % status
print ''
elif self.verbose  0:
print('%s %s' % (str(item), status))

MODIFIED TRASH:
def trash(self):
Trash expired sessions.
now = datetime.datetime.now()
for item in self.get():
status = 'OK'
last_visit = item.last_visit_default()
expiration = self.expiration ### added this

try:
session = item.get()
if session.auth:
if session.auth.expiration and not self.force:
###self.expiration = session.auth.expiration
expiration = session.auth.expiration
if session.auth.last_visit:
last_visit = session.auth.last_visit
except:
pass

age = 0
if last_visit:
age = total_seconds(now - last_visit)

###if age  self.expiration or not self.expiration:
if age  expiration or not expiration:
item.delete()
status = 'trashed'

if self.verbose  1:
print 'key: %s' % str(item)
print 'expiration: %s seconds' % self.expiration
print 'last visit: %s' % str(last_visit)
print 'age: %s seconds' % age
print 'status: %s' % status
print ''
elif self.verbose  0:
print('%s %s' % (str(item), status))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] form misalignment with bootstrap3_inline

2015-05-01 Thread Bob St John
Using web2py version 2.10.4 with response.formstyle=bootstrap3_inline

Problem:
When using SQLFORM or SQLFORM.grid(view) the form fields whose value is 
None or when writable=False do not line up horizontally with the label.

Solution (or hack):
In gluon.sqlhtml.py I added the following elif (about line 918)

elif isinstance(controls, UL):
for e in controls.elements(input):
e.add_class('form-control')

# bob's fix
elif controls is None or isinstance(controls, basestring):
_controls = P(controls, _class=form-control-static %s % col_class)
# end bob's fix

if isinstance(label, LABEL):
label['_class'] = 'control-label %s' % label_col_class


This is probably more of a hack than a solution... somewhere else in 
SQLFORM when controls == None or controls == string it should be included 
inside a SPAN()...

But this works for me right now.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Controller for layout.html?

2013-05-09 Thread Bob Babby
Sorry if this is a repost. My last post wasn't showing up for some reason.

I want to add a search bar to all my pages. To do this I plan on adding an 
input text to layout.html (all my pages extend layout.html).

But where is the controller for layout.html so that I can build the 
htmlhelpers and then do {{=form}} in layout.html?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Does layout.html have a corresponding controller?

2013-05-09 Thread Bob Babby
I want to add a search bar to my all my pages. I think the best way to do 
this is by adding it to the layout.html from which all my other html views 
extend from.

The problem I can't figure out is where to put the corresponding controller 
function. For all the other views, the controller functions are in 
default.py. Where would I put the controller logic for layout.html so that 
I can begin building the form using the htmlhelpers?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] gluon.contenttype.contenttype

2013-01-12 Thread Bob St John
def contenttype(filename, default='text/plain'):

Returns the Content-Type string matching extension of the given 
filename.

i = filename.rfind('.')
if i=0:
default = CONTENT_TYPE.get(filename[i:].lower(),default)
j = filename.rfind('.', 0, i)
if j=0:
default = CONTENT_TYPE.get(filename[j:].lower(),default)
if default.startswith('text/'):
default += '; charset=utf-8'
return default

I do not understand why the line:

default = CONTENT_TYPE.get(filename[j:].lower(), default)

is not instead:

default = CONTENT_TYPE.get(filename[j:i].lower(), default)

Is the purpose of this second rfind not to check for a possible double 
extension... filename.ext.ext ?

I apologize in advance if I am completely missing something here in such a 
simple function.

-- 





[web2py] pyFpdf supports gif images?

2012-06-13 Thread Bob St John
The documentation for pyFpdf indicates support for gif images, yet there 
does not seem to be any hooks for gif in the FPDF class.

pyFpdf seems to be a nice way to create reports, but my project requires 
gif images with transparency 


[web2py] Re: pyFpdf supports gif images?

2012-06-13 Thread Bob St John
Hi Mariano,

Yes, binary transparency works with png... thanks.

On Wednesday, June 13, 2012 12:37:29 PM UTC-7, Bob St John wrote:

 The documentation for pyFpdf indicates support for gif images, yet there 
 does not seem to be any hooks for gif in the FPDF class.

 pyFpdf seems to be a nice way to create reports, but my project requires 
 gif images with transparency 



Re: [web2py] Re: best practices for displaying a a subset of a tables columns?

2012-06-05 Thread bob
Thanks Richard,  I am coding up the set example,  it should do what I need 
without having to build views.



On Monday, June 4, 2012 1:04:14 PM UTC-7, Richard wrote:

 Yes it works, but I think lambda: has_membership is much better approach 
 as pointed by Anthony as more fast since the lambda is only hit when you 
 really want to access the records...

 Richard

 On Mon, Jun 4, 2012 at 4:00 PM, pbreit  wrote:

 I might not quite understand the question but wouldn't readable/writable 
 work?


 On Monday, June 4, 2012 5:56:40 AM UTC-7, bob wrote:


 In the old days I would just create a database view on a subset of a 
 table that I wanted to allow other developers to access (assuming read 
 only),  however I'm not sure if that's the best thing to do with web2py.

 I have a table that has:

 last_name
 first_name
 etc
 including some 'internal' columns that I don't want to expose on any 
 form or service.

 Any thoughts on the best way to implement this?

 I'm thinking:

 a:   database view (postgresql in this case),  issues being no 'id' in 
 the view and I'm not sure how best to maintain that.

 b:   a new .py that takes the full record and returns the subset.   
 upside - it would be a single point of maintenance,  question is where 
 would this live  (in the models, it's not a controller so it doesn't really 
 fit there)?

 c:  ??

 thanks for any suggestions,
 bobm




[web2py] Send push notifications to IOS devices?

2012-06-05 Thread bob

I can send an email from within web2py but am wondering if anyone has 
attempted to send an IOS notification and if so any pointers would be very 
helpful.

What the Apple Push Notification service is:

 
https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9

thanks,
bobm



[web2py] best practices for displaying a a subset of a tables columns?

2012-06-04 Thread bob

In the old days I would just create a database view on a subset of a table 
that I wanted to allow other developers to access (assuming read only),  
however I'm not sure if that's the best thing to do with web2py.

I have a table that has:

last_name
first_name
etc
including some 'internal' columns that I don't want to expose on any form 
or service.

Any thoughts on the best way to implement this?

I'm thinking:

a:   database view (postgresql in this case),  issues being no 'id' in the 
view and I'm not sure how best to maintain that.

b:   a new .py that takes the full record and returns the subset.   upside 
- it would be a single point of maintenance,  question is where would this 
live  (in the models, it's not a controller so it doesn't really fit there)?

c:  ??

thanks for any suggestions,
bobm



[web2py] How to never return html?

2012-05-25 Thread bob
Probably a simple question and I searched both the docs and the group.

I have a path  /api  and I never want to return a html reply,  I'm ok with 
a .xml or .json reply and would like to have the default be .xml

The big issue is that I want other urls (i.e.  /default/) to return html as 
the default.

thanks,
bob


[web2py] Re: How to never return html?

2012-05-25 Thread bob
Thanks Simon and Anthony for the quick replies.This is a controller and 
I'll try the suggestions.



On Friday, May 25, 2012 5:26:49 PM UTC-7, Anthony wrote:

 Is api a controller or function? Either way, you can prevent html 
 requests by (a) making sure there is no .html view file associated with the 
 particular function and (b) making sure you don't enable the generic.html 
 view for that controller/function. For example, somewhere in the controller 
 or function:

 response.generic_patterns = ['xml', 'json']

 Also, are you hoping to default to an xml response without having to add 
 the .xml extension to the urls? In that case, somewhere in the controller 
 or function, you could do:

 if request.extension not in ['xml', 'json']:
 response.view = '%s/%s.xml' % (request.controller, request.function)
 request.extension = 'xml' # only needed if you have enabled 
 generic.xml

 Anthony

 On Friday, May 25, 2012 6:55:17 PM UTC-4, bob wrote:

 Probably a simple question and I searched both the docs and the group.

 I have a path  /api  and I never want to return a html reply,  I'm ok 
 with a .xml or .json reply and would like to have the default be .xml

 The big issue is that I want other urls (i.e.  /default/) to return html 
 as the default.

 thanks,
 bob



[web2py] how to remove document from the foo.xml reply?

2012-05-18 Thread bob
Great app,  but I'm stuck on how to build custom XML.

I have the following:

@request.restful()
def check():
def GET(id):
count = db(db.users.user_name==id).count()
if count  0:
return dict(Status=1)
else:
return dict(Status=0)

return locals()

when I do a 'check.xml/foo' request I get back:

document
 Status1/Status
/document

if foo exists.How do I change the XML that is being built?   I would 
like to replace the document, etc.

thanks much for a very nice framework.
bob


[web2py] Re: how to remove document from the foo.xml reply?

2012-05-18 Thread bob
Thanks for the pointer.   A quick solution was to mod the generic.xml and 
add a key='something' to change the root element.



On Friday, May 18, 2012 8:58:30 AM UTC-7, Niphlod wrote:

 views/generics.xml is your friend.

 And probably you'll want to create a your_controller/check.xml too, if 
 you're in the need of overcustomizing your xml

 Il giorno venerdì 18 maggio 2012 06:57:02 UTC+2, bob ha scritto:

 Great app,  but I'm stuck on how to build custom XML.

 I have the following:

 @request.restful()
 def check():
 def GET(id):
 count = db(db.users.user_name==id).count()
 if count  0:
 return dict(Status=1)
 else:
 return dict(Status=0)

 return locals()

 when I do a 'check.xml/foo' request I get back:

 document
  Status1/Status
 /document

 if foo exists.How do I change the XML that is being built?   I would 
 like to replace the document, etc.

 thanks much for a very nice framework.
 bob



[web2py] SQLFORM.grid behavior with an empty table

2011-10-27 Thread Bob St John
using 1.99.2

SQLFORM.grid...

I don't see the need for this statement...

line 1641: if not searchable and not rows: return DIV(T('No records
found'))

If it was removed a user would see an empty grid rather than just a
div, no matter what the value of 'searchable' was.

An empty grid allows the user to add a record, which seems more usable
than the 'No records found' result when searchable=False


[web2py] SQLFORM.grid ondelete possible bug

2011-10-26 Thread Bob St John
using 1.99.2

in gluon.sqlhtml.SQLFORM.grid:

line 1489: return ondelete(table,request.args[-2],ret)

I think it should be: return ondelete(table,request.args[-1],ret)

As it is now, ondelete gets (table, table, ret), whereas I believe it
should get (table, record_id, ret) to work properly...

I like this grid method!


[web2py] html comments within conditional comments

2011-10-07 Thread Bob St John
Using 1.99.2
'layout.html' has the following conditional comment...

!--[if IE]
  !-- Always force latest IE rendering engine
   (even in intranet)  Chrome Frame
   Remove this if you use the .htaccess --
  meta http-equiv=X-UA-Compatible content=IE=edge,chrome=1
![endif]--

I may be wrong, but I think the regular html comment contained in the
conditional comment could cause premature closing. Perhaps this would
be better 

  !-- Always force latest IE rendering engine
   (even in intranet)  Chrome Frame
   Remove this if you use the .htaccess --
!--[if IE]
  meta http-equiv=X-UA-Compatible content=IE=edge,chrome=1
![endif]--


[web2py] Re: change colnames export_to_csv_file

2011-06-02 Thread Bob
Thanks!

On 1 Юни, 19:12, Massimo Di Pierro massimo.dipie...@gmail.com wrote:
 yes

 rows.export_to_csv_file(open(),colnames=[])

 On Jun 1, 8:38 am, Bob handzh...@gmail.com wrote:







  Is there any way to change colnames before exporting to CSV?
  Now I have a query like this:

  students=db().select(db.students.email, db.students.name)

  And I'm getting the excel with columns like:
  students.email | students.name

  Would be nice to change that to Email and Name, but can't find any
  solution


[web2py] Re: error on crud.update delete

2011-06-01 Thread Bob
You'll need to show your code as well.

On 31 Май, 23:46, selecta gr...@delarue-berlin.de wrote:
 ERROR:web2py:Traceback (most recent call last):
   File /home/select/Dev/web2py/gluon/restricted.py, line 181, in
 restricted
     exec ccode in environment
   File /home/select/Dev/web2py/applications/pyMantis/controllers/
 plugin_whishlist.py, line 118, in module
   File /home/select/Dev/web2py/gluon/globals.py, line 133, in
 lambda
     self._caller = lambda f: f()
   File /home/select/Dev/web2py/gluon/tools.py, line 2335, in f
     return action(*a, **b)
   File /home/select/Dev/web2py/applications/pyMantis/controllers/
 plugin_whishlist.py, line 68, in edit
     if form.accepts(request.vars, session):
   File /home/select/Dev/web2py/gluon/sqlhtml.py, line 1200, in
 accepts
     self.table._db(self.table.id == self.record.id).update(**fields)
   File /home/select/Dev/web2py/gluon/dal.py, line 5173, in update
     fields = self.db[tablename]._listify(update_fields,update=True)
   File /home/select/Dev/web2py/gluon/dal.py, line 4464, in _listify
     raise SyntaxError, 'Field %s does not belong to the table' % name
 SyntaxError: Field delete_this_record does not belong to the table

 is this somehow my fault? not sure how to debug


[web2py] change colnames export_to_csv_file

2011-06-01 Thread Bob
Is there any way to change colnames before exporting to CSV?
Now I have a query like this:

students=db().select(db.students.email, db.students.name)

And I'm getting the excel with columns like:
students.email | students.name

Would be nice to change that to Email and Name, but can't find any
solution


[web2py] What if Massimo got hit by a Bus?

2011-05-26 Thread Bob Blanchett
I just read this presentation by by 
GvR/BDFLhttp://mvdirona.com/jrh/TalksAndPapers/GuidoVanRossum_21_years_of_python.pdfon
 21 years of Python and wondered for Web2py  as  some 
one did  for 
Pythonhttp://www.python.org/search/hypermail/python-1994q2/1040.htmlin 1994.

What if the worst happened to Massimo (God Forbid) ?

The Technology Selection Risks etc etc..

Yours in no way Gruesomely,

Bob


[web2py] Re: Mail.Attachment and Blob

2011-04-20 Thread Bob
OK, I did it by writing in temp files. If anyone is interested, here's
the code:

atts=[]
for attachment in attachments:
 path=os.path.join(request.folder,uploads/
tmp/,str(attachment.id)+-+attachment.name)
 output_file=open(path, wb)
 output_file.write(attachment.data)
 output_file.close()
 atts.append(Mail.Attachment(path))
 os.remove(path)

mail.send(to = request.vars.receiver,
  subject = request.vars.subject,
  message = (None,message),
  attachments=atts)

It will be nice if Mail.Attachment can attach files right from blob
fields

On 19 Апр, 15:42, Bob handzh...@gmail.com wrote:
 Can Mail.Attachment work with blob field data instead of a file path?
 I guess I can just write the file and give the path then but wondered
 if there is more elegant solution like passing the blob data directly
 to Mail

 Thanks


[web2py] Mail.Attachment and Blob

2011-04-19 Thread Bob
Can Mail.Attachment work with blob field data instead of a file path?
I guess I can just write the file and give the path then but wondered
if there is more elegant solution like passing the blob data directly
to Mail

Thanks


[web2py] auth_user manually insert/update the password

2011-04-12 Thread Bob
Hello, could someone answer a couple of questions:

1. Is it possible to manually crypt the password in the same way that
crud() does it?
The reason is that I need to manually update the user with
db().update() and can't use crud

2. In similar situation using SQLFORM. When updating the user it's
logical to leave the password blank in case you don't want to change
it. But SQLFORM crypts the blank and changes the password in the DB

Any ideas?

Thanks


[web2py] Re: auth_user manually insert/update the password

2011-04-12 Thread Bob
Thanks Anthony

Hiding with javascript will not work because it will get submitted
with javascript. But I will try the readable/writable trick, thanks

Bob


[web2py] Re: Is there a way to remove application name from URL()?

2011-01-18 Thread Bob
Thanks mates, I'm going to just use init for now, will wait for the
new routing for the future

On 18 Ян, 00:47, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 17, 2011, at 1:06 PM, Bob wrote:











  In attempt to get some response I'll try to clarify/simplify my
  question.

  After rewriting with routes.py I have my app accessible as:

 http://127.0.0.1/

  But all the internal links, created with the URL() function come as:

 http://127.0.0.1/myapp/

  And obviously they don't work.

  Is there no way to tell the URL() function not to prepend app name to
  the URLs?

 As David mentioned, you can rename your app 'init' and get some of this to 
 happen. It won't delete all mention of the app name, though--only when it can 
 also delete the controller and function name.

 If you don't want to change your app name, you can create (in web2py's base 
 directory) a file named routes.py with nothing in it but this line:

 default_application = 'myapp'

 But to get the app name deleted on a more systematic basis, you'll need to 
 write a more elaborate routes.py. There's a new version coming along, in beta 
 in the trunk right now, that should be available for more general use pretty 
 soon, so if you're not in a hurry, just go with one of the above solutions 
 for now, and when the new rewrite logic is ready for prime time you can add a 
 couple more lines in routes.py and be done with it.

 If you're in more of a hurry, use the existing rewrite logic; it's not going 
 away, but it's a little trickier to set up.


[web2py] Is there a way to remove application name from URL()?

2011-01-17 Thread Bob
I'm using a routing file which makes my app load by default on
localhost. It works well, but everywhere I have used the URL()
function it prepends the application name to the URL. This of course
no longer works, because my real URLs no longer need the name.

So is there any configuration that will tell URL() not to add app name
automatically?

In case of need, here's my routes.py:

---
default_application = myapp

routes_in = (
  ('/static/$anything', '/myapp/static/$anything'),
  ('/appadmin/$anything', '/myapp/appadmin/$anything'),
  ('/favicon.ico', '/myapp/static/favicon.ico'),
  ('/robots.txt', '/myapp/static/robots.txt'),
  ('/(?Pany.*)', '/myapp/\gany'),
)
routes_out = [(x, y) for (y, x) in routes_in[:-2]]



[web2py] Re: Is there a way to remove application name from URL()?

2011-01-17 Thread Bob
In attempt to get some response I'll try to clarify/simplify my
question.

After rewriting with routes.py I have my app accessible as:

http://127.0.0.1/

But all the internal links, created with the URL() function come as:

http://127.0.0.1/myapp/

And obviously they don't work.

Is there no way to tell the URL() function not to prepend app name to
the URLs?


[web2py] Re: Why the need of return dict() in controller?

2011-01-14 Thread Bob
I see no downsides and seems that Massimo confirmed that. I already
tried using return locals() and it works without issues.

On 14 Ян, 07:37, pbreit pbreitenb...@gmail.com wrote:
 Wait, so are you saying that instead of return dict(items=items, blah=blah,
 etc) we can just use return locals() on most or all controllers? What's the
 downside, memory? Implicitness?


[web2py] Why the need of return dict() in controller?

2011-01-13 Thread Bob
Is there anything I am missing? Why would you want to manually create
a dictionary of all the vars you need in Web2py views when you simpli
can write

return locals()

and all the variables will be available in the view