Eddie BRUGGEMANN | 13 Jul 22:26
Picon
Favicon

apply a treatment on an attribute value


------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
Filip Polsakiewicz | 11 May 11:16
Picon
Gravatar

Passing the same parameter to all templates or even better the master template

Hi all,


another problem i stumbled upon.
I use the following layout:

<html xmlns:py="http://purl.org/kid/ns#">
<head>
<title>ATF - ${page_title}</title>
</head>
<body>
                <div id="sectionimage">
                  <img src="/img/${sectionImage}.png" alt="${pageTitle}" height="50" />
                </div>
   <content>Default Content</content>
        <div id="messagebox" py:if="len(messages) > 0">
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
            <p>Messsage</p>
        </div>
</body>
</html>

where <content> is replaced by content of other templates:

<?python
layout_params['page_title'] = "Scheduler"
?>
<html py:layout="'template.kid'"
      xmlns:py="http://purl.org/kid/ns#">

  <div py:match="item.tag == 'content'" class="content">
     Hello World
  </div>
</html>

What I would like to do is to pass the messages list to the master template without having to specify it each time as it is always the same variable.
Can this be achieved in kid?

Thanks,

Filip


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss
Filip Polsakiewicz | 10 May 15:50
Picon
Gravatar

Using jQuery and jQuery UI with Kid templates

Hi all,


I am having trouble to include the jQuery/jQueryUI javascripts in my template.
Here is what my template looks like:

<html xmlns:py="http://purl.org/kid/ns#">
<head>
<title>snomATF - ${page_title}</title>
<link rel="stylesheet" type="text/css" href="/css/page.css" />
<link rel="stylesheet" type="text/css" href="/css/menu_style.css" />
        <link rel="icon" type="image/vnd.microsoft.icon" href="/img/favicon.ico" />
        <link type="text/css" href="/css/ui-darkness/jquery-ui-1.8.12.custom.css" rel="stylesheet" />
        <script type="text/javascript" src="/js/jquery-1.5.1.min.js" />
        <script type="text/javascript" src="/js/jquery-ui-1.8.12.custom.min.js" />
</head>
<body>
<img src="/img/img.png" alt="mycompany" height="50"/>
                <div id="sectionimage">
                  <img src="/img/${sectionImage}.png" alt="${pageTitle}" height="50" />
                </div>
                <div class="atf-menu">menu</div>
   <content>Default Content</content>
</body>
</html>

Unfortunately the result is that after the template processing it seems that the first script tag is not closed and embeds the remaining part of the page.
So what I see is an empty page.

Can anyone help?

Thanks,

Filip
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss
Till Maas | 13 Sep 14:59
Gravatar

Patch to properly escape [[< to [[&gt;

Hi,

[[< needs to be escaped to [[&gt; in serialization.py. The attached
patch fixes this and works for people using python-kid on Fedora.

A Fedora bug report with more details is available here:
https://bugzilla.redhat.com/show_bug.cgi?id=528729

Regards
Till
diff -up kid-0.9.6/kid/serialization.py.escape-gt kid-0.9.6/kid/serialization.py
--- kid-0.9.6/kid/serialization.py.escape-gt	2007-07-16 13:02:53.000000000 +0200
+++ kid-0.9.6/kid/serialization.py	2010-01-10 14:42:09.000000000 +0100
@@ -408,6 +408,7 @@ class XMLSerializer(Serializer):
                     return encode_entity(text, entities=entity_map)
             text = text.replace("&", "&amp;")
             text = text.replace("<", "&lt;")
+            text = text.replace("]]>", "]]&gt;")
         except (TypeError, AttributeError):
             raise_serialization_error(text)
         return text
@@ -423,6 +424,7 @@ class XMLSerializer(Serializer):
                     return encode_entity(text, entities=entity_map)
             text = text.replace("&", "&amp;")
             text = text.replace("<", "&lt;")
+            text = text.replace("]]>", "]]&gt;")
             text = text.replace("\"", "&quot;")
         except (TypeError, AttributeError):
             raise_serialization_error(text)
@@ -684,6 +686,7 @@ class HTMLSerializer(HTMLBased, Serializ
             if escape:
                 text = text.replace("&", "&amp;")
                 text = text.replace("<", "&lt;")
+                text = text.replace("]]>", "]]&gt;")
         except (TypeError, AttributeError):
             raise_serialization_error(text)
         return text
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss
David Stanek | 7 Jun 05:29

Code On SourceForge

The most recent version of the Kid code is now on SourceForge[1]. Have at it!

1. https://sourceforge.net/projects/kid-template/

--

-- 
David
blog: http://www.traceback.org
twitter: http://twitter.com/dstanek

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
Steve Clement | 29 May 00:48
Picon
Gravatar

Problems with kid templates and python 2.6.5


Dear all,

I have the following issue, with this code:

base.kid
----8<-----
<head py:match="item.tag == 'head'">
        <?python
                title=item.find('title')
                if title is not None:
                        item.remove(title)
                        title = title.text
        ?>
        <title>
                Kieser Training Customer Portal
                <span py:strip="" py:if="title"> - ${title}</span>
        </title>
        <link rel="shortcut icon" href="kieser-icon.png" />
        <link rel="stylesheet" href="base.css" title="Base styles"
type="text/css" />
        <script type="text/javascript" src="js/MochiKit/MochiKit.js" />
        <script type="text/javascript">
        var loading = new Image();
        loading.src = "loading.gif";
        </script>
        <div py:for="node in item" py:replace="node" />
</head>
------8<------

if I compile this and open my page in the web browser I get the
following error:

  File "/usr/local/lib/python2.6/dist-packages/kieser/stat/web/base.py",
line 67, in _match_func
    title=item.find('title')

AttributeError: 'Element' object has no attribute 'find'

As far as I can tell the code that has been generated is faulty. You
cannot use .find on the list that has been generated.

Did anyone else have this problem?

Thanks,

Steve

--

-- 
The Hackerspace in Luxembourg!
syn2cat Hackerspace.lu A.S.B.L.
11, rue du Cimetière | L-8018 Strassen
http://www.hackerspace.lu
xmpp:SteveClement <at> jabber.hackerspaces.org
mailto:steve <at> hackerspace.lu
.lu: +352 20 333 55 65
Jason Rennie | 9 Feb 17:13
Picon
Gravatar

broken web site

The Kid web site is still broken.  Is there anything I can do to help?


Cheers,

Jason

--
Jason Rennie
Research Scientist, ITA Software
617-714-2645
http://www.itasoftware.com/

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss
Jason Rennie | 3 Feb 16:24
Picon
Gravatar

template compilation logic

Could someone please describe the logic for whether-or-not a new .pyc file is generated before execution?  I just ran into a situation where turbogears/kid used a .pyc file that did not correspond to the .kid file in the directory with the same name.  I'm not sure, but the mtime on the .pyc file might have been later than the .kid file.  The .kid file was installed via an RPM and probably had an old timestamp.  I know that with python, the .pyc is recreated whenever the timestamp stored in the .pyc does not exactly match the mtime of the .py file.  Does Kid not use similar logic to determine whether-or-not to compile?


Thanks,

Jason

P.S. Many links on the kid home page currently generate the following error:

<type 'exceptions.OSError'>: [Errno 24] Too many open files: '/srv/kid-templating.org/var/trac/plugins
      args = (24, 'Too many open files') 
      errno = 24 
      filename = '/srv/kid-templating.org/var/trac/plugins
      message = '' 
      strerror = 'Too many open files'

--
Jason Rennie
Research Scientist, ITA Software
617-714-2645
http://www.itasoftware.com/

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss
Traduction.BIZ | 17 Sep 19:09
Favicon
Gravatar

Python problem while installing Kid 0.9.6 on FC10 server

Hi,

I'm trying to install Kid 0.9.6.

I ran the command:

./setup.py install

I got the following messages:

running install
error: invalid Python installation: unable to open
/usr/lib/python2.5/config/Makefile (No such file or directory)

Would anyone have any useful tips about what to do to fix this?

Thanks if so, :)

--
David Nelson

Voicemail: +44.7092894743
Fax: +44.7092894744
E-mail: commerce <at> traduction.biz
Twitter: http://twitter.com/TraductionBIZ
Skype: traduction.biz
Web: http://traduction.biz
---

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
Joshua J. Kugler | 8 Jul 02:09
Gravatar

Bug in XML()

Hi!

I just came across a bug in XML().

I was trying to generate shtml includes, so had a line like:

 ${XML('<!--#include virtual="/stations/' + si['OutputDir'] 
+ '/stationMenu.html" -->')}

However, in my processed template, this string would show up:

${XML('')}

I discovered that if you pass a string to XML that has comments in it 
(i.e. <!-- and -->) the evaluation doesn't run and you get the line 
verbatim in your output.

I had to do this:

<?python
var = '<!--#include virtual="/stations/' + si['OutputDir'] 
+ '/stationMenu.html"-->'
?>
${XML(var)}

Strange.

j

--

-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
Gravatar

http://www.kid-templating.org/trac/

Hi,

I have just seen that the trac installation on kid-templating is not working 
for some reason. I attached the page output (python debug output), so you can 
check it out and hopefully fix it. It says that there is some problem with 
"database disk image".

Cheers
Filip

-- 
Filip Brčić <brcha <at> gna.org>
WWWeb: http://www.brcha.iz.rs
Jabber: brcha <at> kdetalk.net

This email may come with a PGP signature as a file. Do not panic.
For more info see: http://en.wikipedia.org/wiki/OpenPGP

 
 
<class 'pysqlite2.dbapi2.DatabaseError'>
Python 2.5.1: /usr/bin/python
Sun Mar 15 11:26:21 2009

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /var/lib/python-support/python2.5/trac/web/_fcgi.py in run(self=<trac.web._fcgi.Request object at 0x82bc68c>)
  568         """Runs the handler, flushes the streams, and ends the request."""
  569         try:
  570             protocolStatus, appStatus = self.server.handler(self)
  571         except:
  572             traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self = <trac.web._fcgi.Request object at 0x82bc68c>, self.server = <trac.web._fcgi.WSGIServer object at 0x40214cec>, self.server.handler = <bound method WSGIServer.handler of <trac.web._fcgi.WSGIServer object at 0x40214cec>>
 /var/lib/python-support/python2.5/trac/web/_fcgi.py in handler(self=<trac.web._fcgi.WSGIServer object at 0x40214cec>, req=<trac.web._fcgi.Request object at 0x82bc68c>)
 1254         try:
 1255             try:
 1256                 result = self.application(environ, start_response)
 1257                 try:
 1258                     for data in result:
result = None, self = <trac.web._fcgi.WSGIServer object at 0x40214cec>, self.application = <function dispatch_request at 0x828425c>, environ = {'DOCUMENT_ROOT': '/srv/kid-templating.org/www/htdocs/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html, image/jpeg, image/png, text/*, image/*, */*', 'HTTP_ACCEPT_CHARSET': 'utf-8, utf-8;q=0.5, *;q=0.5', 'HTTP_ACCEPT_ENCODING': 'x-gzip, x-deflate, gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US, en', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_HOST': 'www.kid-templating.org', 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; Konqueror/4.1; Linux 2.... X11; x86_64; en-US, en) KHTML/4.1.3 (like Gecko)', 'PATH_INFO': '/', ...}, start_response = <function start_response at 0x865ca74>
 /var/lib/python-support/python2.5/trac/web/main.py in dispatch_request(environ={'DOCUMENT_ROOT': '/srv/kid-templating.org/www/htdocs/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html, image/jpeg, image/png, text/*, image/*, */*', 'HTTP_ACCEPT_CHARSET': 'utf-8, utf-8;q=0.5, *;q=0.5', 'HTTP_ACCEPT_ENCODING': 'x-gzip, x-deflate, gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-US, en', 'HTTP_CONNECTION': 'Keep-Alive', 'HTTP_HOST': 'www.kid-templating.org', 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; Konqueror/4.1; Linux 2.... X11; x86_64; en-US, en) KHTML/4.1.3 (like Gecko)', 'PATH_INFO': '/', ...}, start_response=<function start_response at 0x865ca74>)
  389     env = env_error = None
  390     try:
  391         env = _open_environment(env_path, run_once=run_once)
  392         if env.base_url:
  393             environ['trac.base_url'] = env.base_url
env = None, global _open_environment = <function _open_environment at 0x827bf0c>, env_path = '/srv/kid-templating.org/var/trac', run_once = False
 /var/lib/python-support/python2.5/trac/web/main.py in _open_environment(env_path='/srv/kid-templating.org/var/trac', run_once=False)
   56     try:
   57         if not env_path in env_cache:
   58             env_cache[env_path] = open_environment(env_path)
   59         env = env_cache[env_path]
   60     finally:
global env_cache = {}, env_path = '/srv/kid-templating.org/var/trac', global open_environment = <function open_environment at 0x825880c>
 /var/lib/python-support/python2.5/trac/env.py in open_environment(env_path='/srv/kid-templating.org/var/trac')
  461 
  462     env = Environment(env_path)
  463     if env.needs_upgrade():
  464         raise TracError, 'The Trac Environment needs to be upgraded. Run ' \
  465                          'trac-admin %s upgrade"' % env_path
env = <trac.env.Environment object at 0x86a088c>, env.needs_upgrade = <bound method Environment.needs_upgrade of <trac.env.Environment object at 0x86a088c>>
 /var/lib/python-support/python2.5/trac/env.py in needs_upgrade(self=<trac.env.Environment object at 0x86a088c>)
  341         db = self.get_db_cnx()
  342         for participant in self.setup_participants:
  343             if participant.environment_needs_upgrade(db):
  344                 self.log.warning('Component %s requires environment upgrade',
  345                                  participant)
participant = <trac.env.EnvironmentSetup object at 0x834e36c>, participant.environment_needs_upgrade = <bound method EnvironmentSetup.environment_needs... <trac.env.EnvironmentSetup object at 0x834e36c>>, db = <trac.db.pool.PooledConnection object at 0x834e88c>
 /var/lib/python-support/python2.5/trac/env.py in environment_needs_upgrade(self=<trac.env.EnvironmentSetup object at 0x834e36c>, db=<trac.db.pool.PooledConnection object at 0x834e88c>)
  395 
  396     def environment_needs_upgrade(self, db):
  397         dbver = self.env.get_version(db)
  398         if dbver == db_default.db_version:
  399             return False
dbver undefined, self = <trac.env.EnvironmentSetup object at 0x834e36c>, self.env = <trac.env.Environment object at 0x86a088c>, self.env.get_version = <bound method Environment.get_version of <trac.env.Environment object at 0x86a088c>>, db = <trac.db.pool.PooledConnection object at 0x834e88c>
 /var/lib/python-support/python2.5/trac/env.py in get_version(self=<trac.env.Environment object at 0x86a088c>, db=<trac.db.pool.PooledConnection object at 0x834e88c>)
  255             db = self.get_db_cnx()
  256         cursor = db.cursor()
  257         cursor.execute("SELECT value FROM system WHERE name='database_version'")
  258         row = cursor.fetchone()
  259         return row and int(row[0])
cursor = <trac.db.util.IterableCursor object at 0x8776fd4>, cursor.execute = <bound method IterableCursor.execute of <trac.db.util.IterableCursor object at 0x8776fd4>>
 /var/lib/python-support/python2.5/trac/db/util.py in execute(self=<trac.db.util.IterableCursor object at 0x8776fd4>, sql="SELECT value FROM system WHERE name='database_version'", args=None)
   49             # print repr(args)
   50             return self.cursor.execute(sql_escape_percent(sql), args)
   51         return self.cursor.execute(sql)
   52 
   53     def executemany(self, sql, args=None):
self = <trac.db.util.IterableCursor object at 0x8776fd4>, self.cursor = <trac.db.sqlite_backend.PyFormatCursor object at 0x875d6ec>, self.cursor.execute = <bound method PyFormatCursor.execute of <trac.db.sqlite_backend.PyFormatCursor object at 0x875d6ec>>, sql = "SELECT value FROM system WHERE name='database_version'"
 /var/lib/python-support/python2.5/trac/db/sqlite_backend.py in execute(self=<trac.db.sqlite_backend.PyFormatCursor object at 0x875d6ec>, sql="SELECT value FROM system WHERE name='database_version'", args=None)
   54                 sql = sql % (('?',) * len(args))
   55             return self._rollback_on_error(sqlite.Cursor.execute, sql,
   56                                            args or [])
   57         def executemany(self, sql, args=None):
   58             if args:
args = None
 /var/lib/python-support/python2.5/trac/db/sqlite_backend.py in _rollback_on_error(self=<trac.db.sqlite_backend.PyFormatCursor object at 0x875d6ec>, function=<method 'execute' of 'pysqlite2.dbapi2.Cursor' objects>, *args=("SELECT value FROM system WHERE name='database_version'", []), **kwargs={})
   46         def _rollback_on_error(self, function, *args, **kwargs):
   47             try:
   48                 return function(self, *args, **kwargs)
   49             except sqlite.DatabaseError, e:
   50                 self.cnx.rollback()
function = <method 'execute' of 'pysqlite2.dbapi2.Cursor' objects>, self = <trac.db.sqlite_backend.PyFormatCursor object at 0x875d6ec>, args = ("SELECT value FROM system WHERE name='database_version'", []), kwargs = {}

<class 'pysqlite2.dbapi2.DatabaseError'>: database disk image is malformed
      args = ('database disk image is malformed',)
      message = 'database disk image is malformed'

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss

Gmane