Re: [web2py] Re: cron problem

2011-07-26 Thread Manuele Pesenti

On 26/07/2011 00:00, Rowdy wrote:

Greeting.

Different time zone perhaps?

fetch_m_data is expected to run at 06:30, but runs at 12:30 (= +6 hours).


this time a ticket is not necessary ;)

the server that runs my web2py is a virtual machine, the date command 
gave the correct date info but I discovered that registering time stamp 
from a crontab bash script it has 6 hours gap...


thank you very mutch I didn't realize it was a constant gap.

greetings

Manuele


[web2py] Re: please check out the nightly built

2011-07-26 Thread Iceberg
I gave it a shot. The generic_patterns=[...] and LOAD(...,
ajax=False) issue is finally fixed. Good job!

By the way, will a fix for IS_NOT_EMPTY and list:reference issue be
included in 1.98.1?

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

On Jul 26, 6:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I am planning to release a 1.98.1 on Sunday.
 Many tickets have been closed.
 Please check out the nightly built 
 onhttp://web2py.com/examples/default/download
 and report any issue.

 Massimo


[web2py] Re: export data to OOO and Excel

2011-07-26 Thread Vineet
Sure.
I will post here my observations after trying out the 2 excel
libraries.

Cheers :-)

On Jul 26, 12:26 pm, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 Please let us know which one you found to be better. I m going to need
 to switch away from CSV to a real Excel format in  a couple of months.

 Kenneth



  @selecta,
  thanks for directing to 'tablib'.
  It is also a good choice.
  I am assessing whether to use 'excel-python' or 'tablib'.
  :-|

  On Jul 25, 1:52 pm, Ant nio Ramosramstei...@gmail.com  wrote:
  How about a video tutorial exporting to excel?

  2011/7/25 selectagr...@delarue-berlin.de

  Have a look at
 http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/view...
 http://tlc2.hg.sourceforge.net/hgweb/tlc2/tlc2/file/d68f1405e1c5/view...
  they use tablib (which includes xlwt, ...)
 http://docs.tablib.org/en/latest/index.html-Hide quoted text -
  - Show quoted text -- Hide quoted text -

 - Show quoted text -


Re: [web2py] [Newbie] Best practice to set application wide settings

2011-07-26 Thread Jagmal
Thanks Bruno for the suggestions. I will keep these in mind.

[web2py] Re: [Newbie] Best practice to set application wide settings

2011-07-26 Thread Jagmal
Thanks David for the link. I think I am not at a stage right now, where I 
need to store configurations in the database. I will definitely give this a 
try once I am at that stage.

[web2py] query quest

2011-07-26 Thread Manuele Pesenti
can you help me to translate this sql query that correctly runs under my 
mysql server?


SELECT * FROM (SELECT * FROM power_curve ORDER BY start DESC) AS TMP 
GROUP BY site;


moreover if I execute:

db.executesql('SELECT * FROM (SELECT * FROM power_curve ORDER BY start 
DESC) AS TMP GROUP BY site')


I obtain:

---
ProgrammingError  Traceback (most recent call last)

/home/manuele/Dropbox/sviluppo/web2py-1.96.4/applications/wind2pow2/models/utils_lib.py 
in module()

 1
  2
  3
  4
  5

/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.pyc in 
executesql(self, query, placeholders, as_dict)

   4297 self._adapter.execute(query, placeholders)
   4298 else:
- 4299 self._adapter.execute(query)
   4300 if as_dict:
   4301 if not hasattr(self._adapter.cursor,'description'):

/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.pyc in 
execute(self, *a, **b)

   1232
   1233 def execute(self,*a,**b):
- 1234 return self.log_execute(*a, **b)
   1235
   1236 def represent(self, obj, fieldtype):

/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.pyc in 
log_execute(self, *a, **b)

   1227 self.db._lastsql = a[0]
   1228 t0 = time.time()
- 1229 ret = self.cursor.execute(*a,**b)
   1230 self.db._timings.append((a[0],time.time()-t0))
   1231 return ret

ProgrammingError: column tmp.id must appear in the GROUP BY clause or 
be used in an aggregate function

LINE 1: SELECT * FROM (SELECT * FROM power_curve ORDER BY start DESC...

thankyou very mutch

Manuele


[web2py] Re: query quest

2011-07-26 Thread Manuele Pesenti

On 26/07/2011 11:18, Manuele Pesenti wrote:

can you help me to translate this sql query that correctly runs under my
mysql server?


maybe it's better to say what here is needed... suppose to have the 
subsequent model:


db.define_table('site',
Field('name'),
...
)

db.define_table('curve',
Field('start', 'date'),
Field('site', db.site, requires=IS_IN_DB(db, 'site.id')),
...
)

I would like to extract a join from the two table with the condition 
db.curve.site==db.site.id (simple one to many relationship) in wich only 
the last 'curve' record is represented (i.e. start is max) for EACH 
site... so I need ALL the last record of the curve table associated with 
the corresponding site description (i.e. fields)


thank you very mutch


Manuele


[web2py] Deleting uploaded files

2011-07-26 Thread Johann Spies
I have the following model:


db.define_table(files,
Field(title, string),
Field(description, text),
Field(file,upload, autodelete = True), #
something to be uploaded
signature)
db.files.id.represent = \
  lambda id: A('edit',
   _href=URL(r=request, c='default',
 f='edit_document_entry',
 args=str(id)))

When I use the 'edit' link and click on the 'delete' button and submit
Web2Py flashes that the record has been deleted.  Actually that is not
true:  All that was deleted was sthe uploaded file or at least the link to
it in the record.  The rest of the record is still there.

The record count stays the same after the deletion.

I know I can delete the record using (db.files.id==id).delete()  but why
the abovementioned behaviour?

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


[web2py] appadmin - insert new auth_permission

2011-07-26 Thread Marin
Hi,
while inserting new auth_permission entries via appadmin, you can
choose only tables that are defined before auth_permission table
(auth_user, auth_groups, auth_membership, auth_permission included).
Custom table (db.define_table(...)) is visible only if defined before
auth tables.

db.py file in welcome app suggests defining tables at the end of file,
so no custom tables are visible that way.

Should this be treated as a bug?

Regards,
Marin


Re: [web2py] Re: upload - S3 storage

2011-07-26 Thread nils
Hi,

I forgot about Mounting S3 as partition, I'm already using the boto interface.
The computer field sounds like an Idea, but now to come up with the code :)

Thanks for the tips.

Regards,

Nils

On Tue, Jul 26, 2011 at 6:32 AM, howesc how...@umich.edu wrote:
 pbreit might be right - you would still end up uploading the file to your
 server, and then saving to s3.  (though if your server was ec2 there might
 be a way to mount an s3 bucket, not sure though).

 i also agree on looking at the boto interface:
 http://code.google.com/p/boto/  i'm using an older version of the library
 (just cause i have been too lazy to disturb running code) quite
 successfully.

 cfh



[web2py] def data()

2011-07-26 Thread Johann Spies
I have read something about security related modifications in recent Web2Py
versions which caused the previous code using  the data() controller to fail
with 404 NOT FOUND.

I have als seen the comment in the new Welcome-app telling us: 

 but URLs bust be signed, i.e. linked with
  A('table',_href=URL('data/tables',user_signature=True))
or with the signed load operator
  LOAD('default','data.load',args='tables',ajax=True,user_signature=True)

When I use
A(T('remove'),_href=URL(r=request, c='default',
f='data/delete/files',user_signature=True, args=str(id)))

it does the job (delete the record) but I still get the 404 NOT FOUND error.

Please enligthen me on how to use the data-controller now?

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


[web2py] Re: appadmin - insert new auth_permission

2011-07-26 Thread David Marko
This general behaviour irritates me as well :-) ...

[web2py] checkbox labels

2011-07-26 Thread peter
I am trying to use checkboxes in a form. I want several, one above
each other. Each must have a label just to their right.

If I use
TR(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label))

Then there are a lot of spaces between the checkbox and 'box_label'. I
have tried a lot of different things but cannot get rid of the spaces.
'Cellspacing' does not seem to be changeable in web2py. Presumably
there is a way to contol cell spacing can anyone enlighten me.

I want to have the checkbox, one space and then the label.

Thanks
Peter


[web2py] search by Tag blugin

2011-07-26 Thread Web2Py Freak
hey all ,

am using the tags in blugin wiki . and i want to make a search using
them  , how can i do that  ???  please help


Re: [web2py] web2py for freelance work

2011-07-26 Thread Miguel Lopes
1. web2py is especially good for freelancers and single developers because
it is such a tight package. Everything works really well together and right
out of the box.

2. From the forum I get the impression that there is a lot of intranet work.
But if you look for sites built with web2py I think that are enough examples
out there to make anyone feel comfortable.

3. It fares really well! One frequently voiced concern is performance, which
is not a problem at all. Python is pretty fast for an interpreted language,
the database io (outside of Python is really the bottleneck). And rocket is
very, very fast.

4. Well, depending on your goals, webdevelopment can be pretty difficult.
Especially for a single developer, browser inconsistencies, many different
skills and know-hows involved (HTML, CSS, deployment, ...). Particularly
powerful and easy is SQLFORM :-) ,  the DAL is pretty sleek. web2py, like
Python, can be said to fit the brain (i.e. you won't be looking much at
documentation) which is a real productivity booster - KUDOS Massimo. The
forum is great and answers are generally very very fast.

5. Generally clients don't care. However this might not always be the case.
Python as been around for 20 years! If you look at programming indexes it is
generally found among the top used languages:

* http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
* http://langpop.com/
* http://www.devtopics.com/most-popular-programming-languages/

Those who feel more comfortable with corporation languages should check that
open-source languages are not subject to corporate whims, so contrary to
popular belief they tend to die less. Most importantly, Python is also on
multiple platforms, like dotNet and Java, so it is being used as a scripting
langugage not only in C/C++ (and others) but also in C# and Java. And a
cursory inquiry on who uses it leads to replies like:

* Google - also hired GvR
* NASA
* Disney
* Civilization IV (Firaxis Games)
* Plone (most likely the best CMS around opensource or not)
* Yahoo Maps

The list goes on and on. For some of this and other references :
* http://www.python.org/about/success/
* http://wiki.python.org/moin/OrganizationsUsingPython

No one should be concerned with using Python!

HTH,
Miguel


On Mon, Jul 25, 2011 at 6:26 PM, spiffytech spiffyt...@gmail.com wrote:

 I'm picking out a framework to use for freelance web development. Does
 anyone use web2py in that sort of situation? How does it fare? Do you
 find anything particularly limiting or particularly easy? How do
 clients respond when you tell them you're building the site in Python
 (not PHP), and that you're building it in one of the less-common
 frameworks?


[web2py] Re: Can't get linkto working in SQLFORM

2011-07-26 Thread DenesL

That was the point of posting the original text from the book:

the appadmin UPDATE form shows a link
this says appadmin uses it, but then

This behavior can be replicated using the linkto argument of the
SQLFORM
this says you can use too, and gives an example.

Just playing devil's advocate here.


On Jul 26, 1:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I am not sure this is something we want to encourage outside appadmin.
 It should be corrected but it should say this is for appadmin.

 On Jul 25, 5:57 pm, Anthony abasta...@gmail.com wrote:







  On Monday, July 25, 2011 5:19:45 PM UTC-4, Massimo Di Pierro wrote:

- Why was this changed?.

   this was changed 2 years ago because the syntax of appadmin changed
   from raw SQL to DAL.

- Does anybody use it this way?.

   nobody. That is why we changed it. The documentation is incorrect.
   Strangely this was changed BEFORE the documentation was published.

  What should the documentation say?

  Anthony


Re: [web2py] web2py for freelance work

2011-07-26 Thread Anthony
On Tuesday, July 26, 2011 9:06:13 AM UTC-4, miguel wrote: 


 2. From the forum I get the impression that there is a lot of intranet 
 work. But if you look for sites built with web2py I think that are enough 
 examples out there to make anyone feel comfortable.

 
See http://www.web2py.com/poweredby.
 


Re: [web2py] checkbox labels

2011-07-26 Thread Richard Vézina
Have you try without base.css to see what it looks like... Then you will
know if it comes form css...

Richard

On Tue, Jul 26, 2011 at 7:21 AM, peter peterchutchin...@gmail.com wrote:

 I am trying to use checkboxes in a form. I want several, one above
 each other. Each must have a label just to their right.

 If I use
 TR(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label))

 Then there are a lot of spaces between the checkbox and 'box_label'. I
 have tried a lot of different things but cannot get rid of the spaces.
 'Cellspacing' does not seem to be changeable in web2py. Presumably
 there is a way to contol cell spacing can anyone enlighten me.

 I want to have the checkbox, one space and then the label.

 Thanks
 Peter



[web2py] Re: search by Tag blugin

2011-07-26 Thread pbreit
Can you tell us more about what you are doing? Have you read al about 
plugins?
http://web2py.com/book/default/chapter/13#plugin_wiki

Can you show us any code examples?


[web2py] Re: checkbox labels

2011-07-26 Thread Anthony
Do you want the label in the same table cell as the checkbox? If so, you 
should wrap the INPUT and label in a TD (as is, TR is assuming you want two 
separate TD's). So, you could do:
 
TR(TD(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label))) 
 
 
To control cellspacing, add _cellspacing='[number]' to your TABLE() helper 
(in general, you can add any attribute to an HTML tag by preceding it with 
an underscore).
 
Anthony
 
 
On Tuesday, July 26, 2011 7:21:57 AM UTC-4, peter wrote:

 I am trying to use checkboxes in a form. I want several, one above 
 each other. Each must have a label just to their right. 

 If I use 
 TR(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label)) 

 Then there are a lot of spaces between the checkbox and 'box_label'. I 
 have tried a lot of different things but cannot get rid of the spaces. 
 'Cellspacing' does not seem to be changeable in web2py. Presumably 
 there is a way to contol cell spacing can anyone enlighten me. 

 I want to have the checkbox, one space and then the label. 

 Thanks 
 Peter 



Re: [web2py] Deleting uploaded files

2011-07-26 Thread Richard Vézina
It's maybe related somehow with this issue :
https://groups.google.com/forum/#!topic/web2py/-tFA1G5wbsI

It seems to me that 1.97.1 had break something about upload type...

Richard

On Tue, Jul 26, 2011 at 6:23 AM, Johann Spies johann.sp...@gmail.comwrote:

 I have the following model:


 db.define_table(files,
 Field(title, string),
 Field(description, text),
 Field(file,upload, autodelete = True), #
 something to be uploaded
 signature)
 db.files.id.represent = \
   lambda id: A('edit',
_href=URL(r=request, c='default',
  f='edit_document_entry',
  args=str(id)))

 When I use the 'edit' link and click on the 'delete' button and submit
 Web2Py flashes that the record has been deleted.  Actually that is not
 true:  All that was deleted was sthe uploaded file or at least the link to
 it in the record.  The rest of the record is still there.

 The record count stays the same after the deletion.

 I know I can delete the record using (db.files.id==id).delete()  but why
 the abovementioned behaviour?

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




Re: [web2py] Re: upload - S3 storage

2011-07-26 Thread pbreit
I use a computed field to create and save thumbnails:


Field('image_display', 'upload', 
uploadfolder=request.folder+'static/uploads',
compute=lambda r: resize_image(r['image'], (320,320), 
'display'),
readable=False, writable=False),


def resize_image(image, size, path, rotate=0):
if image:
try:
img = Image.open('%sstatic/uploads/%s' % (request.folder, 
image))
img = img.convert(RGB)
img.thumbnail(size, Image.ANTIALIAS)
img = img.rotate(rotate)
root, ext = os.path.splitext(image)
filename = '%s_%s%s' %(root, path, ext)
img.save('%sstatic/uploads/%s' % (request.folder, filename))
return filename
except Exception, e:
return e
else:
return None


Re: [web2py] Re: please check out the nightly built

2011-07-26 Thread Richard Vézina
This one is still there :

https://groups.google.com/forum/#!topic/web2py/-tFA1G5wbsI

Richard

On Tue, Jul 26, 2011 at 4:03 AM, Iceberg iceb...@21cn.com wrote:

 I gave it a shot. The generic_patterns=[...] and LOAD(...,
 ajax=False) issue is finally fixed. Good job!

 By the way, will a fix for IS_NOT_EMPTY and list:reference issue be
 included in 1.98.1?

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

 On Jul 26, 6:42 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
  I am planning to release a 1.98.1 on Sunday.
  Many tickets have been closed.
  Please check out the nightly built onhttp://
 web2py.com/examples/default/download
  and report any issue.
 
  Massimo



[web2py] Re: search by Tag blugin

2011-07-26 Thread Web2Py Freak
am making a blogs website and am using the taging widget in blugin
wiki and i want to make a search using tags  . every blog post has a
tag  , so i want tags to be searched by that tag


[web2py] Re: Extend default user/group model

2011-07-26 Thread Simone Fiorenzoni
Ok, I will try...
Thanks you both for your support!!!


On 25 Lug, 22:35, pbreit pbreitenb...@gmail.com wrote:
 Also, extra_fields was recently added:

 - auth.settings.extra_fields['auth_user'].append(Field('country'))
 allows to extend auth_* tables without need of definiting a custom
 auth_* table. Must be placed before auth.define_tables()


[web2py] Command line authentication (in one line?)

2011-07-26 Thread Richard Vézina
Hello,

I would like to know if this still the proper way to login in web2py command
line shell :

http://stackoverflow.com/questions/6637824/command-line-authentication-in-web2py

Or if there is a new one line command as Massimo was expecting to write...

Thanks

Richard


[web2py] important , help me please

2011-07-26 Thread Web2Py Freak
am losing my mind  ... i am making the blogs i told u about , but with
images and videos  .. but every post gets all the images and
videos  .. why :(( :: like this


here is my Code   please guys help me . am going crazy



db.py:
import datetime
now=datetime.datetime.today()



db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))





db.blogposts.title.requires = [IS_NOT_EMPTY(),
IS_NOT_IN_DB(db,db.blogposts.title)]
db.blogposts.author.requires = IS_NOT_EMPTY()
db.blogposts.post.requires = IS_NOT_EMPTY()

db.define_table('blogcomments',
SQLField('url', default=''),
SQLField('blogpost_id'), # the blogpost this comment
belongs to
SQLField('email', default='y...@something.com'),
SQLField('author'),
SQLField('datetime', 'datetime',default=now),
SQLField('comment', 'text'))

db.blogcomments.author.requires = IS_NOT_EMPTY()
db.blogcomments.comment.requires = IS_NOT_EMPTY()
db.blogcomments.email.requires = IS_EMAIL()

db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('image','upload'))

db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
(title)s')

db.define_table('youtube',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
db.youtube.title.requires = IS_NOT_IN_DB(db, db.youtube.title)
db.youtube.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
(title)s')

db.define_table('vimo',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
db.vimo.title.requires = IS_NOT_IN_DB(db, db.vimo.title)
db.vimo.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%(title)s')



controler:
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without
limitations

#
import datetime

def getpostsandcomments():

blogposts = db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)
 
youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)

#
def createblogpost():

myd = getpostsandcomments()
 
form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd

def index():

return getpostsandcomments()

def createblogpost():

myd = getpostsandcomments()
form=SQLFORM(db.blogposts,fields=['title','post','author'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd



def showblogpost():
images=db(db.image.blog_id ==
db.blogposts.id).select(db.image.ALL)
youtube=db(db.youtube.blog_id ==
db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id == db.blogposts.id).select(db.vimo.ALL)
myd = getpostsandcomments()

blogid = request.args[0]
singleblogpost = db(db.blogposts.id == blogid).select()[0]
singleblogpost_comments = db(db.blogcomments.blogpost_id ==
blogid).select(orderby=~db.blogcomments.datetime)

db.blogcomments.blogpost_id.default=singleblogpost.id
form=SQLFORM(db.blogcomments,fields=['author', 'email',
'comment'],labels={'author':'Your Name', 'email':'Your email address',
'comment':'Comment'})
if form.accepts(request.vars,session):
blogpostupdate=db(db.blogposts.id==blogid).select()
if len(blogpostupdate)0:
 
blogpostupdate[0].update_record(numcomments=blogpostupdate[0].numcomments
+ 1)
redirect('/' + request.application + /default/showblogpost/
+ 

[web2py] Re: appadmin - insert new auth_permission

2011-07-26 Thread Anthony
The problem is the 'requires' for the table_name field is set at the time 
the permissions table is created:
 
table.table_name.requires = 
IS_EMPTY_OR(IS_IN_SET(self.db.tables))
 
 
and at that time, db.tables only includes the names of the tables that have 
already been defined.
 
As a workaround, you can add the following line somewhere after your last 
table definition (or possibly at the top of the appadmin.py file):
 
auth.settings.table_permission.table_name.requires=IS_EMPTY_OR(IS_IN_SET(db.tables))
 
 
Anthony

On Tuesday, July 26, 2011 6:26:59 AM UTC-4, Marin wrote:

 Hi, 
 while inserting new auth_permission entries via appadmin, you can 
 choose only tables that are defined before auth_permission table 
 (auth_user, auth_groups, auth_membership, auth_permission included). 
 Custom table (db.define_table(...)) is visible only if defined before 
 auth tables. 

 db.py file in welcome app suggests defining tables at the end of file, 
 so no custom tables are visible that way. 

 Should this be treated as a bug? 

 Regards, 
 Marin



[web2py] how to hide arguments passed in url in sql update form

2011-07-26 Thread sagar
Hi,

I have created sql form

  form=SQLFORM(db.test)

if id is present:

  update=updatetest/+ str(id)

  redirect(URL(update))

Is there any way to hide passed argument in url for update form..


Thanks,
Sagar




Re: [web2py] important , help me please

2011-07-26 Thread Richard Vézina
You should read at :
http://web2py.com/book/default/chapter/06?search=left+join#Left-Outer-Join

You need left join...

Write your query at in raw SQL then write it in web2py...

If you can't write the proper query in raw SQL you maybe have a wrong
database schema...

You are trying to do something liket this :

SELECT blogposts.title, youtube.title
FROM blogposts
LEFT OUTER JOIN youtube
ON (blog.blog_id = blogposts.id)

You will have more then one row with this query if you have more then one
youtube video title linked to your blogpost record... You maybe want to
aggregate...

Richard

On Tue, Jul 26, 2011 at 11:16 AM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 am losing my mind  ... i am making the blogs i told u about , but with
 images and videos  .. but every post gets all the images and
 videos  .. why :(( :: like this


 here is my Code   please guys help me . am going crazy



 
 db.py:
 import datetime
 now=datetime.datetime.today()



 db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))





 db.blogposts.title.requires = [IS_NOT_EMPTY(),
 IS_NOT_IN_DB(db,db.blogposts.title)]
 db.blogposts.author.requires = IS_NOT_EMPTY()
 db.blogposts.post.requires = IS_NOT_EMPTY()

 db.define_table('blogcomments',
SQLField('url', default=''),
SQLField('blogpost_id'), # the blogpost this comment
 belongs to
SQLField('email', default='y...@something.com'),
SQLField('author'),
SQLField('datetime', 'datetime',default=now),
SQLField('comment', 'text'))

 db.blogcomments.author.requires = IS_NOT_EMPTY()
 db.blogcomments.comment.requires = IS_NOT_EMPTY()
 db.blogcomments.email.requires = IS_EMAIL()


 db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('image','upload'))

 db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
 db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')


 db.define_table('youtube',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
 db.youtube.title.requires = IS_NOT_IN_DB(db, db.youtube.title)
 db.youtube.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')


 db.define_table('vimo',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
 db.vimo.title.requires = IS_NOT_IN_DB(db, db.vimo.title)
 db.vimo.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%(title)s')



 
 controler:
 # -*- coding: utf-8 -*-
 # this file is released under public domain and you can use without
 limitations

 #
 import datetime

 def getpostsandcomments():

blogposts = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)

 youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)

 #
 def createblogpost():

myd = getpostsandcomments()

 form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd

 def index():

return getpostsandcomments()

 def createblogpost():

myd = getpostsandcomments()
form=SQLFORM(db.blogposts,fields=['title','post','author'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd



 def showblogpost():
images=db(db.image.blog_id ==
 db.blogposts.id).select(db.image.ALL)
youtube=db(db.youtube.blog_id ==
 db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id == db.blogposts.id).select(db.vimo.ALL)
myd = 

Re: [web2py] Re: multiselect with part of a table

2011-07-26 Thread Nicolas Palumbo
I'm currently having a problem with this validation:

db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),
'instance.id',db.instance._format,multiple=True)
If the user changes the profile to other product and susbscribe to
instances shown for that product, the previously selected instances
are wiped away from the list, I'd like the instances to remain... even
if the select is updated, how can I solve this?

On Fri, Jul 15, 2011 at 5:48 PM, Nicolas Palumbo napalu...@gmail.com wrote:
 works perfect. Thanks!



[web2py] Bugs release 1.97.1

2011-07-26 Thread Nekron
Hello Massimo,

I recently installed web2py for a small customer project and found
that the online shell access is no longer working. I compared the
contrib/shell.py with an older working version and I do see that you
added a represent(obj) method. Launching the online shell this gaves
me:

Traceback (most recent call last):
  File E:\web2py\gluon\restricted.py, line 192, in restricted
exec ccode in environment
  File E:/web2py/applications/admin/controllers/shell.py, line 47,
in module
  File E:\web2py\gluon\globals.py, line 137, in lambda
self._caller = lambda f: f()
  File E:/web2py/applications/admin/controllers/shell.py, line 35,
in callback
output = gluon.contrib.shell.run(history,command,environ)
  File E:\web2py\gluon\contrib\shell.py, line 258, in run
history.set_global(name, val)
  File E:\web2py\gluon\contrib\shell.py, line 104, in set_global
blob = cPickle.dumps(value)
  File c:\python27\lib\copy_reg.py, line 70, in _reduce_ex
raise TypeError, can't pickle %s objects % base.__name__
TypeError: can't pickle StringO objects

To fix this I replace shell.py with an older version.

The second thing I found out was running the rocket webserver for port
8000 (http) and 8443 (https) on a single web2py instance using the
interfaces. This works like a champ if you launch it from command
line, however if you install web2py as a Windows service this doesnt
work. To fix this simply add interface=options.interfaces to the
start() method of winservice.py at line #131.





[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
ITS not working ???!


Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
It's a lot of code to review... If you point me the exact code that cause
problem it will help to solve your issue faster...

Also... What's not working?

Richard

On Tue, Jul 26, 2011 at 12:05 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 ITS not working ???!


Re: [web2py] important , help me please

2011-07-26 Thread Richard Vézina
Notice that SQLField is deprecated, we now use Field('field1','typeX'...)

Richard

On Tue, Jul 26, 2011 at 11:16 AM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 am losing my mind  ... i am making the blogs i told u about , but with
 images and videos  .. but every post gets all the images and
 videos  .. why :(( :: like this


 here is my Code   please guys help me . am going crazy



 
 db.py:
 import datetime
 now=datetime.datetime.today()



 db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))





 db.blogposts.title.requires = [IS_NOT_EMPTY(),
 IS_NOT_IN_DB(db,db.blogposts.title)]
 db.blogposts.author.requires = IS_NOT_EMPTY()
 db.blogposts.post.requires = IS_NOT_EMPTY()

 db.define_table('blogcomments',
SQLField('url', default=''),
SQLField('blogpost_id'), # the blogpost this comment
 belongs to
SQLField('email', default='y...@something.com'),
SQLField('author'),
SQLField('datetime', 'datetime',default=now),
SQLField('comment', 'text'))

 db.blogcomments.author.requires = IS_NOT_EMPTY()
 db.blogcomments.comment.requires = IS_NOT_EMPTY()
 db.blogcomments.email.requires = IS_EMAIL()


 db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('image','upload'))

 db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
 db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')


 db.define_table('youtube',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
 db.youtube.title.requires = IS_NOT_IN_DB(db, db.youtube.title)
 db.youtube.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')


 db.define_table('vimo',Field('blog_id',db.blogposts),Field('title'),Field('discription','text'),Field('code'))
 db.vimo.title.requires = IS_NOT_IN_DB(db, db.vimo.title)
 db.vimo.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%(title)s')



 
 controler:
 # -*- coding: utf-8 -*-
 # this file is released under public domain and you can use without
 limitations

 #
 import datetime

 def getpostsandcomments():

blogposts = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)

 youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)

 #
 def createblogpost():

myd = getpostsandcomments()

 form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd

 def index():

return getpostsandcomments()

 def createblogpost():

myd = getpostsandcomments()
form=SQLFORM(db.blogposts,fields=['title','post','author'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd



 def showblogpost():
images=db(db.image.blog_id ==
 db.blogposts.id).select(db.image.ALL)
youtube=db(db.youtube.blog_id ==
 db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id == db.blogposts.id).select(db.vimo.ALL)
myd = getpostsandcomments()

blogid = request.args[0]
singleblogpost = db(db.blogposts.id == blogid).select()[0]
singleblogpost_comments = db(db.blogcomments.blogpost_id ==
 blogid).select(orderby=~db.blogcomments.datetime)

db.blogcomments.blogpost_id.default=singleblogpost.id
form=SQLFORM(db.blogcomments,fields=['author', 'email',
 'comment'],labels={'author':'Your Name', 'email':'Your email address',
 'comment':'Comment'})
if form.accepts(request.vars,session):

[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
it gets all the images and the videos   ...


[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
this is the code for adding an image to a blog :  when i use it it
gets all the images to all the blogs
...
db.py:


import datetime
now=datetime.datetime.today()
db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))
db.blogposts.title.requires = [IS_NOT_EMPTY(),
IS_NOT_IN_DB(db,db.blogposts.title)]
db.blogposts.author.requires = IS_NOT_EMPTY()
db.blogposts.post.requires = IS_NOT_EMPTY()

db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field( 
'discription','text'),Field('image','upload'))
db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
(title)s')

.
controler:

blogposts = db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)
youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)


.

view:

{{for photo in images:}}
div style=width:200px ; margin-left:200px
div style=width:200px;margin-left:50px
 pb{{=XML(photo.title)}}/b/p
 /div
img width=200px
 src={{=URL('download', args=photo.image)}} /
 div style=width:200px;margin-left:50px
 p{{=XML(photo.discription)}}/p
 /div
 div
{{pass}}


[web2py] Re: important , help me please

2011-07-26 Thread pbreit
What you are trying to do is a bit complicated and your code is very hard to 
follow so it's difficult to help. One thing you might consider doing is 
*radically* simplifying.

For starters, you are doing quite a number of non-standard things. For 
example, SQLField is not really used any more. Instead use Field. You 
can use request.now for the current datatime. For author, you would 
usually use either a reference (Field('author', db.auth_user)) or 
default=auth.user_id.

To put all of those objects together on one page you're going to have to 
create a complicated queries and then come complicated code. Just to get 
posts and comments, you might need to do something like:

{{for blogpost in blogposts:}}
{{= blogpost.text}}
{{for blogcomment in blogcomments:}}
{{if blogcomment.post==blogpost.id:}}
{{=blogcomment.comment}}
{{pass}}
{{pass}}
{{pass}}

There's probably a more efficient way to do it.



Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)

Here you are saying to the database to do exactly what you don't want...

You should pass the id of your db.blogposts and not all the ids...

Try :

images=db(db.image.blog_id==1).select(db.image.ALL)

If there is a blogposts that have id 1... You should have only the images
associates to this blogposts record...

Richard


On Tue, Jul 26, 2011 at 12:19 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 this is the code for adding an image to a blog :  when i use it it
 gets all the images to all the blogs
 ...
 db.py:


 import datetime
 now=datetime.datetime.today()
 db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))
 db.blogposts.title.requires = [IS_NOT_EMPTY(),
 IS_NOT_IN_DB(db,db.blogposts.title)]
 db.blogposts.author.requires = IS_NOT_EMPTY()
 db.blogposts.post.requires = IS_NOT_EMPTY()

 db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field(
 'discription','text'),Field('image','upload'))
 db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
 db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')

 .
 controler:

 blogposts = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)
 youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)


 .

 view:

 {{for photo in images:}}
 div style=width:200px ; margin-left:200px
 div style=width:200px;margin-left:50px
 pb{{=XML(photo.title)}}/b/p
 /div
 img width=200px
 src={{=URL('download', args=photo.image)}} /
 div style=width:200px;margin-left:50px
 p{{=XML(photo.discription)}}/p
 /div
 div
 {{pass}}



[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
id tryed it and it WORKS but why dosent it work why we but
db.image.blog_id==db.blogpost.id


Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
Then depending of your URL format... You will request the id of your
blogposts table passed in the URL... Of course when you create a new record
in blogposts table there will have no ID since you are creating it.

request.args(1) I guess could containt your blogposts id if your URL looks
like this :

http://127.0.0.1:8000/app/controller/function/table/1

Richard




On Tue, Jul 26, 2011 at 12:28 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)

 Here you are saying to the database to do exactly what you don't want...

 You should pass the id of your db.blogposts and not all the ids...

 Try :

 images=db(db.image.blog_id==1).select(db.image.ALL)

 If there is a blogposts that have id 1... You should have only the images
 associates to this blogposts record...

 Richard


 On Tue, Jul 26, 2011 at 12:19 PM, Web2Py Freak halna...@gardeniatelco.com
  wrote:

 this is the code for adding an image to a blog :  when i use it it
 gets all the images to all the blogs
 ...
 db.py:


 import datetime
 now=datetime.datetime.today()
 db.define_table('blogposts',
   SQLField('title', length=64),
   SQLField('author', default=session.username),
   SQLField('datetime', 'datetime',default=now),
   SQLField('post', 'text'),
   SQLField('numcomments', 'integer',default=0))
 db.blogposts.title.requires = [IS_NOT_EMPTY(),
 IS_NOT_IN_DB(db,db.blogposts.title)]
 db.blogposts.author.requires = IS_NOT_EMPTY()
 db.blogposts.post.requires = IS_NOT_EMPTY()

 db.define_table('image',Field('blog_id',db.blogposts),Field('title'),Field(
 'discription','text'),Field('image','upload'))
 db.image.title.requires = IS_NOT_IN_DB(db, db.image.title)
 db.image.blog_id.requires = IS_IN_DB(db, db.blogposts.id, '%
 (title)s')

 .
 controler:

 blogposts = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
images=db(db.image.blog_id==db.blogposts.id).select(db.image.ALL)
 youtube=db(db.youtube.blog_id==db.blogposts.id).select(db.youtube.ALL)
vimo=db(db.vimo.blog_id==db.blogposts.id).select(db.vimo.ALL)
return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)


 .

 view:

 {{for photo in images:}}
 div style=width:200px ; margin-left:200px
 div style=width:200px;margin-left:50px
 pb{{=XML(photo.title)}}/b/p
 /div
 img width=200px
 src={{=URL('download', args=photo.image)}} /
 div style=width:200px;margin-left:50px
 p{{=XML(photo.discription)}}/p
 /div
 div
 {{pass}}





Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
db.blogpost.id containt all the id of the record containt in your blogpost
table...

db.blogpost.id is a short cut for :

db().select(db.blogpost.id)

Richard

On Tue, Jul 26, 2011 at 12:32 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 id tryed it and it WORKS but why dosent it work why we but
 db.image.blog_id==db.blogpost.id


[web2py] Re: how to hide arguments passed in url in sql update form

2011-07-26 Thread pbreit
I suppose you could put the id in session but why?

[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
when i do it ==1 it gets me the image with the blog_id=1  so i get the
same image  for all the posts


[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
 what can i do now !!?? what do u suggest


Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
Just correct myself

db.blogpost.id containt blogpost.id or tablename.fieldname

Richard

On Tue, Jul 26, 2011 at 12:35 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 db.blogpost.id containt all the id of the record containt in your blogpost
 table...

 db.blogpost.id is a short cut for :

 db().select(db.blogpost.id)

 Richard


 On Tue, Jul 26, 2011 at 12:32 PM, Web2Py Freak halna...@gardeniatelco.com
  wrote:

 id tryed it and it WORKS but why dosent it work why we but
 db.image.blog_id==db.blogpost.id





Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
== is comparison
= is affectation

It's python stuff...

Richard

On Tue, Jul 26, 2011 at 12:37 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

 when i do it ==1 it gets me the image with the blog_id=1  so i get the
 same image  for all the posts


Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
I suggest you make some lecture...

You seems to have some learning to do before make a complex application like
you want to...

Web2py book is a good start :

http://web2py.com/book

There is a python recap tutorial : http://web2py.com/book/default/chapter/02

It could help you a lot to read it.

Richard

On Tue, Jul 26, 2011 at 12:39 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

  what can i do now !!?? what do u suggest


[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
 it gives me an error :


web2py™ administrative interface
site
edit
about
errors
versioning
logout
help
ERROR TICKET FOR AZEZ_BLOGS
TICKET ID
127.0.0.1.2011-07-26.19-44-44.cf0e1a41-6450-4144-bb1b-b8aad512a50a

VERSION
web2py™ Version 1.96.4 (2011-06-07 21:08:15)
Python  Python 2.5.4: C:\Users\Hassan\Desktop\web2py\web2py.exe
TRACEBACK
1.
2.
3.
4.
5.
6.
7.
8.
Traceback (most recent call last):
  File gluon/restricted.py, line 192, in restricted
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py, line 124, in module
  File gluon/globals.py, line 137, in lambda
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py, line 34, in index
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
controllers/default.py, line 15, in getpostsandcomments
NameError: global name 'image' is not defined
ERROR SNAPSHOT
type 'exceptions.NameError'(global name 'image' is not defined)

inspect attributes

Frames
File C:\Users\Hassan\Desktop\web2py\gluon\restricted.py in restricted
at line 192
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in module at line 124
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\gluon\globals.py in lambda at
line 137
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in index at line 34
code

arguments

variables

File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
\default.py in getpostsandcomments at line 15
code

arguments

variables

Function argument list
()

Code listing
10.
11.
12.
13.
14.
15.

16.
17.
18.
19.

blogpostss= db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
images=db(image.blog_id==blogposts.id).select(db.image.ALL)

youtube=db().select(db.youtube.ALL)
vimo=db().select(db.vimo.ALL)

return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)
Variables
Context
locals

request

session

response

IN FILE: C:\USERS\HASSAN\DESKTOP\WEB2PY\APPLICATIONS\AZEZ_BLOGS
\CONTROLLERS/DEFAULT.PY
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without
limitations

#
import datetime
#db.youtube.blog_id == db.blogposts.id
#db.vimo.blog_id == db.blogposts.id
#db.image.blog_id == db.blogposts.id
def getpostsandcomments():

blogpostss= db().select(db.blogposts.ALL,
orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
db.blogcomments.blogpost_id, db.blogposts.title,
orderby=~db.blogcomments.datetime)
images=db(image.blog_id==blogposts.id).select(db.image.ALL)
youtube=db().select(db.youtube.ALL)
vimo=db().select(db.vimo.ALL)

return dict(blogposts=blogposts,
blogposts_numcomments=blogposts_numcomments,
comments=comments,images=images,youtube=youtube,vimo=vimo)

#
def createblogpost():

myd = getpostsandcomments()
 
form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd

def index():

return getpostsandcomments()

def createblogpost():

myd = getpostsandcomments()
form=SQLFORM(db.blogposts,fields=['title','post','author'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 redirect('/' + request.application + /default/index)
myd['form'] = form
return myd



def showblogpost():
images=db(db.image.blog_id ==
db.blogposts.id).select(db.image.ALL)
youtube=db(db.youtube.blog_id ==

Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
I suggest you to make your app by small steps... Small steps theory... When
all the little steps will work correctly you will get your app the way you
want it... And you will also understand what you wrote.

When you face a problem you ask the list and you solve one single issue at a
time...

Richard

On Tue, Jul 26, 2011 at 12:45 PM, Web2Py Freak
halna...@gardeniatelco.comwrote:

  it gives me an error :


 web2py™ administrative interface
 site
 edit
 about
 errors
 versioning
 logout
 help
 ERROR TICKET FOR AZEZ_BLOGS
 TICKET ID
 127.0.0.1.2011-07-26.19-44-44.cf0e1a41-6450-4144-bb1b-b8aad512a50a

 VERSION
 web2py™ Version 1.96.4 (2011-06-07 21:08:15)
 Python  Python 2.5.4: C:\Users\Hassan\Desktop\web2py\web2py.exe
 TRACEBACK
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 Traceback (most recent call last):
  File gluon/restricted.py, line 192, in restricted
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
 controllers/default.py, line 124, in module
  File gluon/globals.py, line 137, in lambda
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
 controllers/default.py, line 34, in index
  File C:/Users/Hassan/Desktop/web2py/applications/Azez_blogs/
 controllers/default.py, line 15, in getpostsandcomments
 NameError: global name 'image' is not defined
 ERROR SNAPSHOT
 type 'exceptions.NameError'(global name 'image' is not defined)

 inspect attributes

 Frames
 File C:\Users\Hassan\Desktop\web2py\gluon\restricted.py in restricted
 at line 192
 code

 arguments

 variables

 File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
 \default.py in module at line 124
 code

 arguments

 variables

 File C:\Users\Hassan\Desktop\web2py\gluon\globals.py in lambda at
 line 137
 code

 arguments

 variables

 File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
 \default.py in index at line 34
 code

 arguments

 variables

 File C:\Users\Hassan\Desktop\web2py\applications\Azez_blogs\controllers
 \default.py in getpostsandcomments at line 15
 code

 arguments

 variables

 Function argument list
 ()

 Code listing
 10.
 11.
 12.
 13.
 14.
 15.

 16.
 17.
 18.
 19.

blogpostss= db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
 images=db(image.blog_id==blogposts.id).select(db.image.ALL)

youtube=db().select(db.youtube.ALL)
vimo=db().select(db.vimo.ALL)

return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)
 Variables
 Context
 locals

 request

 session

 response

 IN FILE: C:\USERS\HASSAN\DESKTOP\WEB2PY\APPLICATIONS\AZEZ_BLOGS
 \CONTROLLERS/DEFAULT.PY
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.
 28.
 29.
 30.
 31.
 32.
 33.
 34.
 35.
 36.
 37.
 38.
 39.
 40.
 41.
 42.
 43.
 44.
 45.
 46.
 47.
 48.
 49.
 50.
 51.
 52.
 53.
 54.
 55.
 56.
 57.
 58.
 59.
 60.
 61.
 62.
 63.
 64.
 65.
 66.
 67.
 68.
 69.
 70.
 71.
 72.
 73.
 74.
 75.
 76.
 77.
 78.
 79.
 80.
 81.
 82.
 83.
 84.
 85.
 86.
 87.
 88.
 89.
 90.
 91.
 92.
 93.
 94.
 95.
 96.
 97.
 98.
 99.
 100.
 101.
 102.
 103.
 104.
 105.
 106.
 107.
 108.
 109.
 110.
 111.
 112.
 113.
 114.
 115.
 116.
 117.
 118.
 119.
 120.
 121.
 122.
 123.
 124.
 125.
 # -*- coding: utf-8 -*-
 # this file is released under public domain and you can use without
 limitations

 #
 import datetime
 #db.youtube.blog_id == db.blogposts.id
 #db.vimo.blog_id == db.blogposts.id
 #db.image.blog_id == db.blogposts.id
 def getpostsandcomments():

blogpostss= db().select(db.blogposts.ALL,
 orderby=~db.blogposts.datetime)
blogposts_numcomments = db().select(db.blogposts.ALL,
 orderby=~db.blogposts.numcomments|~db.blogposts.datetime)
commentsnposts = db(db.blogcomments.blogpost_id ==
 db.blogposts.id)
comments = commentsnposts.select(db.blogcomments.author,
 db.blogcomments.blogpost_id, db.blogposts.title,
 orderby=~db.blogcomments.datetime)
 images=db(image.blog_id==blogposts.id).select(db.image.ALL)
youtube=db().select(db.youtube.ALL)
vimo=db().select(db.vimo.ALL)

return dict(blogposts=blogposts,
 blogposts_numcomments=blogposts_numcomments,
 comments=comments,images=images,youtube=youtube,vimo=vimo)

 #
 def createblogpost():

myd = getpostsandcomments()

 form=SQLFORM(db.blogposts,fields=['title','post','author','video','audio'])
if form.accepts(request.vars,session):
 response.flash='new blogpost inserted'
 

[web2py] Re: checkbox labels

2011-07-26 Thread peter
Thanks Anthony both useful answers. I had tried _cellspacing (by
guessing) and it had not worked for me, but I think I must have
misplaced it. It works now.
Peter

On Jul 26, 3:01 pm, Anthony abasta...@gmail.com wrote:
 Do you want the label in the same table cell as the checkbox? If so, you
 should wrap the INPUT and label in a TD (as is, TR is assuming you want two
 separate TD's). So, you could do:

 TR(TD(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label)))

 To control cellspacing, add _cellspacing='[number]' to your TABLE() helper
 (in general, you can add any attribute to an HTML tag by preceding it with
 an underscore).

 Anthony



 On Tuesday, July 26, 2011 7:21:57 AM UTC-4, peter wrote:
  I am trying to use checkboxes in a form. I want several, one above
  each other. Each must have a label just to their right.

  If I use
  TR(INPUT(_type=checkbox,_name=checkbox1,value=on), box_label))

  Then there are a lot of spaces between the checkbox and 'box_label'. I
  have tried a lot of different things but cannot get rid of the spaces.
  'Cellspacing' does not seem to be changeable in web2py. Presumably
  there is a way to contol cell spacing can anyone enlighten me.

  I want to have the checkbox, one space and then the label.

  Thanks
  Peter- Hide quoted text -

 - Show quoted text -


[web2py] The web2py book is broken

2011-07-26 Thread Matt Gorecki
A quick FYI.  http://www.web2py.com/book is throwing errors right now.

Matt


[web2py] Problems with online book?

2011-07-26 Thread mikech
Getting an  Internal Error
Ticket issued: 
unrecoverablehttp://www.web2py.com/admin/default/ticket/unrecoverable

when I try to access the book from the web2py front page.


Re: [web2py] Problems with online book?

2011-07-26 Thread Ismael Serratos
I've just triend and it's working fine for me

On Tue, Jul 26, 2011 at 12:17 PM, mikech mp.ch...@gmail.com wrote:

 Getting an  Internal Error
 Ticket issued: 
 unrecoverablehttp://www.web2py.com/admin/default/ticket/unrecoverable

 when I try to access the book from the web2py front page.



Re: [web2py] Problems with online book?

2011-07-26 Thread Ismael Serratos
ohh I've catched

 If you go trough the documentation page (http://web2py.com/book) you get
the error, try with http://www.web2py.com/book may be a DNS mistake or even
a routing problem..

On Tue, Jul 26, 2011 at 12:18 PM, Ismael Serratos ialejandr...@gmail.comwrote:

 I've just triend and it's working fine for me


 On Tue, Jul 26, 2011 at 12:17 PM, mikech mp.ch...@gmail.com wrote:

 Getting an  Internal Error
 Ticket issued: 
 unrecoverablehttp://www.web2py.com/admin/default/ticket/unrecoverable

 when I try to access the book from the web2py front page.





Re: [web2py] Problems with online book?

2011-07-26 Thread cjrh
I get the ticket error on both URLs.

[web2py] Re: Bugs release 1.97.1

2011-07-26 Thread cjrh
I strongly recommend that you add an issue for this on the web2py bug 
tracker (Google Code):

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


[web2py] jQplot

2011-07-26 Thread steveL

Has anyone installed jQplot on their web2py servers.

Which directory should it be installed into   and how should I include
it in my application

Anyone got a simple example floating about of their views in relation
to where it was stored?

Thanks in advance

Steve

+


Re: [web2py] Problems with online book?

2011-07-26 Thread Ismael Serratos
 http://www.web2py.com/book This is working fine here :S

On Tue, Jul 26, 2011 at 12:40 PM, cjrh caleb.hatti...@gmail.com wrote:

 I get the ticket error on both URLs.


Re: [web2py] Problems with online book?

2011-07-26 Thread Bruno Rocha
May be it is a Marketing strategy, making you all to buy the printed version
of the book! LOL...

(or just Massimo updating something)


Re: [web2py] Problems with online book?

2011-07-26 Thread Bruno Rocha
seend to be a routes problem (on web2py or on webserver)

http://www.web2py.com/plugins
http://www.web2py.com/ http://www.web2py.com/pluginslayouts
http://www.web2py.com/ http://www.web2py.com/pluginsbook

Every other app then the default one is broken.


[web2py] WindowsError 2 and markmin2pdf

2011-07-26 Thread Martin Weissenboeck
Hi,

I wanted to learn more markmin.
I have the examples from the documentation, markmin2html and markmin2latex
work fine:

 from markmin2html import markmin2html as mh
 m='hello **world**'
 print mh(m)
phello bworld/b/p
 from markmin2latex import markmin2latex as ml
 print ml(m)

\documentclass[12pt]{article}
*... shortened...*
\newpage
hello {\bf world}
\end{document}

But markmin2pdf answered with an error

 from markmin2pdf import markmin2pdf as mp
 mp(m)

Traceback (most recent call last):
  File pyshell#25, line 1, in module
mp(m)
  File C:\Python27\lib\site-packages\markmin2pdf.py, line 93, in
markmin2pdf
return latex2pdf(markmin2latex(text,image_mapper=image_mapper,
extra=extra))
  File C:\Python27\lib\site-packages\markmin2pdf.py, line 74, in latex2pdf
stderr=subprocess.PIPE)
  File C:\Python27\lib\subprocess.py, line 486, in call
return Popen(*popenargs, **kwargs).wait()
  File C:\Python27\lib\subprocess.py, line 672, in __init__
errread, errwrite)
  File C:\Python27\lib\subprocess.py, line 882, in _execute_child
startupinfo)
WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden
*(Means: System can't find the file)*



Any hints?
Regards, Martin


Re: [web2py] jQplot

2011-07-26 Thread Ismael Serratos
I've never used it, but I've use other javascript stuff, just place it in
static and call it from the view

On Tue, Jul 26, 2011 at 12:54 PM, steveL stephen_lean...@talk21.com wrote:


 Has anyone installed jQplot on their web2py servers.

 Which directory should it be installed into   and how should I include
 it in my application

 Anyone got a simple example floating about of their views in relation
 to where it was stored?

 Thanks in advance

 Steve

 +


Re: [web2py] jQplot

2011-07-26 Thread Ismael Serratos
{{response.files.append(URL(r=request,c='static/media/css',f='demo_table.css'))}}
{{response.files.append(URL(r=request,c='static/media/js',f='jquery.dataTables.min.js'))}}

Include it like this (this is a data tables example)

On Tue, Jul 26, 2011 at 1:02 PM, Ismael Serratos ialejandr...@gmail.comwrote:

 I've never used it, but I've use other javascript stuff, just place it in
 static and call it from the view


 On Tue, Jul 26, 2011 at 12:54 PM, steveL stephen_lean...@talk21.comwrote:


 Has anyone installed jQplot on their web2py servers.

 Which directory should it be installed into   and how should I include
 it in my application

 Anyone got a simple example floating about of their views in relation
 to where it was stored?

 Thanks in advance

 Steve

 +





[web2py] Re: important , help me please

2011-07-26 Thread Web2Py Freak
Thank you alot Richard , you are a great man :) .. it was nice talking
to u   ,  Do u mind if i take you Email and ask u questions  every
once in a while ?


Re: [web2py] Re: important , help me please

2011-07-26 Thread Richard Vézina
No problem... But better to ask to the list... You will have much larger
audience and much more answer to your questions.

Richard

On Tue, Jul 26, 2011 at 2:14 PM, Web2Py Freak halna...@gardeniatelco.comwrote:

 Thank you alot Richard , you are a great man :) .. it was nice talking
 to u   ,  Do u mind if i take you Email and ask u questions  every
 once in a while ?


Re: [web2py] Problems with online book?

2011-07-26 Thread Caleb Hattingh
hehe

On 26 July 2011 19:55, Bruno Rocha rochacbr...@gmail.com wrote:

 May be it is a Marketing strategy, making you all to buy the printed
 version of the book! LOL...

 (or just Massimo updating something)



[web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-26 Thread Wikus van de Merwe
Thanks for the hint! It was the logging indeed. Apparently the logging.conf 
that comes with web2py was
hiding the error:
ERROR2011-07-26 18:44:54,452 restricted.py:156] Traceback (most recent 
call last):
  File /home/momat/workspace/pm-cmp-python/web2py/gluon/main.py, line 531, 
in wsgibase
del response.cookies[response.session_id_name]
KeyError: 'session_id_init'

I find out this was cause by the session.forget() in my db.py. It looks like 
this way of disabling the session
is no longer supported (I guess it is disabled by default now).



Re: [web2py] The web2py book is broken

2011-07-26 Thread Kenneth Lundström

Hopefully it is fixed now because it works for me now.


Kenneth


A quick FYI.  http://www.web2py.com/book is throwing errors right now.

Matt




Re: [web2py] The web2py book is broken

2011-07-26 Thread Marin Pranjic
still not working 4me.


Re: [web2py] The web2py book is broken

2011-07-26 Thread Marin Pranjic
works now :D

On Tue, Jul 26, 2011 at 9:22 PM, Marin Pranjic marin.pran...@gmail.com wrote:
 still not working 4me.



Re: [web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-26 Thread Jonathan Lundell
On Jul 26, 2011, at 11:57 AM, Wikus van de Merwe wrote:

 Thanks for the hint! It was the logging indeed. Apparently the logging.conf 
 that comes with web2py was
 hiding the error:
 ERROR2011-07-26 18:44:54,452 restricted.py:156] Traceback (most recent 
 call last):
   File /home/momat/workspace/pm-cmp-python/web2py/gluon/main.py, line 531, 
 in wsgibase
 del response.cookies[response.session_id_name]
 KeyError: 'session_id_init'
 
 I find out this was cause by the session.forget() in my db.py. It looks like 
 this way of disabling the session
 is no longer supported (I guess it is disabled by default now).

I suspect that you're calling session.forget without calling session.connect. 

If you don't call session.connect, there's no need to call session.forget, and 
indeed it'll throw an exception when you try to delete the non-existent session 
cookie.

Re: [web2py] Problems with online book?

2011-07-26 Thread cjrh
Book is working again.

Re: [web2py] The web2py book is broken

2011-07-26 Thread cjrh
Confirmed.

Re: [web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-26 Thread Jonathan Lundell
On Jul 26, 2011, at 12:26 PM, Jonathan Lundell wrote:

 On Jul 26, 2011, at 11:57 AM, Wikus van de Merwe wrote:
 
 Thanks for the hint! It was the logging indeed. Apparently the logging.conf 
 that comes with web2py was
 hiding the error:
 ERROR2011-07-26 18:44:54,452 restricted.py:156] Traceback (most recent 
 call last):
   File /home/momat/workspace/pm-cmp-python/web2py/gluon/main.py, line 531, 
 in wsgibase
 del response.cookies[response.session_id_name]
 KeyError: 'session_id_init'
 
 I find out this was cause by the session.forget() in my db.py. It looks like 
 this way of disabling the session
 is no longer supported (I guess it is disabled by default now).
 
 I suspect that you're calling session.forget without calling session.connect. 
 
 If you don't call session.connect, there's no need to call session.forget, 
 and indeed it'll throw an exception when you try to delete the non-existent 
 session cookie.

Massimo, it'd be easy enough to tolerate this, by ignoring the KeyError...

Re: [web2py] Problems with online book?

2011-07-26 Thread Bruno Rocha
On Tue, Jul 26, 2011 at 4:34 PM, cjrh caleb.hatti...@gmail.com wrote:

 Book is working again.


WOW, it means that web2py printed book goes out-of-stock and the
selling campaign could be interrupted.  :)

But, don't lose your hope you can still find some copies to buy.. run to
lulu.com or amazon and buy yours now!


Re: [web2py] The web2py book is broken

2011-07-26 Thread Bruno Rocha
On Tue, Jul 26, 2011 at 4:34 PM, cjrh caleb.hatti...@gmail.com wrote:

 Confirmed.


Yep, it now working here! also /plugins http://web2py.com/plugins

:)


[web2py] Re: Bugs release 1.97.1

2011-07-26 Thread Massimo Di Pierro
Do you define StringO in your code?
Both the old web shell and the new web based shell have problems. The
issue is maintaining state and make it work on GAE. The shell we use
now is the one provided by Google.


On Jul 26, 10:14 am, Nekron du...@gmx.de wrote:
 Hello Massimo,

 I recently installed web2py for a small customer project and found
 that the online shell access is no longer working. I compared the
 contrib/shell.py with an older working version and I do see that you
 added a represent(obj) method. Launching the online shell this gaves
 me:

 Traceback (most recent call last):
   File E:\web2py\gluon\restricted.py, line 192, in restricted
     exec ccode in environment
   File E:/web2py/applications/admin/controllers/shell.py, line 47,
 in module
   File E:\web2py\gluon\globals.py, line 137, in lambda
     self._caller = lambda f: f()
   File E:/web2py/applications/admin/controllers/shell.py, line 35,
 in callback
     output = gluon.contrib.shell.run(history,command,environ)
   File E:\web2py\gluon\contrib\shell.py, line 258, in run
     history.set_global(name, val)
   File E:\web2py\gluon\contrib\shell.py, line 104, in set_global
     blob = cPickle.dumps(value)
   File c:\python27\lib\copy_reg.py, line 70, in _reduce_ex
     raise TypeError, can't pickle %s objects % base.__name__
 TypeError: can't pickle StringO objects

 To fix this I replace shell.py with an older version.

 The second thing I found out was running the rocket webserver for port
 8000 (http) and 8443 (https) on a single web2py instance using the
 interfaces. This works like a champ if you launch it from command
 line, however if you install web2py as a Windows service this doesnt
 work. To fix this simply add interface=options.interfaces to the
 start() method of winservice.py at line #131.


[web2py] Re: WindowsError 2 and markmin2pdf

2011-07-26 Thread Massimo Di Pierro
It requires latex. Do you have pdflatex installed on windows? How do
you run it from shell?

On Jul 26, 1:00 pm, Martin Weissenboeck mweis...@gmail.com wrote:
 Hi,

 I wanted to learn more markmin.
 I have the examples from the documentation, markmin2html and markmin2latex
 work fine:

  from markmin2html import markmin2html as mh
  m='hello **world**'
  print mh(m)

 phello bworld/b/p

  from markmin2latex import markmin2latex as ml
  print ml(m)

 \documentclass[12pt]{article}
 *... shortened...*
 \newpage
 hello {\bf world}
 \end{document}

 But markmin2pdf answered with an error

  from markmin2pdf import markmin2pdf as mp
  mp(m)

 Traceback (most recent call last):
   File pyshell#25, line 1, in module
     mp(m)
   File C:\Python27\lib\site-packages\markmin2pdf.py, line 93, in
 markmin2pdf
     return latex2pdf(markmin2latex(text,image_mapper=image_mapper,
 extra=extra))
   File C:\Python27\lib\site-packages\markmin2pdf.py, line 74, in latex2pdf
     stderr=subprocess.PIPE)
   File C:\Python27\lib\subprocess.py, line 486, in call
     return Popen(*popenargs, **kwargs).wait()
   File C:\Python27\lib\subprocess.py, line 672, in __init__
     errread, errwrite)
   File C:\Python27\lib\subprocess.py, line 882, in _execute_child
     startupinfo)
 WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden
 *(Means: System can't find the file)*



 Any hints?
 Regards, Martin


[web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-26 Thread Massimo Di Pierro
Done

On Jul 26, 2:36 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jul 26, 2011, at 12:26 PM, Jonathan Lundell wrote:

  On Jul 26, 2011, at 11:57 AM, Wikus van de Merwe wrote:

  Thanks for the hint! It was the logging indeed. Apparently the 
  logging.conf that comes with web2py was
  hiding the error:
  ERROR    2011-07-26 18:44:54,452 restricted.py:156] Traceback (most recent 
  call last):
    File /home/momat/workspace/pm-cmp-python/web2py/gluon/main.py, line 
  531, in wsgibase
      del response.cookies[response.session_id_name]
  KeyError: 'session_id_init'

  I find out this was cause by the session.forget() in my db.py. It looks 
  like this way of disabling the session
  is no longer supported (I guess it is disabled by default now).

  I suspect that you're calling session.forget without calling 
  session.connect.

  If you don't call session.connect, there's no need to call session.forget, 
  and indeed it'll throw an exception when you try to delete the non-existent 
  session cookie.

 Massimo, it'd be easy enough to tolerate this, by ignoring the KeyError...


[web2py] Re: Problems with online book?

2011-07-26 Thread Massimo Di Pierro
I apologize. The server run out of disk space.
Fortunately the database did not get corrupted. I did a lot of cleanup
and now everything should be up and running as usual.

Massimo

On Jul 26, 2:34 pm, cjrh caleb.hatti...@gmail.com wrote:
 Book is working again.


[web2py] Importing numeric values with import_from_csv_file

2011-07-26 Thread WillieD
Hi All,

I'm a Web2py nube so please excuse my ignorance if I'm missing
something obvious.

I'm trying to import a CSV file that includes some integer and double
values but DAL always inserts NULL in these fields. A little
inspection of the 'import_from_csv_file' function reveals that the
embedded fix() function sets values to None if the field type is
double or integer.


elif field.type in ('double','integer'):
value = None

Is there a reason for this that I'm not getting?

Thanks


[web2py] Upload File via HTTP

2011-07-26 Thread Ismael Serratos
Hi! I was wondering how could I upload a file to web2py from another PC
(intranet app) but via http, I mean, make a server and a client script.

Is it possible??

client does't have web2py, just python, server is running web2py.


Re: [web2py] Upload File via HTTP

2011-07-26 Thread Bruno Rocha
I did it with forms. Client needs to make a POST to web2py with input file
in form (make sure the right content type)

in web2py server create an action that does:

example:

#model
Field('picture','upload',uploadfolder=request.folder+'static/uploads',
autodelete=True )

#receiver
in form.accepts():
db.table.insert(picture=db.photo.picture.store(request.vars.Filedata.file,
request.vars.Filedata.filename))



On Tue, Jul 26, 2011 at 6:01 PM, Ismael Serratos ialejandr...@gmail.comwrote:

 Hi! I was wondering how could I upload a file to web2py from another PC
 (intranet app) but via http, I mean, make a server and a client script.

 Is it possible??

 client does't have web2py, just python, server is running web2py.




-- 



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


[web2py] Re: Importing numeric values with import_from_csv_file

2011-07-26 Thread WillieD
Converting value=None to pass in fix() does indeed let me import my
numeric data.

elif field.type in ('double','integer'):
pass #value = None



On Jul 26, 3:51 pm, WillieD wdul...@gmail.com wrote:
 Hi All,

 I'm a Web2py nube so please excuse my ignorance if I'm missing
 something obvious.

 I'm trying to import a CSV file that includes some integer and double
 values but DAL always inserts NULL in these fields. A little
 inspection of the 'import_from_csv_file' function reveals that the
 embedded fix() function sets values to None if the field type is
 double or integer.

             elif field.type in ('double','integer'):
                 value = None

 Is there a reason for this that I'm not getting?

 Thanks


[web2py] Re: DISCUSSION: Dual Desktop/Mobile Functionality

2011-07-26 Thread Rufus
I'm new to web2py but since I have an iphone I've been interested in
the mobile
view/standard view capability of web2py so I've been watching this
thread.

Could you possibly generalize display devices even more, to even
provide per-user
or per-session skinning of the web page, storing the display mode/
theme/skin
value in the session storage.  Then controllers and views could adjust
according
to their own abilities.


(to tell the truth, the mobile-enabled websites really tick me off
when there is no way for
me to force it back to the standard page.)


[web2py] Re: query quest

2011-07-26 Thread howesc
not sure about the web2py translation (that would take me some time to 
figure out since i have not done much grouping in web2py), but:

SELECT * FROM (SELECT * FROM power_curve ORDER BY start DESC) AS TMP 
GROUP BY site;

is not valid.  i'm surprised that it works on mysql server.  every column 
that appears in the select must be aggregated or part of the group by clause 
for the query to be valid.

based on a counting query i have done in the past:

start_max = db.curve.start.max()
db((db.curve.site==db.site.id)).select(start_max, db.site.id, 
groupby=db.site.id)

does that work, or at least get you started?

cfh


Re: [web2py] Re: DISCUSSION: Dual Desktop/Mobile Functionality

2011-07-26 Thread Jonathan Lundell
On Jul 26, 2011, at 3:12 PM, Rufus rufusvsm...@gmail.com wrote:

 (to tell the truth, the mobile-enabled websites really tick me off
 when there is no way for
 me to force it back to the standard page.)

It's a good point. I just visited a site that insisted that my iPad was an 
iPhone. I've seen sites that allow overriding the choice and getting the 
normal view.

[web2py] Re: DISCUSSION: Dual Desktop/Mobile Functionality

2011-07-26 Thread Chris May
I agree. It's very important to not annoy the site visitor by forcing
him into one view / solution / experience.

Judging by the parallel discussion in the developer group (http://
groups.google.com/group/web2py-developers/browse_thread/thread/
2056602a6c30af27#) and the corresponding issue request (http://
code.google.com/p/web2py/issues/detail?id=346), I believe a future
update will give site developers the ability to serve specific code to
specific devices.

Which means it will be up to us to give our users these options.


So all we will need are better educated web developers.

Is there a way to get web2py to do that for us? :)


On Jul 26, 6:39 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jul 26, 2011, at 3:12 PM, Rufus rufusvsm...@gmail.com wrote:
  (to tell the truth, the mobile-enabled websites really tick me off
  when there is no way for
  me to force it back to the standard page.)

 I've seen sites that allow overriding the choice and getting the normal 
 view.


[web2py] GAE and atomic inserts: DAL enhancement?

2011-07-26 Thread howesc
Hi GAE web2py users,

I ran into an issue today where i need to have atomic inserts into a GAE 
table.  in a normal database you can do a read/write lock and check if a row 
exists before you insert, and/or put unique constraints on columns to make 
this happen.  in GAE you can't.

the right answer on how to do this is 
here: 
http://code.google.com/appengine/docs/python/datastore/modelclass.html#Model_get_or_insert
and it assumes that you can generate a string key that would be predictable 
on multiple insert attempts.  (in my case i can)

now, i'd love to be able to use that with web2py, but web2py expects that 
all IDs are integers.  i think that a way to enhance DAL to work with this 
might be to:
 - use GAE reference properties for reference 
fields: 
http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#ReferenceProperty
 - allow user to set the GAE named key when they want to, otherwise let DAL 
and GAE assign an int ID
 - come up with a way (inside or outside of DAL) that allows us to use the 
get_or_insert() method of GAE models when desired.

before i dig into trying to create a patch for review, are there thoughts, 
concerns, gotchas, or other things i should think about?

thanks much for your time!

christian


[web2py] Re: New python web framework: Brubeck

2011-07-26 Thread pbreit
Here's another:
http://adeel.github.com/pump/

Pump: A dead simple Pythonic abstraction of HTTP.

I'm not exactly sure what the implications are but it seems like a good 
direction.


[web2py] Fedora deployment script issues on Amazon (and fixes)

2011-07-26 Thread Charles Law
I was recently deploying web2py on an amazon microinstance with an
amazon linux installation.  I relied mostly on the fedora script, but
I had to make some minor tweaks to the script (which consisted almost
entirely of removing uneeded EOF's).  Does the latest setup-web2py-
fedora.sh script work in Fedora?  If not, I have some fixes which I
think will make it w*ork.  If it does, I have a script that will let
uses deploy to an Amazon Linux installation.


[web2py] Integration MS Office ?

2011-07-26 Thread toan75
HI, 

How to integrate MS Word or Excel on the web2py site (to read, edit and save 
ms file type)? Have any examples?

Thanks your help.


[web2py] Rocket support IPv6

2011-07-26 Thread Rahul
Hi Tim, All,
Does Rocket support IPv6? If not, can we expect this to be
added to its feature set anytime soon ?

Rahul D


[web2py] Re: Image upload filenames too long

2011-07-26 Thread pbreit
Possible to shrink upload filenames down to 50 chars or so? Collisions seem 
unlikely.

[web2py] Re: Importing numeric values with import_from_csv_file

2011-07-26 Thread Massimo Di Pierro
This was fixed some time ago. It is possible the fix is still in
trunk. Will post a new version to stable soon.

On Jul 26, 4:32 pm, WillieD wdul...@gmail.com wrote:
 Converting value=None to pass in fix() does indeed let me import my
 numeric data.

 elif field.type in ('double','integer'):
                 pass #value = None

 On Jul 26, 3:51 pm, WillieD wdul...@gmail.com wrote:







  Hi All,

  I'm a Web2py nube so please excuse my ignorance if I'm missing
  something obvious.

  I'm trying to import a CSV file that includes some integer and double
  values but DAL always inserts NULL in these fields. A little
  inspection of the 'import_from_csv_file' function reveals that the
  embedded fix() function sets values to None if the field type is
  double or integer.

              elif field.type in ('double','integer'):
                  value = None

  Is there a reason for this that I'm not getting?

  Thanks


[web2py] Re: GAE and atomic inserts: DAL enhancement?

2011-07-26 Thread Massimo Di Pierro
Please open a ticket. This should be doable without too much work.

On Jul 26, 9:11 pm, howesc how...@umich.edu wrote:
 Hi GAE web2py users,

 I ran into an issue today where i need to have atomic inserts into a GAE
 table.  in a normal database you can do a read/write lock and check if a row
 exists before you insert, and/or put unique constraints on columns to make
 this happen.  in GAE you can't.

 the right answer on how to do this is
 here:http://code.google.com/appengine/docs/python/datastore/modelclass.htm...
 and it assumes that you can generate a string key that would be predictable
 on multiple insert attempts.  (in my case i can)

 now, i'd love to be able to use that with web2py, but web2py expects that
 all IDs are integers.  i think that a way to enhance DAL to work with this
 might be to:
  - use GAE reference properties for reference
 fields:http://code.google.com/appengine/docs/python/datastore/typesandproper...
  - allow user to set the GAE named key when they want to, otherwise let DAL
 and GAE assign an int ID
  - come up with a way (inside or outside of DAL) that allows us to use the
 get_or_insert() method of GAE models when desired.

 before i dig into trying to create a patch for review, are there thoughts,
 concerns, gotchas, or other things i should think about?

 thanks much for your time!

 christian


[web2py] Re: Fedora deployment script issues on Amazon (and fixes)

2011-07-26 Thread Massimo Di Pierro
I have not used it myself. I would like to see the fixes.

On Jul 26, 10:08 pm, Charles Law charles@gmail.com wrote:
 I was recently deploying web2py on an amazon microinstance with an
 amazon linux installation.  I relied mostly on the fedora script, but
 I had to make some minor tweaks to the script (which consisted almost
 entirely of removing uneeded EOF's).  Does the latest setup-web2py-
 fedora.sh script work in Fedora?  If not, I have some fixes which I
 think will make it w*ork.  If it does, I have a script that will let
 uses deploy to an Amazon Linux installation.


[web2py] Re: Image upload filenames too long

2011-07-26 Thread Massimo Di Pierro
No. We actually had to increase it in te past because of problems. Not
collisions but long table and filed names.

On Jul 27, 12:18 am, pbreit pbreitenb...@gmail.com wrote:
 Possible to shrink upload filenames down to 50 chars or so? Collisions seem
 unlikely.