[web2py] Re: Creating a cms with restricted video streaming access

2012-03-18 Thread Massimo Di Pierro
There is not but I am interested in heling develop something like it.

Massimo

On Saturday, 17 March 2012 07:53:04 UTC-5, Alan Etkin wrote:
>
> Hi. I have been asked to buiild a web site with these features and 
> requirements: 
>
> -Content managment for universitary students and teachers 
> Teachers will upload and edit course documents. 
> -Students must pay a fee to access the site's content. 
> -Students evaluation system with Q&A 
> -Online video classes 
> The site must allow (only authenticated) students to watch classes 
> live or from a site's class video archive. 
>
> Is there something already developed that I can use for this 
> requirements? I know there are lot of separated solutions (Martin's 
> Instant Press and I could mix them with more or less success, but I'd 
> like to know if someone found a starting project that covers this 
> requirements, so the development tasks can be decreased and there is 
> no need to reinvent the wheel. 
>
> For accessing video streams I am thinking of using a third-party brand 
> like vimeo or other similar, have anybody tested those services? 
>
> Could I use Instant Press for this project? Does it have this video 
> streaming features or should I develop something like an Instant Press 
> plugin for this case?. 
>
> Thank you.



[web2py] How do I group the list by value and make it table in HTML?

2012-03-18 Thread Kenny
I have
city_list = [('Huntsville', 'AL'), ('Decatur', 'AL'),
 ('Anchorage', 'NV'), ('Nome', 'AK'),('Selma', 'AL'),
 ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')]

And I want to list it in HTML.

I don't know what would be the best solution for this.

so Html will display

AL
Decatur
Huntsville
Selma

AZ
Flagstaff
Tucson
Phoenix



I don't care about sorting. The solution I can think of is use two for
loops and one if loop to search and display. I don't think this is not
a good approach.


[web2py] auth.settings and auth.messages

2012-03-18 Thread Annet
In db.py I set custom login and logged_out messages:

def set_login_message(form):
  session.logged_out_message='Succesvol uitgelogd, tot ziens ' +
auth.user.first_name + ' ' + auth.user.last_name
  session.flash=T('Succesvol ingelogd, welkom %(first_name)s %
(last_name)s',
 
dict(first_name=auth.user.first_name,last_name=auth.user.last_name))

auth.settings.login_onaccept=set_login_message
auth.messages.logged_out=session.logged_out_message

The problem is that when the user tries to access a function to which
he has no access he is being logged out and the logged_out message
gets displayed. This message doesn't give the user any clues as to why
he is being logged out. Setting this message:

auth.messages.access_denied='U heeft geen toegang tot deze functie, u
bent uitgelogd'

... doesn't solve the problem, the logged_out_message gets displayed.
Is there a way to solve this problem?


Kind regards,

Annet


[web2py] Re: How do I group the list by value and make it table in HTML?

2012-03-18 Thread Kenny
I think I will just do it with this way..
I created two lists (one is for states,one is for city and state)

And I just compared them by for loops. sorry for newb question as I am
new to python.

On 3월18일, 오전12시21분, Kenny  wrote:
> I have
> city_list = [('Huntsville', 'AL'), ('Decatur', 'AL'),
>  ('Anchorage', 'NV'), ('Nome', 'AK'),('Selma', 'AL'),
>  ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')]
>
> And I want to list it in HTML.
>
> I don't know what would be the best solution for this.
>
> so Html will display
>
> AL
> Decatur
> Huntsville
> Selma
>
> AZ
> Flagstaff
> Tucson
> Phoenix
>
> 
>
> I don't care about sorting. The solution I can think of is use two for
> loops and one if loop to search and display. I don't think this is not
> a good approach.


Re: [web2py] Creating a cms with restricted video streaming access

2012-03-18 Thread Bruno Rocha
I am building something like this using Movu.ca as base for the system. I
will use this on my course www.cursodepython.com.br, Now this course runs
with VIMEO plus and only registered students have access to videos. Now I
will extend with content-types in movu.ca



On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin  wrote:

> Hi. I have been asked to buiild a web site with these features and
> requirements:
>
> -Content managment for universitary students and teachers
> Teachers will upload and edit course documents.
> -Students must pay a fee to access the site's content.
> -Students evaluation system with Q&A
> -Online video classes
> The site must allow (only authenticated) students to watch classes
> live or from a site's class video archive.
>
> Is there something already developed that I can use for this
> requirements? I know there are lot of separated solutions (Martin's
> Instant Press and I could mix them with more or less success, but I'd
> like to know if someone found a starting project that covers this
> requirements, so the development tasks can be decreased and there is
> no need to reinvent the wheel.
>
> For accessing video streams I am thinking of using a third-party brand
> like vimeo or other similar, have anybody tested those services?
>
> Could I use Instant Press for this project? Does it have this video
> streaming features or should I develop something like an Instant Press
> plugin for this case?.
>
> Thank you.




-- 

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


[web2py] Re: No DB queries in web2py shell?

2012-03-18 Thread mart
I use an older version of that stateful AJAX shell (without any of the 
google app stuff) where i can just import dal.py, make a connection string 
to a database folder  (can use auto_import), then give 'db' to the shell's 
environment (its just a parameter) . Then you get cmd line access to a DB 
using DAL. A huge advantage is that you can write any function within the 
scope of the shell and access it at the cmd line with parameters (if a 
function takes any) I.e. a function that will print an ascii grid to the 
screen (lets call the function 'grid'), you can do:

$> grid query=db.auth_user.id>0 fields=id,name,email,email_password

or simply type something like that select command (or anything else 
supported by DAL)...

Setting up a shell this way works really well, has history of previous 
commands (with up and down arrow), and is really worth the time to setup. 
Especially given that you can tailor it to your own needs (and its 
re-usable, no matter the DB you are pointing to). I can send a template of 
the code if interested.

Mart

On Saturday, March 17, 2012 9:47:55 PM UTC-4, Anthony wrote:
>
> On Saturday, March 17, 2012 8:06:38 PM UTC-4, Stefan Scholl wrote:
>>
>> Anthony  wrote:
>> > I highly recommend just doing this:
>> > 
>> > python web2py.py -S myapp -M -N
>> > 
>> > in a regular shell, and skip the web-based shell. You can even do 
>>
>> There is no python executable in the Windows version of web2py.
>>
>
> In that case:
>
> web2py.exe -S myapp -M -N
>
> Though if you're going to do any serious work with web2py, you're probably 
> best off installing your own version of Python (preferably 2.7) and running 
> web2py from source. Once you've got Python installed, it's just as easy to 
> run web2py from source as it is to use the binary version (download, unzip, 
> click).
>
> Anthony 
>


[web2py] Re: list:reference and crud.create a form in a form or a popup (django style) recipe ?

2012-03-18 Thread Alan Etkin
I think that by default that table definition should show the
multiselect widget in CRUD forms. If not, it should be possible to set
it explicitly:

db.mytable.myfield.widget = SQLFORM.widgets.multiple.widget

And you can also create your own custom widgets by declaring a
function that receives field and value arguments and returns a helper.
For a detailed example check the online manual at 7.7 Widgets

On 17 mar, 11:11, bussiere adrien  wrote:
> Is there a recipe anywhere to show how to do when a i have a external
> reference in my db table as liste:reference
> to make it simple to add existing references or make a popup to create a
> new reference ?
>
> exemple :
> db.define_table('Film',
>    Field('nom'),
>    Field('Acteur','list:reference Acteur'),
>
> When i make a form1 = crud.create(db.Film)
> it sho me just a field and not menu as django or a field list or create a
> new one.
>
> Is there a recipe anywhere to do that ?
>
> Regards
> Bussiere


[web2py] Re: auth.settings and auth.messages

2012-03-18 Thread Alan Etkin
Maybe customizing the logout link (by binding it to another url and
after that calling the logout function)
That way you could set the logout message only if the user has logged
out by himself.

On 18 mar, 04:41, Annet  wrote:
> In db.py I set custom login and logged_out messages:
>
> def set_login_message(form):
>       session.logged_out_message='Succesvol uitgelogd, tot ziens ' +
> auth.user.first_name + ' ' + auth.user.last_name
>       session.flash=T('Succesvol ingelogd, welkom %(first_name)s %
> (last_name)s',
>
> dict(first_name=auth.user.first_name,last_name=auth.user.last_name))
>
> auth.settings.login_onaccept=set_login_message
> auth.messages.logged_out=session.logged_out_message
>
> The problem is that when the user tries to access a function to which
> he has no access he is being logged out and the logged_out message
> gets displayed. This message doesn't give the user any clues as to why
> he is being logged out. Setting this message:
>
> auth.messages.access_denied='U heeft geen toegang tot deze functie, u
> bent uitgelogd'
>
> ... doesn't solve the problem, the logged_out_message gets displayed.
> Is there a way to solve this problem?
>
> Kind regards,
>
> Annet


[web2py] Re: Represent problem.

2012-03-18 Thread Alan Etkin
Instead of the field representation, the row attribute returns the
stored value of the record, as expected.
Probably you can call the field represent functions for the required
behavior if you are not using sqltable

db.Edge.byNodeID.represent(row.byNodeID, row)
db.Edge.ofNodeID.represent(row.ofNodeID, row)

On 18 mar, 03:36, Annet  wrote:
> The table in db.py
>
> db.define_table('Edge',
>
> Field('hubID',db.Hub,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
>
> Field('byNodeID',db.Node,default='',notnull=True,ondelete='RESTRICT'),
>
> Field('ofNodeID',db.Node,default='',notnull=True,ondelete='CASCADE'),
>    ...
>     migrate=False)
>
> db.Edge.hubID.represent=lambda hubID, row:
> db(db.Hub.id==hubID).select().first().name
> db.Edge.byNodeID.represent=lambda byNodeID,
> row:db(db.Organization.nodeID==byNodeID).select().first().name
> db.Edge.ofNodeID.represent=lambda ofNodeID, row:
> db(db.Organization.nodeID==ofNodeID).select().first().name
>
> The function:
>
> @auth.requires(auth.has_membership(HUB) or auth.has_membership(ADMIN))
> def edge():
>     form=rows=rowcount=[]
>
> rows=rows=db(db.HubEdge.hubID==session.hubadminID).select(db.HubEdge.ALL)
>     return dict(rows=rows)
>
> When in the view I simply do:
>
> {{=rows}}
>
> The name of the Organization is being displayed. When I do:
>
> {{for row in rows:}}
>   
>     {{=row.byNodeID}}
>     {{=row.ofNodeID}}
>   
> {{pass}}
>
> ... the byNodeID and ofNodeID are being displayed. I guess there is
> something wrong syntactically?
>
> Kind regards,
>
> Annet


[web2py] Re: Creating a cms with restricted video streaming access

2012-03-18 Thread Alan Etkin
Bruno, are you planning to release a development version of the
movu.ca courseware as open source? If so, I could contribute, as I
probably will need a production implementation for the next months. I
think that my app would also use the vimeo PLUS product and I am
researching ways of streaming online with justin.tv (only for
authenticated users also)

The live video feature of PyConUS is an open source tool, as I have
read in the video site (perhaps there is relevant code too, although
it probably was developed for django).

On 18 mar, 05:16, Bruno Rocha  wrote:
> I am building something like this using Movu.ca as base for the system. I
> will use this on my coursewww.cursodepython.com.br, Now this course runs
> with VIMEO plus and only registered students have access to videos. Now I
> will extend with content-types in movu.ca
>
>
>
>
>
>
>
>
>
> On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin  wrote:
> > Hi. I have been asked to buiild a web site with these features and
> > requirements:
>
> > -Content managment for universitary students and teachers
> > Teachers will upload and edit course documents.
> > -Students must pay a fee to access the site's content.
> > -Students evaluation system with Q&A
> > -Online video classes
> > The site must allow (only authenticated) students to watch classes
> > live or from a site's class video archive.
>
> > Is there something already developed that I can use for this
> > requirements? I know there are lot of separated solutions (Martin's
> > Instant Press and I could mix them with more or less success, but I'd
> > like to know if someone found a starting project that covers this
> > requirements, so the development tasks can be decreased and there is
> > no need to reinvent the wheel.
>
> > For accessing video streams I am thinking of using a third-party brand
> > like vimeo or other similar, have anybody tested those services?
>
> > Could I use Instant Press for this project? Does it have this video
> > streaming features or should I develop something like an Instant Press
> > plugin for this case?.
>
> > Thank you.
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: LDAP queries on all subdomains under root?

2012-03-18 Thread IVINH


It's work. But changed "username_attrib" instead "username_attrs" at lign 
306:

 filter = '(&(%s=%s)(%s))' % ( username_attrib, 
ldap.filter.escape_filter_chars( username ), filterstr )

Thank szimszon.





Vào 05:15:08 UTC+7 Thứ bảy, ngày 17 tháng ba năm 2012, szimszon đã viết:
>
> Can you please test it? I can test it only on monday.
>
> or you can customize the search for user:
> 
> auth.settings.login_methods.append(ldap_auth(
> mode='custom', server='my.ldap.server',
> base_dn='ou=Users,dc=domain,dc=com',
> username_attrib='uid',
> custom_scope='subtree'))
> 
> the custom_scope can be: base, onelevel, subtree.
>
> 2012. március 16., péntek 3:15:10 UTC+1 időpontban IVINH a következőt írta:
>>
>> Hi all,
>>
>> This my code for LDAP:
>>
>>from gluon.contrib.login_methods.ldap_auth import ldap_auth 
>>
>> auth.settings.login_methods.append(ldap_auth(mode='cn',server='myserver',base_dn='ou=subdomain1,o=domain,c=com',port=389))
>>  
>>
>>
>> This works fine when I explicitely query SUBDOMAIN1 with the users that 
>> are in that domain (user1, user2, ...)
>> My problem is that at runtime, I don't know what subdomain the users are 
>> from and I don't want to query all subdomains one after the other to find 
>> user information.
>> Is these a way to query the entire directory (root) for users without 
>> knowing what subdomains they are in? If not, is there another better way to 
>> do this?
>>
>> Thank advance.
>>
>>
>>
>>

Re: [web2py] Re: Creating a cms with restricted video streaming access

2012-03-18 Thread Bruno Rocha
Yes, all in Movu.ca will be open-source as LGPLv3, movu.ca was created with
"content" as focus, social features is a plus, but the center of the CMS is
the content, so I need to improve the content-types system to be able to
include content-bundles, a content bundle is like a folder, a group, a
course, a class, a complete tutorial or whatever you need to group
together. With a generic functionality like that I think it will be easy to
implement it as a courseware, also implementing better privacy options
based on groups, permissions and users who have signed to some course or
"bundle".

I plan to use for my course, also for a cooking website.

For the videos I am thinking in integration with Big Blue Button API, VIMEO
Plus API, Amazon S3 for streaming, and also Google Docs.

The code is in github, I have not started to write the ideas for
'content-bundles', take a look at the code and may be we can work together
on this.


On Sun, Mar 18, 2012 at 8:17 AM, Alan Etkin  wrote:

> Bruno, are you planning to release a development version of the
> movu.ca courseware as open source? If so, I could contribute, as I
> probably will need a production implementation for the next months. I
> think that my app would also use the vimeo PLUS product and I am
> researching ways of streaming online with justin.tv (only for
> authenticated users also)
>
> The live video feature of PyConUS is an open source tool, as I have
> read in the video site (perhaps there is relevant code too, although
> it probably was developed for django).
>
> On 18 mar, 05:16, Bruno Rocha  wrote:
> > I am building something like this using Movu.ca as base for the system. I
> > will use this on my coursewww.cursodepython.com.br, Now this course runs
> > with VIMEO plus and only registered students have access to videos. Now I
> > will extend with content-types in movu.ca
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin  wrote:
> > > Hi. I have been asked to buiild a web site with these features and
> > > requirements:
> >
> > > -Content managment for universitary students and teachers
> > > Teachers will upload and edit course documents.
> > > -Students must pay a fee to access the site's content.
> > > -Students evaluation system with Q&A
> > > -Online video classes
> > > The site must allow (only authenticated) students to watch classes
> > > live or from a site's class video archive.
> >
> > > Is there something already developed that I can use for this
> > > requirements? I know there are lot of separated solutions (Martin's
> > > Instant Press and I could mix them with more or less success, but I'd
> > > like to know if someone found a starting project that covers this
> > > requirements, so the development tasks can be decreased and there is
> > > no need to reinvent the wheel.
> >
> > > For accessing video streams I am thinking of using a third-party brand
> > > like vimeo or other similar, have anybody tested those services?
> >
> > > Could I use Instant Press for this project? Does it have this video
> > > streaming features or should I develop something like an Instant Press
> > > plugin for this case?.
> >
> > > Thank you.
> >
> > --
> >
> > Bruno Rocha
> > [http://rochacbruno.com.br]
>



-- 

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


[web2py] Re: Checkboxes for Many to Many Relations

2012-03-18 Thread Alan Etkin
Not that it was the best approach, but when I am hurried and have to
collect data for special db designs, I just customize the input with
SQLFORM.factory and, on form validation, explore the form and do CRUD
accordingly. You could use the multiple widget for the foods field.

form = SLQFORM.factory(Field("person", ...), Field("foods", ...))
# pre-populate the form with current data
...
if form.process(...)...
...


On 17 mar, 20:50, asklucas  wrote:
> Hello!
>
> I can't work out how to handle many to many relations in web2py!
>
> Assuming the following model:
>
> db.define_table( 'person',
>
> >     Field( 'name', type = 'string'),
> >     )
>
> > db.define_table( 'food',
> >     Field( 'name', type = 'string'),
> >     )
>
> > db.define_table( 'person_food',
> >     Field( 'id_person', type = 'reference person'),
> >     Field( 'id_food', type = 'reference food'),
> >     )
>
> How can I create a view for adding a person which displays available foods
> with checkboxes and updates the person_food-table accordingly?
>
> Since I'm connecting to legacy databases I can't use the "tags"-like
> approach for many to many relations.
>
> Thank you very much!
>
> L.


[web2py] Re: Creating a cms with restricted video streaming access

2012-03-18 Thread Alan Etkin
Thank you so much Bruno, it seems that is very like what I was
searching, but I'll need to study the Movu.ca project, which is a
complex application.

On 18 mar, 08:25, Bruno Rocha  wrote:
> Yes, all in Movu.ca will be open-source as LGPLv3, movu.ca was created with
> "content" as focus, social features is a plus, but the center of the CMS is
> the content, so I need to improve the content-types system to be able to
> include content-bundles, a content bundle is like a folder, a group, a
> course, a class, a complete tutorial or whatever you need to group
> together. With a generic functionality like that I think it will be easy to
> implement it as a courseware, also implementing better privacy options
> based on groups, permissions and users who have signed to some course or
> "bundle".
>
> I plan to use for my course, also for a cooking website.
>
> For the videos I am thinking in integration with Big Blue Button API, VIMEO
> Plus API, Amazon S3 for streaming, and also Google Docs.
>
> The code is in github, I have not started to write the ideas for
> 'content-bundles', take a look at the code and may be we can work together
> on this.
>
>
>
>
>
>
>
>
>
> On Sun, Mar 18, 2012 at 8:17 AM, Alan Etkin  wrote:
> > Bruno, are you planning to release a development version of the
> > movu.ca courseware as open source? If so, I could contribute, as I
> > probably will need a production implementation for the next months. I
> > think that my app would also use the vimeo PLUS product and I am
> > researching ways of streaming online with justin.tv (only for
> > authenticated users also)
>
> > The live video feature of PyConUS is an open source tool, as I have
> > read in the video site (perhaps there is relevant code too, although
> > it probably was developed for django).
>
> > On 18 mar, 05:16, Bruno Rocha  wrote:
> > > I am building something like this using Movu.ca as base for the system. I
> > > will use this on my coursewww.cursodepython.com.br, Now this course runs
> > > with VIMEO plus and only registered students have access to videos. Now I
> > > will extend with content-types in movu.ca
>
> > > On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin  wrote:
> > > > Hi. I have been asked to buiild a web site with these features and
> > > > requirements:
>
> > > > -Content managment for universitary students and teachers
> > > > Teachers will upload and edit course documents.
> > > > -Students must pay a fee to access the site's content.
> > > > -Students evaluation system with Q&A
> > > > -Online video classes
> > > > The site must allow (only authenticated) students to watch classes
> > > > live or from a site's class video archive.
>
> > > > Is there something already developed that I can use for this
> > > > requirements? I know there are lot of separated solutions (Martin's
> > > > Instant Press and I could mix them with more or less success, but I'd
> > > > like to know if someone found a starting project that covers this
> > > > requirements, so the development tasks can be decreased and there is
> > > > no need to reinvent the wheel.
>
> > > > For accessing video streams I am thinking of using a third-party brand
> > > > like vimeo or other similar, have anybody tested those services?
>
> > > > Could I use Instant Press for this project? Does it have this video
> > > > streaming features or should I develop something like an Instant Press
> > > > plugin for this case?.
>
> > > > Thank you.
>
> > > --
>
> > > Bruno Rocha
> > > [http://rochacbruno.com.br]
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] How To make A multi-Select Field

2012-03-18 Thread Hassan Alnatour
Dear ALL,

I want To create a multi-Select Field  , how can i do that ??


[web2py] Re: How To make A multi-Select Field

2012-03-18 Thread Alan Etkin
for SQLFORM and CRUD, if the field is of type list:reference , a
default multiselect widget is displayed. You can use your own custom
constraint with IS_IN_DB(). For other type of forms you might
want to use the helper classes for build them

mycustommultiselect = SELECT(*[OPTION(option[0], _value=option[1]) for
option in tuple_sequence], _name="mycustommultiselect")

where tuple_sequence is a list of (name, value) tuples

On 18 mar, 09:21, Hassan Alnatour  wrote:
> Dear ALL,
>
> I want To create a multi-Select Field  , how can i do that ??


[web2py] Re: config file - configuration per environment

2012-03-18 Thread Alex
sorry, I don't understand your answer. What does mult tenance mean?
There is no description for tenant in the request documentation. When
I access request.tenant in my local app it is None.

On 18 Mrz., 03:09, Bruno Rocha  wrote:
> Mult tenance, in web2py you have request.tenant
>
> I use SQLite for configs
>
> http://zerp.ly/rochacbruno
> Em 17/03/2012 21:26, "Alex"  escreveu:
>
>
>
>
>
>
>
> > Hi,
>
> > what is the best way to have settings depending on the environment? I
> > know this question has been asked a couple of times before but I could
> > not find any useful answers.
>
> > I want to run multiple instances of my application for multiple
> > customers, which also means a different db connection for each
> > instance. I did not see an (elegant) solution in web2py for this
> > problem. I do not want to create a new package for each instance which
> > would be really annoying to do for each deployment. Currently I'm
> > passing the db settings as environment variables. For me this feels
> > more like a hack but at least it worked - so far. Now I want to run
> > cron jobs with external cron. This is a problem because I can't pass
> > the environment settings (which I would have to hard code a second
> > time anyway), so I can't access the db in the cron job tasks.
>
> > It would really be great if web2py had some config settings like in
> > most other frameworks.


[web2py] Re: Interesting "Stop Writing Classes" talk from PyCon

2012-03-18 Thread Alan Etkin
About "refactor religiously", it's curious, an experienced python
developer stated in PyConAr what I think is the opposite: he said
something like "don't bother refactoring", based in the amount of
projects abandoned that claim to have refactoring in the roadmap.

On unneeded classes, I think that it's sort of a refinement issue too,
one just cannot start with the right object oriented design, it needs
some sort of development evolution to reach an enhanced API.

On 17 mar, 13:27, Anthony  wrote:
> http://pyvideo.org/video/880/stop-writing-classes


[web2py] Re: web2py talk at PyCon US 2012 [video]

2012-03-18 Thread Alan Etkin
Someone else interested in writing the subtitles?

On 13 mar, 20:36, Massimo Di Pierro 
wrote:
> On Tuesday, 13 March 2012 00:22:39 UTC-5, rochacbruno wrote:
>
> >http://pyvideo.org/video/714/web2py-ideas-we-stole-and-ideas-we-had
>
> > --
>
> > Bruno Rocha
> > [http://rochacbruno.com.br]


Re: [web2py] Creating a cms with restricted video streaming access

2012-03-18 Thread Marco Mansilla
It seems to me that we maight have a moodle like plataform writen in
web2py!, good to know...

> Hi. I have been asked to buiild a web site with these features and
> requirements:
> 
> -Content managment for universitary students and teachers
> Teachers will upload and edit course documents.
> -Students must pay a fee to access the site's content.
> -Students evaluation system with Q&A
> -Online video classes
> The site must allow (only authenticated) students to watch classes
> live or from a site's class video archive.
> 
> Is there something already developed that I can use for this
> requirements? I know there are lot of separated solutions (Martin's
> Instant Press and I could mix them with more or less success, but I'd
> like to know if someone found a starting project that covers this
> requirements, so the development tasks can be decreased and there is
> no need to reinvent the wheel.
> 
> For accessing video streams I am thinking of using a third-party brand
> like vimeo or other similar, have anybody tested those services?
> 
> Could I use Instant Press for this project? Does it have this video
> streaming features or should I develop something like an Instant Press
> plugin for this case?.
> 
> Thank you.


[web2py] Installing a project which in cloned in mercurial repository in web2py

2012-03-18 Thread praveen krishna
Hii,
   I have cloned a project called pyMantis in mercurial in  read only mode 
and want to install it as a pyMantis app in web2py  .what are the next 
steps to be followed in  windows7 environment to install.


Re: [web2py] Re: Odd auth problem

2012-03-18 Thread Keith Edmunds
On Sat, 17 Mar 2012 15:03:39 -0700 (PDT), abasta...@gmail.com said:

> Instead, you can use auth.user_id, which 
> will simply return None when the user isn't logged in rather than an
> error. 

Thanks, that's fixed the problem.
-- 
"You can have everything in life you want if you help enough other people
get what they want" - Zig Ziglar. 

Who did you help today?


[web2py] Re: How To make A multi-Select Field

2012-03-18 Thread simon
Field('categories','list:string', default=defaultcategories, 
requires=IS_IN_SET(allcategories, 
multiple=True), widget=SQLFORM.widgets.checkboxes.widget))

On Sunday, 18 March 2012 12:21:12 UTC, Hassan Alnatour wrote:
>
> Dear ALL, 
>
> I want To create a multi-Select Field  , how can i do that ??



[web2py] Re: Represent problem.

2012-03-18 Thread Anthony

>
> @auth.requires(auth.has_membership(HUB) or auth.has_membership(ADMIN)) 
>
>
Instead of the above, use:

@auth.requires(lambda: auth.has_membership(HUB) or 
auth.has_membership(ADMIN))

That way, the two db hits for the has_membership calls will only happen 
when this specific function is accessed but not every time the controller 
is executed (i.e., when other functions in the controller are accessed).
 

> rows=rows=db(db.HubEdge.hubID==session.hubadminID).select(db.HubEdge.ALL) 
> return dict(rows=rows) 
>

Why do you have rows=rows?

Anthony



[web2py] Re: list:reference and crud.create a form in a form or a popup (django style) recipe ?

2012-03-18 Thread bussiere adrien
i've found that one :
http://www.web2pyslices.com/slice/show/1446/widget-select-or-add-option  

I will try to make a generic adaptatin of that one.

Regards
Bussiere

Le dimanche 18 mars 2012 11:31:23 UTC+1, Alan Etkin a écrit :
>
> I think that by default that table definition should show the 
> multiselect widget in CRUD forms. If not, it should be possible to set 
> it explicitly: 
>
> db.mytable.myfield.widget = SQLFORM.widgets.multiple.widget 
>
> And you can also create your own custom widgets by declaring a 
> function that receives field and value arguments and returns a helper. 
> For a detailed example check the online manual at 7.7 Widgets 
>
> On 17 mar, 11:11, bussiere adrien  wrote: 
> > Is there a recipe anywhere to show how to do when a i have a external 
> > reference in my db table as liste:reference 
> > to make it simple to add existing references or make a popup to create a 
> > new reference ? 
> > 
> > exemple : 
> > db.define_table('Film', 
> >Field('nom'), 
> >Field('Acteur','list:reference Acteur'), 
> > 
> > When i make a form1 = crud.create(db.Film) 
> > it sho me just a field and not menu as django or a field list or create 
> a 
> > new one. 
> > 
> > Is there a recipe anywhere to do that ? 
> > 
> > Regards 
> > Bussiere



[web2py] Re: Current status of adapting OrientDB for web2py

2012-03-18 Thread bussiere adrien
Mee to i'am considering using orientdb also.

So if you have any example

regards
Bussiere

Le jeudi 16 février 2012 09:27:55 UTC+1, David Marko a écrit :
>
> I would also appreciate some hints on what libraries do you use to 
> communicate with orientDB, or can you create some simple appliance as demo?
>
> Thanks!
> David
>


[web2py] Web2py running tornado : WARNING:root:Invalid multipart/form-data

2012-03-18 Thread n1ck
Hi Guys,

I run web2py using webserver tornado
python anyserver.py -s tornado -i 127.0.0.1 -p 8000

and sometimes when I browse the administrative site and edit any file, when 
I save it the terminal outputs the  " WARNING:root:Invalid 
multipart/form-data "

I'm using the current stable web2py and tornado.

What seems to be the problem?


Thank you


[web2py] Sockets in DAL under RDS/AWS

2012-03-18 Thread Cody Snider
Pymysql and the approach using sockets on EC2/RDS doesn't work. I've tested 
connections remotely using the Windows 1.99.4 version and the RDS DB can be 
connected correctly, but under the source version on EC2, it fails to 
connect. Every SQL client, both remote and local, can connect correctly 
except the app itself. I believe it's due to sockets being used (and not 
necessarily RDS). Does anyone have any ideas as to how this can be resolved 
without either stepping back the version of web2py or modifying the DAL 
itself (I'd rather not get locked into a non-upgradable installation)?

[web2py] Re: LDAP queries on all subdomains under root?

2012-03-18 Thread szimszon
Thanks for testing. I'll implement a little bit of logging tomorrow than 
send a patch to Massimo...

2012. március 18., vasárnap 12:20:24 UTC+1 időpontban IVINH a következőt 
írta:
>
>
>
> It's work. But changed "username_attrib" instead "username_attrs" at lign 
> 306:
>
>  filter = '(&(%s=%s)(%s))' % ( username_attrib, 
> ldap.filter.escape_filter_chars( username ), filterstr )
>
> Thank szimszon.
>
>
>
>
>
> Vào 05:15:08 UTC+7 Thứ bảy, ngày 17 tháng ba năm 2012, szimszon đã viết:
>>
>> Can you please test it? I can test it only on monday.
>>
>> or you can customize the search for user:
>> 
>> auth.settings.login_methods.append(ldap_auth(
>> mode='custom', server='my.ldap.server',
>> base_dn='ou=Users,dc=domain,dc=com',
>> username_attrib='uid',
>> custom_scope='subtree'))
>> 
>> the custom_scope can be: base, onelevel, subtree.
>>
>> 2012. március 16., péntek 3:15:10 UTC+1 időpontban IVINH a következőt 
>> írta:
>>>
>>> Hi all,
>>>
>>> This my code for LDAP:
>>>
>>>from gluon.contrib.login_methods.ldap_auth import ldap_auth 
>>>
>>> auth.settings.login_methods.append(ldap_auth(mode='cn',server='myserver',base_dn='ou=subdomain1,o=domain,c=com',port=389))
>>>  
>>>
>>>
>>> This works fine when I explicitely query SUBDOMAIN1 with the users that 
>>> are in that domain (user1, user2, ...)
>>> My problem is that at runtime, I don't know what subdomain the users are 
>>> from and I don't want to query all subdomains one after the other to find 
>>> user information.
>>> Is these a way to query the entire directory (root) for users without 
>>> knowing what subdomains they are in? If not, is there another better way to 
>>> do this?
>>>
>>> Thank advance.
>>>
>>>
>>>
>>>

[web2py] Re: Current status of adapting OrientDB for web2py

2012-03-18 Thread Massimo Di Pierro


On Monday, 13 February 2012 11:54:05 UTC-6, Nolan Nichols wrote:
>
> I'm researching the nosql and graph database landscape for a web2py 
> application that will require the schema to evolve over time and 
> provide network/graph analysis metrics. 
>
> I started by looking at the Tinkerpop (http://tinkerpop.com/) stack 
> and the Bulbflow (http://bulbflow.com/) python library for interacting 
> with Tinkerpop graph databases like Neo4j and OrientDB. 
>
> It looks like there was interest a few months back in adapting 
> OrientDB's sql interface for web2py, and there is an open issue: 
>
> - http://code.google.com/p/web2py/issues/detail?id=407 
>
> A few questions: 
>
> What is the current status of an OrientDB/web2py adapter? 
> Is anyone currently using a graph database with web2py? 
> Any suggestions for using web2py DAI/templates with non-rdbms sources? 
>
> Cheers, 
>
> Nolan



Re: [web2py] Installing a project which in cloned in mercurial repository in web2py

2012-03-18 Thread Michele Comitini
Hi,

Download web2py from web2py.com and follow the instructions to run it

Just copy or move the folder containing models,controllers,views under
the applications folder inside your web2py installation.

mic


Il 18 marzo 2012 16:06, praveen krishna  ha scritto:
> Hii,
>    I have cloned a project called pyMantis in mercurial in  read only mode
> and want to install it as a pyMantis app in web2py  .what are the next steps
> to be followed in  windows7 environment to install.


[web2py] Re: Current status of adapting OrientDB for web2py

2012-03-18 Thread Massimo Di Pierro
Let me iterate that writing a DAL adapter does not take much work. All I 
need is somebody to commit to do some testing for me.

massimo

On Sunday, 18 March 2012 13:16:31 UTC-5, bussiere adrien wrote:
>
> Mee to i'am considering using orientdb also.
>
> So if you have any example
>
> regards
> Bussiere
>
> Le jeudi 16 février 2012 09:27:55 UTC+1, David Marko a écrit :
>>
>> I would also appreciate some hints on what libraries do you use to 
>> communicate with orientDB, or can you create some simple appliance as demo?
>>
>> Thanks!
>> David
>>
>
On Sunday, 18 March 2012 13:16:31 UTC-5, bussiere adrien wrote:
>
> Mee to i'am considering using orientdb also.
>
> So if you have any example
>
> regards
> Bussiere
>
> Le jeudi 16 février 2012 09:27:55 UTC+1, David Marko a écrit :
>>
>> I would also appreciate some hints on what libraries do you use to 
>> communicate with orientDB, or can you create some simple appliance as demo?
>>
>> Thanks!
>> David
>>
>

[web2py] Web2py Update

2012-03-18 Thread Ovidio Marinho
Check for update web2py 1.99.4 does not work, someone has a solution?




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


Re: [web2py] Installing a project which in cloned in mercurial repository in web2py

2012-03-18 Thread praveen krishna
But to install an application it should be of .w2p format then how can I
copy or move a normal folder which contains other folders along with
models,controllers ,views which is cloned using mercurial .

On Sun, Mar 18, 2012 at 10:14 PM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> Hi,
>
> Download web2py from web2py.com and follow the instructions to run it
>
> Just copy or move the folder containing models,controllers,views under
> the applications folder inside your web2py installation.
>
> mic
>
>
> Il 18 marzo 2012 16:06, praveen krishna  ha
> scritto:
> > Hii,
> >I have cloned a project called pyMantis in mercurial in  read only
> mode
> > and want to install it as a pyMantis app in web2py  .what are the next
> steps
> > to be followed in  windows7 environment to install.
>


Re: [web2py] Correct way to use memcache on GAE with web2py

2012-03-18 Thread Sushant Taneja
Thanks for the info.

On Saturday, March 17, 2012 4:11:40 AM UTC+5:30, howesc wrote:
>
> 1. that is how GAE queries works.  it's GAE's fault, not web2py's. 
> 2. correct.  Rows objects are not pickelable.  as_list() or as_dict() are 
> your friend.  this is not just for GAE but all environments i believe.
>
> On Friday, March 16, 2012 10:03:36 AM UTC-7, Sushant Taneja wrote:
>>
>> Hi,
>>
>> I am stuck here, I tried the mentioned code, there are 2 problems I am 
>> facing:
>>
>> 1. All the table columns are extracted rather than only the two columns 
>> in the select()
>> 2. I get pickling error when I try to add the Rows object to memcache
>>
>> *PicklingError: Can't pickle : attribute lookup 
>> __builtin__.function failed*
>>
>> but once I use the as_list() function it works fine.
>>
>> Any thoughts ?
>>
>> On Friday, March 16, 2012 1:07:58 PM UTC+5:30, Sushant Taneja wrote:
>>>
>>> Thanks ! 
>>>
>>> On Friday, March 16, 2012 2:04:42 AM UTC+5:30, Jonathan Lundell wrote:

 On Mar 15, 2012, at 1:15 PM, Sushant Taneja wrote:
 > I have a tags table which will be available to all logged in users. 
 The table has the following structure:
 > 
 > db.define_table('META_TAG',
 > Field('tag','string',notnull=True),
 > Field('root_tag','string',notnull=True),
 > Field('active_ind','string',length=1,default='Y')
 > )
 > 
 > This table will be rarely (once a month) updated via an 
 administrative interface.
 > I read various web2py based examples and gae examples on using 
 memcache. Each followed a different approach.
 > As per my understanding from appengine documentation, I have written 
 the following helper function in a controller to use memcache:
 > 
 > from google.appengine.api import memcache
 > 
 > def get_tags():
 > """This function returns cached value for META_TAG table"""
 > tags = memcache.get("tags")
 > if not words:
 > words = 
 db(db.META_TAG.active_ind=='Y').select(db.META_TAG.tag,db.META_TAG.root_tag)
 > memcache.add("tags",tags)
 > return tags
 > else:
 > return tags
 > 
 > Will the above code ensure that the correct data is always available 
 in the memcache ?

 You seem to be mixing the names 'words' and 'tags'.

 As a matter of style, I'd move the return outside the if/else.

 Don't forget to set the cache when you update the tags.

 It's best to test for 'is None', in case your cached object can 
 legitimately evaluate to False (an empty list or string, for example). So 
 more like:

 from google.appengine.api import memcache

 def get_tags():
 """This function returns cached value for META_TAG table"""
 tags = memcache.get("tags")
 if tags is None:
 tags = 
 db(db.META_TAG.active_ind=='Y').select(db.META_TAG.tag,db.META_TAG.root_tag)
 memcache.add("tags",tags)
 return tags



Re: [web2py] Re: Current status of adapting OrientDB for web2py

2012-03-18 Thread Vasile Ermicioi
hi,

I can write one,
I tried it (some samples), I like its concept and features (key value db,
document db, and graph db, sql  queries,  full text index support and so on)
but I am waiting for the 1.0 release which is planned to be released in mid
of April according to their roadmap


[web2py] Re: Installing a project which in cloned in mercurial repository in web2py

2012-03-18 Thread Alan Etkin
A mercurial repository cloned can be copied as any other windows
folder, you only have to copy the entire cloned application folder
(that includes controller, model) into your web2py installation
"applications" folder (at the same level as the scaffolding welcome
app), that will be enough for web2py to recognize the new application
and you'll be able to manage it as those installed with .w2p files*.
By the way, the new PyConUS talk "Ideas we stole..." covers installing
and managing applications from a console and with the administrative
interface.

* provided that the app you are copying works with web2py

On 18 mar, 18:44, praveen krishna  wrote:
> But to install an application it should be of .w2p format then how can I
> copy or move a normal folder which contains other folders along with
> models,controllers ,views which is cloned using mercurial .
>
> On Sun, Mar 18, 2012 at 10:14 PM, Michele Comitini <
>
>
>
>
>
>
>
> michele.comit...@gmail.com> wrote:
> > Hi,
>
> > Download web2py from web2py.com and follow the instructions to run it
>
> > Just copy or move the folder containing models,controllers,views under
> > the applications folder inside your web2py installation.
>
> > mic
>
> > Il 18 marzo 2012 16:06, praveen krishna  ha
> > scritto:
> > > Hii,
> > >    I have cloned a project called pyMantis in mercurial in  read only
> > mode
> > > and want to install it as a pyMantis app in web2py  .what are the next
> > steps
> > > to be followed in  windows7 environment to install.


[web2py] trouble with @auth.requires_login() in wiki app from manual

2012-03-18 Thread Monte Milanuk
Hello,

Working my way thru the wiki app demo in the online manual... I kept 
getting a weird error like this:


Traceback (most recent call last):
>   File "gluon/restricted.py", line 205, in restricted
>   File "E:\web2py\applications\mywiki\controllers/default.py", line 31, in 
> 
> TypeError: requires_login() takes exactly 1 argument (2 given)
>
>
whenever I attempted to access any of the views for this app.  Only on line 
31 of the controller 'default.py', right before 'def documents():'.

Here is the code listing from the 'trouble ticket':

"edit an existing wiki page"
> this_page = db.page(request.args(0)) or redirect(URL('index'))
> form = crud.update(db.page, this_page, next = URL('show', 
> args=request.args))
> return dict(form=form)
>
> @auth.requires_login
>
> def documents():
> "browse & edit all documents attached to a given page"
> page = db.page(request.args(0)) or redirect(URL('index'))
> db.document.page_id.default = page.id
>
>
I went back thru the code several times, and I couldn't seem to find 
anything specifically wrong that jumped out at me...

...but when I commented out line 31 entirely - everything began working.  
Eh?!?

Could someone explain to me why that one line, right there, would cause 
things to break when the decorator is used elsewhere in the same controller 
'default.py' several times with no problems?

There are any number of things I don't fully understand yet, but most of 
them 'just work' so I've kept moving on, learning as I go.  This one has me 
kinda stumped - I don't *think* its a typo on my part, though thats 
certainly the most likely cause.  If it is, I'm not seeing it though, at 
least not right there in the section of code the trouble ticket 
high-lighted.

TIA,

Monte



[web2py] Re: trouble with @auth.requires_login() in wiki app from manual

2012-03-18 Thread Alan Etkin
If I recall correctly, auth.requires_login should be
auth.requires_login() for basic authentication

On 18 mar, 19:21, Monte Milanuk  wrote:
> Hello,
>
> Working my way thru the wiki app demo in the online manual... I kept
> getting a weird error like this:
>
> Traceback (most recent call last):>   File "gluon/restricted.py", line 205, 
> in restricted
> >   File "E:\web2py\applications\mywiki\controllers/default.py", line 31, in 
> > 
> > TypeError: requires_login() takes exactly 1 argument (2 given)
>
> whenever I attempted to access any of the views for this app.  Only on line
> 31 of the controller 'default.py', right before 'def documents():'.
>
> Here is the code listing from the 'trouble ticket':
>
>     "edit an existing wiki page">     this_page = db.page(request.args(0)) or 
> redirect(URL('index'))
> >     form = crud.update(db.page, this_page, next = URL('show', 
> > args=request.args))
> >     return dict(form=form)
>
> > @auth.requires_login
>
> > def documents():
> >     "browse & edit all documents attached to a given page"
> >     page = db.page(request.args(0)) or redirect(URL('index'))
> >     db.document.page_id.default = page.id
>
> I went back thru the code several times, and I couldn't seem to find
> anything specifically wrong that jumped out at me...
>
> ...but when I commented out line 31 entirely - everything began working.
> Eh?!?
>
> Could someone explain to me why that one line, right there, would cause
> things to break when the decorator is used elsewhere in the same controller
> 'default.py' several times with no problems?
>
> There are any number of things I don't fully understand yet, but most of
> them 'just work' so I've kept moving on, learning as I go.  This one has me
> kinda stumped - I don't *think* its a typo on my part, though thats
> certainly the most likely cause.  If it is, I'm not seeing it though, at
> least not right there in the section of code the trouble ticket
> high-lighted.
>
> TIA,
>
> Monte


[web2py] Re: Web2py Update

2012-03-18 Thread Alan Etkin
What does it do? Can you debug the javascript code? (I think it uses
some ajax in the background)

On 18 mar, 18:39, Ovidio Marinho  wrote:
> Check for update web2py 1.99.4 does not work, someone has a solution?
>
>        Ovidio Marinho Falcao Neto
>                 Web Developer
>              ovidio...@gmail.com
>           ovidiomari...@itjp.net.br
>                  ITJP - itjp.net.br
>                83   8826 9088 - Oi
>                83   9334 0266 - Claro
>                         Brasil


[web2py] Re: trouble with @auth.requires_login() in wiki app from manual

2012-03-18 Thread Anthony
As Alan suggests, you slightly mis-copied the code from the book -- it 
should be:

@auth.requires_login()
def documents():


Note the parentheses.

Anthony

On Sunday, March 18, 2012 6:21:54 PM UTC-4, Monte Milanuk wrote:
>
> Hello,
>
> Working my way thru the wiki app demo in the online manual... I kept 
> getting a weird error like this:
>
>
> Traceback (most recent call last):
>>   File "gluon/restricted.py", line 205, in restricted
>>   File "E:\web2py\applications\mywiki\controllers/default.py", line 31, in 
>> 
>> TypeError: requires_login() takes exactly 1 argument (2 given)
>>
>>
> whenever I attempted to access any of the views for this app.  Only on 
> line 31 of the controller 'default.py', right before 'def documents():'.
>
> Here is the code listing from the 'trouble ticket':
>
> "edit an existing wiki page"
>> this_page = db.page(request.args(0)) or redirect(URL('index'))
>> form = crud.update(db.page, this_page, next = URL('show', 
>> args=request.args))
>> return dict(form=form)
>>
>> @auth.requires_login
>>
>> def documents():
>> "browse & edit all documents attached to a given page"
>> page = db.page(request.args(0)) or redirect(URL('index'))
>> db.document.page_id.default = page.id
>>
>>
> I went back thru the code several times, and I couldn't seem to find 
> anything specifically wrong that jumped out at me...
>
> ...but when I commented out line 31 entirely - everything began working.  
> Eh?!?
>
> Could someone explain to me why that one line, right there, would cause 
> things to break when the decorator is used elsewhere in the same controller 
> 'default.py' several times with no problems?
>
> There are any number of things I don't fully understand yet, but most of 
> them 'just work' so I've kept moving on, learning as I go.  This one has me 
> kinda stumped - I don't *think* its a typo on my part, though thats 
> certainly the most likely cause.  If it is, I'm not seeing it though, at 
> least not right there in the section of code the trouble ticket 
> high-lighted.
>
> TIA,
>
> Monte
>
>

[web2py] Re: Web2py Update

2012-03-18 Thread Massimo Di Pierro
which os? We know there is a problem on winodows. Download the latest, 
unzip and copy over the older one.

On Sunday, 18 March 2012 16:39:19 UTC-5, Ovidio Marinho wrote:
>
> Check for update web2py 1.99.4 does not work, someone has a solution?
>
>   
>
>
>Ovidio Marinho Falcao Neto
> Web Developer
>  ovidio...@gmail.com 
>   ovidiomari...@itjp.net.br
>  ITJP - itjp.net.br
>83   8826 9088 - Oi
>83   9334 0266 - Claro
> Brasil
>   
>
>

[web2py] RESTful API : at ...> is not JSON serializable

2012-03-18 Thread sebsto
Dear All,

I am new the web2py and trying to use the relatively new RESTful API,
as described at 
http://web2py.com/books/default/chapter/29/10#Restful-Web-Services

I am testing it with a very simple model :
db.define_table('message',
Field('sender', required=True),
Field('recipient', required=True),
Field('text', required=True))

And the doc provided function:
@request.restful()
def api():
response.view = 'generic.json'
def GET(tablename,id):
if not tablename=='message': raise HTTP(400)
return dict(message = db.message(id))
return locals()

When calling
curl -v http://localhost:8000/RESTtest/default/api/message/1.json

It generates an HTTP 500 error and the following ticket is logged
1   generic.jsonTypeError:  at 0xa9a72f0> is 
not
JSON serializable   +   details

Traceback (most recent call last):
  File "gluon/restricted.py", line 205, in restricted
  File "/Applications/web2py.app/Contents/Resources/applications/
RESTtest/views/generic.json", line 2, in 
  File "gluon/serializers.py", line 61, in json
  File "gluon/contrib/simplejson/__init__.py", line 270, in dumps
  File "gluon/contrib/simplejson/encoder.py", line 217, in encode
  File "gluon/contrib/simplejson/encoder.py", line 486, in _iterencode
  File "gluon/contrib/simplejson/encoder.py", line 460, in
_iterencode_dict
  File "gluon/contrib/simplejson/encoder.py", line 460, in
_iterencode_dict
  File "gluon/contrib/simplejson/encoder.py", line 496, in _iterencode
  File "gluon/serializers.py", line 37, in custom_json
TypeError:  at 0xa9a72f0> is not JSON serializable

Similar problem was reported here
http://groups.google.com/group/web2py/browse_thread/thread/837aa4b3df4c1a93/1bc6d35248d9f9e1?show_docid=1bc6d35248d9f9e1&pli=1

Is there an issue in generic.json ?

Thanks for your help

Seb


[web2py] Re: RESTful API : at ...> is not JSON serializable

2012-03-18 Thread Sébastien Stormacq
Dear All,

I found a workaround to the problem, I would like to double-check with you what 
is the impact in term of performance, maintainability etc ...

Problem described in my previous email is caused by two lambda functions 
(update_record and delete_record) returned by
return dict(message = db.message(id))

When using this 
return dict(message=db(db.message.id==id).select())

only database fields are returned.

What are other methods to avoid these lambda functions ?
Should I raise a bug against the documentation ?

Thanks for your advises

Seb

On 19 Mar 2012, at 01:10, sebsto wrote:

> Dear All,
> 
> I am new the web2py and trying to use the relatively new RESTful API,
> as described at 
> http://web2py.com/books/default/chapter/29/10#Restful-Web-Services
> 
> I am testing it with a very simple model :
> db.define_table('message',
>Field('sender', required=True),
>Field('recipient', required=True),
>Field('text', required=True))
> 
> And the doc provided function:
> @request.restful()
> def api():
>response.view = 'generic.json'
>def GET(tablename,id):
>if not tablename=='message': raise HTTP(400)
>return dict(message = db.message(id))
>return locals()
> 
> When calling
> curl -v http://localhost:8000/RESTtest/default/api/message/1.json
> 
> It generates an HTTP 500 error and the following ticket is logged
>   1   generic.jsonTypeError:  at 0xa9a72f0> is 
> not
> JSON serializable +   details
> 
> Traceback (most recent call last):
>  File "gluon/restricted.py", line 205, in restricted
>  File "/Applications/web2py.app/Contents/Resources/applications/
> RESTtest/views/generic.json", line 2, in 
>  File "gluon/serializers.py", line 61, in json
>  File "gluon/contrib/simplejson/__init__.py", line 270, in dumps
>  File "gluon/contrib/simplejson/encoder.py", line 217, in encode
>  File "gluon/contrib/simplejson/encoder.py", line 486, in _iterencode
>  File "gluon/contrib/simplejson/encoder.py", line 460, in
> _iterencode_dict
>  File "gluon/contrib/simplejson/encoder.py", line 460, in
> _iterencode_dict
>  File "gluon/contrib/simplejson/encoder.py", line 496, in _iterencode
>  File "gluon/serializers.py", line 37, in custom_json
> TypeError:  at 0xa9a72f0> is not JSON serializable
> 
> Similar problem was reported here
> http://groups.google.com/group/web2py/browse_thread/thread/837aa4b3df4c1a93/1bc6d35248d9f9e1?show_docid=1bc6d35248d9f9e1&pli=1
> 
> Is there an issue in generic.json ?
> 
> Thanks for your help
> 
> Seb



[web2py] export Data Abstraction Layer (DAL) to be used with Google Cloud SQL on App Engine

2012-03-18 Thread Jarod G.R. Meng
Hi,

I was trying to use web2py's DAL with Google Cloud SQL on App Engine,
but to no avail. The error seems to be because GAE doesn't allow any
manipulation of its filesystem which web2py's DAL module (gluon.dal)
needs to define a folder attribute (my understanding of the trouble
could be wrong).

I was wondering whether anyone has used web2py's DAL with Cloud SQL
before?

Any advice is welcome!

Jarod


[web2py] Re: Interesting "Stop Writing Classes" talk from PyCon

2012-03-18 Thread encompass
Yeah, I am sure there is a line between refactor, rebuild, and work
around.
But this talk was good.  He made some good points.
BR,
Jason

On Mar 18, 4:13 pm, Alan Etkin  wrote:
> About "refactor religiously", it's curious, an experienced python
> developer stated in PyConAr what I think is the opposite: he said
> something like "don't bother refactoring", based in the amount of
> projects abandoned that claim to have refactoring in the roadmap.
>
> On unneeded classes, I think that it's sort of a refinement issue too,
> one just cannot start with the right object oriented design, it needs
> some sort of development evolution to reach an enhanced API.
>
> On 17 mar, 13:27, Anthony  wrote:
>
>
>
>
>
>
>
> >http://pyvideo.org/video/880/stop-writing-classes


[web2py] Re: Creating a cms with restricted video streaming access

2012-03-18 Thread Osama Khan
Hey!

This is amazing, I am working on something similar :)
I had just started so your project will help me immensely decrease
development time. Thanks alot!
Is it possible that we restrict the user from downloading the videos
something like udemy has done?

--
Osama Khan
[http://www.osamakhan.com]

On Mar 18, 4:25 pm, Bruno Rocha  wrote:
> Yes, all in Movu.ca will be open-source as LGPLv3, movu.ca was created with
> "content" as focus, social features is a plus, but the center of the CMS is
> the content, so I need to improve the content-types system to be able to
> include content-bundles, a content bundle is like a folder, a group, a
> course, a class, a complete tutorial or whatever you need to group
> together. With a generic functionality like that I think it will be easy to
> implement it as a courseware, also implementing better privacy options
> based on groups, permissions and users who have signed to some course or
> "bundle".
>
> I plan to use for my course, also for a cooking website.
>
> For the videos I am thinking in integration with Big Blue Button API, VIMEO
> Plus API, Amazon S3 for streaming, and also Google Docs.
>
> The code is in github, I have not started to write the ideas for
> 'content-bundles', take a look at the code and may be we can work together
> on this.
>
>
>
>
>
>
>
>
>
> On Sun, Mar 18, 2012 at 8:17 AM, Alan Etkin  wrote:
> > Bruno, are you planning to release a development version of the
> > movu.ca courseware as open source? If so, I could contribute, as I
> > probably will need a production implementation for the next months. I
> > think that my app would also use the vimeo PLUS product and I am
> > researching ways of streaming online with justin.tv (only for
> > authenticated users also)
>
> > The live video feature of PyConUS is an open source tool, as I have
> > read in the video site (perhaps there is relevant code too, although
> > it probably was developed for django).
>
> > On 18 mar, 05:16, Bruno Rocha  wrote:
> > > I am building something like this using Movu.ca as base for the system. I
> > > will use this on my coursewww.cursodepython.com.br, Now this course runs
> > > with VIMEO plus and only registered students have access to videos. Now I
> > > will extend with content-types in movu.ca
>
> > > On Sat, Mar 17, 2012 at 9:53 AM, Alan Etkin  wrote:
> > > > Hi. I have been asked to buiild a web site with these features and
> > > > requirements:
>
> > > > -Content managment for universitary students and teachers
> > > > Teachers will upload and edit course documents.
> > > > -Students must pay a fee to access the site's content.
> > > > -Students evaluation system with Q&A
> > > > -Online video classes
> > > > The site must allow (only authenticated) students to watch classes
> > > > live or from a site's class video archive.
>
> > > > Is there something already developed that I can use for this
> > > > requirements? I know there are lot of separated solutions (Martin's
> > > > Instant Press and I could mix them with more or less success, but I'd
> > > > like to know if someone found a starting project that covers this
> > > > requirements, so the development tasks can be decreased and there is
> > > > no need to reinvent the wheel.
>
> > > > For accessing video streams I am thinking of using a third-party brand
> > > > like vimeo or other similar, have anybody tested those services?
>
> > > > Could I use Instant Press for this project? Does it have this video
> > > > streaming features or should I develop something like an Instant Press
> > > > plugin for this case?.
>
> > > > Thank you.
>
> > > --
>
> > > Bruno Rocha
> > > [http://rochacbruno.com.br]
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: RESTful API : at ...> is not JSON serializable

2012-03-18 Thread Massimo Di Pierro
return dict(message = db.message(id).as_dict())

On Sunday, 18 March 2012 19:10:13 UTC-5, sebsto wrote:
>
> Dear All, 
>
> I am new the web2py and trying to use the relatively new RESTful API, 
> as described at 
> http://web2py.com/books/default/chapter/29/10#Restful-Web-Services 
>
> I am testing it with a very simple model : 
> db.define_table('message', 
> Field('sender', required=True), 
> Field('recipient', required=True), 
> Field('text', required=True)) 
>
> And the doc provided function: 
> @request.restful() 
> def api(): 
> response.view = 'generic.json' 
> def GET(tablename,id): 
> if not tablename=='message': raise HTTP(400) 
> return dict(message = db.message(id)) 
> return locals() 
>
> When calling 
> curl -v http://localhost:8000/RESTtest/default/api/message/1.json 
>
> It generates an HTTP 500 error and the following ticket is logged 
> 1generic.jsonTypeError:  at 
> 0xa9a72f0> is not 
> JSON serializable+details 
>
> Traceback (most recent call last): 
>   File "gluon/restricted.py", line 205, in restricted 
>   File "/Applications/web2py.app/Contents/Resources/applications/ 
> RESTtest/views/generic.json", line 2, in  
>   File "gluon/serializers.py", line 61, in json 
>   File "gluon/contrib/simplejson/__init__.py", line 270, in dumps 
>   File "gluon/contrib/simplejson/encoder.py", line 217, in encode 
>   File "gluon/contrib/simplejson/encoder.py", line 486, in _iterencode 
>   File "gluon/contrib/simplejson/encoder.py", line 460, in 
> _iterencode_dict 
>   File "gluon/contrib/simplejson/encoder.py", line 460, in 
> _iterencode_dict 
>   File "gluon/contrib/simplejson/encoder.py", line 496, in _iterencode 
>   File "gluon/serializers.py", line 37, in custom_json 
> TypeError:  at 0xa9a72f0> is not JSON serializable 
>
> Similar problem was reported here 
>
> http://groups.google.com/group/web2py/browse_thread/thread/837aa4b3df4c1a93/1bc6d35248d9f9e1?show_docid=1bc6d35248d9f9e1&pli=1
>  
>
> Is there an issue in generic.json ? 
>
> Thanks for your help 
>
> Seb



[web2py] Re: Represent problem.

2012-03-18 Thread Annet
Hi Alan and Anthony,

@Alan,

This:

{{for row in rows:}}
  
{{=db.Edge.byNodeID.represent(row.byNodeID, row)}}
{{=db.Edge.ofNodeID.represent(row.ofNodeID, row)}}
  
{{pass}}

... results in an empty  element ...


@Anthony,

> Instead of the above, use:
>
> @auth.requires(lambda: auth.has_membership(HUB) or
> auth.has_membership(ADMIN))

Thanks for your advice, I made the changes in my code.


> > rows=rows=db(db.HubEdge.hubID==session.hubadminID).select(db.HubEdge.ALL)
> > return dict(rows=rows)
>
> Why do you have rows=rows?

I had a look at the code, there's no rows=rows, I guess it's a copy
and paste error.


Kind regards,

Annet.



[web2py] Re: RESTful API : at ...> is not JSON serializable

2012-03-18 Thread sebsto
Worked !  Thanks

On Mar 19, 5:50 am, Massimo Di Pierro 
wrote:
> return dict(message = db.message(id).as_dict())
>
>
>
>
>
>
>
> On Sunday, 18 March 2012 19:10:13 UTC-5, sebsto wrote:
>
> > Dear All,
>
> > I am new the web2py and trying to use the relatively new RESTful API,
> > as described at
> >http://web2py.com/books/default/chapter/29/10#Restful-Web-Services
>
> > I am testing it with a very simple model :
> > db.define_table('message',
> >     Field('sender', required=True),
> >     Field('recipient', required=True),
> >     Field('text', required=True))
>
> > And the doc provided function:
> > @request.restful()
> > def api():
> >     response.view = 'generic.json'
> >     def GET(tablename,id):
> >         if not tablename=='message': raise HTTP(400)
> >         return dict(message = db.message(id))
> >     return locals()
>
> > When calling
> > curl -vhttp://localhost:8000/RESTtest/default/api/message/1.json
>
> > It generates an HTTP 500 error and the following ticket is logged
> >         1        generic.json        TypeError:  at
> > 0xa9a72f0> is not
> > JSON serializable        +        details
>
> > Traceback (most recent call last):
> >   File "gluon/restricted.py", line 205, in restricted
> >   File "/Applications/web2py.app/Contents/Resources/applications/
> > RESTtest/views/generic.json", line 2, in 
> >   File "gluon/serializers.py", line 61, in json
> >   File "gluon/contrib/simplejson/__init__.py", line 270, in dumps
> >   File "gluon/contrib/simplejson/encoder.py", line 217, in encode
> >   File "gluon/contrib/simplejson/encoder.py", line 486, in _iterencode
> >   File "gluon/contrib/simplejson/encoder.py", line 460, in
> > _iterencode_dict
> >   File "gluon/contrib/simplejson/encoder.py", line 460, in
> > _iterencode_dict
> >   File "gluon/contrib/simplejson/encoder.py", line 496, in _iterencode
> >   File "gluon/serializers.py", line 37, in custom_json
> > TypeError:  at 0xa9a72f0> is not JSON serializable
>
> > Similar problem was reported here
>
> >http://groups.google.com/group/web2py/browse_thread/thread/837aa4b3df...
>
> > Is there an issue in generic.json ?
>
> > Thanks for your help
>
> > Seb