views:

41

answers:

0

Hello All,

This is the piece of code I am using to generate a template:

path = os.path.join(os.path.dirname(__file__), 'tag.html')

tag = cgi.escape(self.request.get("tag"))

query = DeliciousTags.all()
query.filter("tags =", tag)
query.order('creation_date')
results = query.fetch(20)
siteList = ''

if results :
       siteList = results

template_values = {
           'tag' : tag,
           'siteList' : siteList
                  }

self.response.out.write(template.render(path, template_values))

The model looks like this:

class DeliciousTags (db.Model) :
        parent_domain = db.ReferenceProperty(Domains)
        domain_name = db.StringProperty(required = True)
        tags = db.StringListProperty()
        tagFreq = db.ListProperty(int)
        creation_date = db.DateTimeProperty(auto_now_add = True)
        last_update_date = db.DateTimeProperty(auto_now = True)

I know call the script with a valid tag "email"

I am getting this error:

Traceback (most recent call last):
  File "/sinfo/google_appengine/google/appengine/ext/webapp/__init__.py", line 511, in __call__
    handler.get(*groups)
  File "/sinfo/svn-siteinfo/siteinfo.py", line 1385, in get
    self.response.out.write(template.render(path, template_values))
  File "/sinfo/google_appengine/google/appengine/ext/webapp/template.py", line 81, in render
    return t.render(Context(template_dict))
  File "/sinfo/google_appengine/google/appengine/ext/webapp/template.py", line 121, in wrap_render
    return orig_render(context)
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 168, in render
    return self.nodelist.render(context)
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 705, in render
    bits.append(self.render_node(node, context))
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 718, in render_node
    return(node.render(context))
  File "/sinfo/google_appengine/lib/django/django/template/defaulttags.py", line 209, in render
    return self.nodelist_true.render(context)
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 705, in render
    bits.append(self.render_node(node, context))
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 718, in render_node
    return(node.render(context))
  File "/sinfo/google_appengine/lib/django/django/template/defaulttags.py", line 122, in render
    nodelist.append(node.render(context))
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 767, in render
    output = self.filter_expression.resolve(context)
  File "/sinfo/google_appengine/lib/django/django/template/__init__.py", line 579, in resolve
    obj = func(obj, *arg_vals)
  File "/sinfo/google_appengine/lib/django/django/template/defaultfilters.py", line 395, in add
    return int(value) + int(arg)
ValueError: invalid literal for int() with base 10: ''

Can someone please point out my mistake and a solution?