[google-appengine] AppEngine importError with Reportlab
I´m a newbie, started using App engine about a mounth and am developing a project. This project makes use of a library reportlab I´ve googled a lot and I am desperate because I can not import the module successfully. Settings: Python 2.7 Helios Eclipse Appengine SDK version 1.3.5 Windows 7 x64 Errors: Traceback (most recent call last): File "C: \ Users \ HP \ Documents \ Teaching cv \ src \ principal.py", line 4, in import canvas from reportlab.pdfgen ImportError: No module named reportlab.pdfgen Question: Where to put ReportLab? within the Python lib / site-packages? or within the application? You need to edit any file? If yes, what and how? Note: I've seen this tracker http://code.google.com/p/googleappengine/issues/detail?id=1085. Please help, i´m stucked with this -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Http 404 - Not Found
Hi, When running my app with reportlab, get this error message INFO 2010-07-29 22:46:12,180 appengine_rpc.py:159] Server: appengine.google.com INFO 2010-07-29 22:46:12,187 appcfg.py:357] Checking for updates to the SDK. INFO 2010-07-29 22:46:13,608 appcfg.py:371] The SDK is up to date. WARNING 2010-07-29 22:46:13,609 datastore_file_stub.py:634] Could not read datastore data from c:\users\hp\appdata\local\temp \dev_appserver.datastore INFO 2010-07-29 22:46:13,697 dev_appserver_main.py:431] Running application sample-app on port : http://localhost: INFO 2010-07-29 22:46:49,000 py_zipimport.py:108] zipimporter('reportlab.zip', '') INFO 2010-07-29 22:46:49,005 py_zipimport.py:108] zipimporter('C:\ \Users\\HP\\Documents\\Teste\\src\\reportlab.zip', '') WARNING 2010-07-29 22:46:49,177 dev_appserver.py:1168] Blocking access to skipped file "c:\users\hp\documents\teste\src\~\library \fonts" INFO 2010-07-29 22:46:49,742 dev_appserver.py:3268] "GET / HTTP/ 1.1" 404 - INFO 2010-07-29 22:46:49,750 dev_appserver_index.py:205] Updating C:\Users\HP\Documents\Teste\src\index.yaml INFO 2010-07-29 22:46:49,834 dev_appserver.py:3268] "GET / favicon.ico HTTP/1.1" 404 - It seems that dev_appserver.py is blocking acess to Library/fonts -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Fill a Form on the same page with different classes - write to DB and display values
I have a model with 5 entities and intend to create a form (on the same page) but do not know how to integrate more than one form. In my main, i can play very well with the forms and write to database, but I need to put more fields on the page. These fields are of different models. My models: Teacher, Account(ReferenceProperty), Experience (ReferenceProperty), ServiceDistribution(ReferenceProperty), Experience(ReferenceProperty) My forms: class TeacherForm(djangoforms.ModelForm): class Meta: model =models.Teacher exclude = ['user'] and the same for other models My Main: class CreateCvHandler(webapp.RequestHandler): def post(self): if self.request.get('EscTeacher'): id = int(self.request.get('EscTeacher')) teacher=models.teacher.get(db.Key.from_path('Teacher', id)) else: teacher= models.teacher() data = forms.TeacherForm(data = self.request.POST) if data.is_valid(): userList= models.Account.all() userList.filter('user =', users.get_current_user()) for user in userList: teacher.user=user.key() teacher.unity=self.request.get('unity') teacher.category=self.request.get('category') teacher.regime=self.request.get('regime') teacher.put() docExp.put() self.redirect('/academy') else: self.redirect('/createCv') -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Fill a Form on the same page with different classes - write to DB and display values
I apologize if I was not specific. My program will help teachers meet their curriculum vitae. The sheet will be printed in pdf format. This single sheet has several forms that are of different classes. So far only seen examples of forms with only one class and I'm having trouble getting the form with more than one class, write on DB and display the data. In my particular case, the sheet with the forms would have five classes. On 15 Ago, 19:16, xerife wrote: > I have a model with 5 entities and intend to create a form (on the > same page) but do not know how to integrate more than one form. > > In my main, i can play very well with the forms and write to database, > but I need to put more fields on the page. > These fields are of different models. > > My models: > Teacher, Account(ReferenceProperty), Experience (ReferenceProperty), > ServiceDistribution(ReferenceProperty), Experience(ReferenceProperty) > > My forms: > class TeacherForm(djangoforms.ModelForm): > class Meta: > model =models.Teacher > exclude = ['user'] > and the same for other models > > My Main: > class CreateCvHandler(webapp.RequestHandler): > def post(self): > if self.request.get('EscTeacher'): > id = int(self.request.get('EscTeacher')) > teacher=models.teacher.get(db.Key.from_path('Teacher', > id)) > else: > teacher= models.teacher() > > data = forms.TeacherForm(data = self.request.POST) > if data.is_valid(): > > userList= models.Account.all() > userList.filter('user =', users.get_current_user()) > > for user in userList: > teacher.user=user.key() > teacher.unity=self.request.get('unity') > teacher.category=self.request.get('category') > teacher.regime=self.request.get('regime') > > teacher.put() > docExp.put() > self.redirect('/academy') > else: > self.redirect('/createCv') -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Fill a Form on the same page with different classes - write to DB and display values
Sorry, but I did not understand. I got the forms (db.Model), in the example i´ve included only the class Teacher and the respective form. But i have 5 more models/classes/forms My code is fine with just one model/form. My question is how to integrate into my main, forms of different classes. Do I have teacher.put (), Experience.put (), and so on? or is there other way? If someone showed me a real example of implementation, i would appreciate. On 16 Ago, 14:30, djidjadji wrote: > You have to use the newforms.Form class yourself and construct the > needed Fields. > > from django import newforms as forms > class FiveClassForm(forms.Form): > someNr = forms.IntegerField(min_value=1) > someStr = > forms.CharField(max_length=40,widget=forms.TextInput(attrs={'size':'40'})) > > When processing the POST, create a dictionary with Key,Value pairs and > pass this to the constructor > > def post(self): > formdict = ... > fiveForm = FiveClassForm(formdict) > if fiveForm.is_valid(): > sNr = fiveForm.clean_data['someNr'] > > 2010/8/16 xerife : > > > > > I apologize if I was not specific. My program will help teachers meet > > their curriculum vitae. The sheet will be printed in pdf format. This > > single sheet has several forms that are of different classes. So far > > only seen examples of forms with only one class and I'm having trouble > > getting the form with more than one class, write on DB and display the > > data. > > In my particular case, the sheet with the forms would have five > > classes. > > > On 15 Ago, 19:16, xerife wrote: > >> I have a model with 5 entities and intend to create a form (on the > >> same page) but do not know how to integrate more than one form. > > >> In my main, i can play very well with the forms and write to database, > >> but I need to put more fields on the page. > >> These fields are of different models. > > >> My models: > >> Teacher, Account(ReferenceProperty), Experience (ReferenceProperty), > >> ServiceDistribution(ReferenceProperty), Experience(ReferenceProperty) > > >> My forms: > >> class TeacherForm(djangoforms.ModelForm): > >> class Meta: > >> model =models.Teacher > >> exclude = ['user'] > >> and the same for other models > > >> My Main: > >> class CreateCvHandler(webapp.RequestHandler): > >> def post(self): > >> if self.request.get('EscTeacher'): > >> id = int(self.request.get('EscTeacher')) > >> teacher=models.teacher.get(db.Key.from_path('Teacher', > >> id)) > >> else: > >> teacher= models.teacher() > > >> data = forms.TeacherForm(data = self.request.POST) > >> if data.is_valid(): > > >> userList= models.Account.all() > >> userList.filter('user =', users.get_current_user()) > > >> for user in userList: > >> teacher.user=user.key() > >> teacher.unity=self.request.get('unity') > >> teacher.category=self.request.get('category') > >> teacher.regime=self.request.get('regime') > > >> teacher.put() > >> docExp.put() > >> self.redirect('/academy') > >> else: > >> self.redirect('/createCv') > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" group. > > To post to this group, send email to google-appeng...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-appengine+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Fill a Form on the same page with different classes - write to DB and display values
Hello everyone. I have this code that works. My class is a db.Model one2many with a teacher, experience, and so on... What I want is to call the class teacher with forms, but also intend to include other classes, like a form from experience class and a form from category. These classes are as foreign Key teacher. I wonder how to derive classes for teachers This is my main: class CreateCvHandler(webapp.RequestHandler): def post(self): if self.request.get('EscTeacher'): id = int(self.request.get('EscTeacher')) teacher=models.teacher.get(db.Key.from_path('Teacher', id)) else: teacher= models.teacher() data = forms.TeacherForm(data = self.request.POST) if data.is_valid(): userList= models.Account.all() userList.filter('user =', users.get_current_user()) for user in userList: teacher.user=user.key() teacher.unity=self.request.get('unity') teacher.category=self.request.get('category') teacher.regime=self.request.get('regime') teacher.put() self.redirect('/academy') else: self.redirect('/createCv' Can anyone send me a snippet Thanks On 16 Ago, 14:50, xerife wrote: > Sorry, but I did not understand. I got the forms (db.Model), in the > example i´ve included only the class Teacher and the respective form. > But i have 5 more models/classes/forms > My code is fine with just one model/form. > My question is how to integrate into my main, forms of different > classes. > Do I have teacher.put (), Experience.put (), and so on? > or is there other way? > > If someone showed me a real example of implementation, i would > appreciate. > > On 16 Ago, 14:30, djidjadji wrote: > > > > > You have to use the newforms.Form class yourself and construct the > > needed Fields. > > > from django import newforms as forms > > class FiveClassForm(forms.Form): > > someNr = forms.IntegerField(min_value=1) > > someStr = > > forms.CharField(max_length=40,widget=forms.TextInput(attrs={'size':'40'})) > > > When processing the POST, create a dictionary with Key,Value pairs and > > pass this to the constructor > > > def post(self): > > formdict = ... > > fiveForm = FiveClassForm(formdict) > > if fiveForm.is_valid(): > > sNr = fiveForm.clean_data['someNr'] > > > 2010/8/16 xerife : > > > > I apologize if I was not specific. My program will help teachers meet > > > their curriculum vitae. The sheet will be printed in pdf format. This > > > single sheet has several forms that are of different classes. So far > > > only seen examples of forms with only one class and I'm having trouble > > > getting the form with more than one class, write on DB and display the > > > data. > > > In my particular case, the sheet with the forms would have five > > > classes. > > > > On 15 Ago, 19:16, xerife wrote: > > >> I have a model with 5 entities and intend to create a form (on the > > >> same page) but do not know how to integrate more than one form. > > > >> In my main, i can play very well with the forms and write to database, > > >> but I need to put more fields on the page. > > >> These fields are of different models. > > > >> My models: > > >> Teacher, Account(ReferenceProperty), Experience (ReferenceProperty), > > >> ServiceDistribution(ReferenceProperty), Experience(ReferenceProperty) > > > >> My forms: > > >> class TeacherForm(djangoforms.ModelForm): > > >> class Meta: > > >> model =models.Teacher > > >> exclude = ['user'] > > >> and the same for other models > > > >> My Main: > > >> class CreateCvHandler(webapp.RequestHandler): > > >> def post(self): > > >> if self.request.get('EscTeacher'): > > >> id = int(self.request.get('EscTeacher')) > > >> teacher=models.teacher.get(db.Key.from_path('Teacher', > > >> id)) > > >> else: > > >> teacher= models.teacher() > > > >> data = forms.TeacherForm(data = self.request.POST) > > >> if data.is_valid(): > > > >> userList= models.Account.all() > > >> userList.filter('user =', users.get_current_user()) > > > >> for user in userList: > > >> teacher.user=user.key() > > >> teacher.unity=self.request.get('unity') > > >>
[google-appengine] Appengine - Reportlab (Get Photo from Model)
Hi, I´m using the latest reportlab version 2.5 to generate PDF´s. I´m also using Google App Engine and Django. I can get also an image that is in my source folder. Ex: for heading or footer. Everything went well to generate the PDF, but I'm having great difficulty printing to a PDF an image that an user uploaded, like his own photo. The photo is a property and is defined in model as BlobProperty (). Handler: class savePDF(webapp.RequestHandler): def post(self): user= models.Users.all() p = canvas.Canvas(self.response.out) p.drawString(50, 720, 'Curriculum Vitae : '+ '%s' % user.name) image = canvas.ImageReader(StringIO.StringIO(user.photo)) p.drawImage(image, 40,700) Model: class User(db.Model): photo = db.BlobProperty() name = db.StringProperty(required = True) View: Upload Photo: User Name: {{ user.name }} User Photo: {{ user.photo }} Note: I´ve modified utils.py this post. I´m getting errors like this one: File "C:\Users\hp\workspace\x-ray\src\principal.py", line 441, in post image = canvas.ImageReader(StringIO.StringIO(user.photo)) File "reportlab.zip\reportlab\lib\utils.py", line 588, in init File "reportlab.zip\reportlab\lib\utils.py", line 582, in init RuntimeError: Imaging Library not available, unable to import bitmaps only jpegs fileName= identity=[imagerea...@0x4a62290]. Please note that i uploaded an .jpeg image. So, i don´t get the error. If someone could help, i´d be very happy. The problem that i´m facing right now is when a user upload a photo, isn´t displayed on his PDF. I´ll show you a short pic tinypic.com/r/2ngeont/7, but the image shown is uploaded by me not by the user. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Appengine - Upload to Google Spreadsheet datastore values
Hello, I´d like to know how to upload to a Google Spreadsheet, values stored in the database of my application. Objective: Connecting to Google Spreadsheet and automatically fill in a chart in the admin area with values that were passed by the upload. I've been giving a look in the docs and it seems to me that I have to use Bulk Loader. Is this the only way? If yes how to configure the Handler if I have a spreadsheet as a link to link text Someone could give me an idea to access the Google Spreadsheet and pass the values of a Model? Model: class User (db.Model): photo= db.BlobProperty() name = db.StringProperty (required = True) surname = db.StringProperty (required = True) adress = db.PostalAddressProperty (required = True) phone = db.PhoneNumberProperty (required = True) -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.