[three]Bean
In which I avoid the inverse unicode sandwich
Jun 22, 2012 | categories: python, toscawidgets, testing, turbogears View CommentsProblem #1 - I need to test tons of HTML output for correctness (because I maintain toscawidgets2). That output varies slightly because tw2 supports five different templating languages (mako, genshi, jinja2, kajiki, and chameleon). Using double-equals (==) just won't do it.
Solution #1 - We used strainer. It works!
Problem #2 - Imagine porting this to Python 3. Yes, that's right. The encoding is sniffed by hand and then used to encode regular expressions; these are in turn applied to parse XML. Think "inverse unicode sandwich with a side of Cthulhu."
Solution #2 - I wrote sieve: a baby module child of one corner of FormEncode and another corner of strainer. It works on pythons 2.6, 2.7, and 3.2. If you like, you may use it:
>>> from sieve.operators import eq_xml, in_xml >>> a = "<foo><bar>Value</bar></foo>" >>> b = """ ... <foo> ... <bar> ... Value ... </bar> ... </foo> ... """ >>> eq_xml(a, b) True >>> c = "<html><body><foo><bar>Value</bar></foo></body></html" >>> in_xml(a, c) # 'needle' in a 'haystack' True
p.s. -- I looked into xmldiff. Awesome!
ToscaWidgets2 Bugsprint Report
Mar 04, 2012 | categories: python, toscawidgets, pyramid, turbogears View CommentsHere's the rundown of the pre-PyCon tw2 bugsprint. The unstoppable Greg Jurman and I coordinated in google+ and IRC (with lots of ad-hoc visitors in both) and did all the damage we could do to the bug list. Our goal was to close enough that we could justify a solid 2.0 non-beta release but we didn't quite get there. We settled on 2.0 release candidate 1.
tl;dr - Big progress. We'll seal the deal on 2.0 at PyCon US next week.
Infrastructure:
- tw2 sourcecode is spread out in repos all over the place. We centralized everything at http://github.com/toscawidgets.
- We're using git-flow to manage team development and releases.
- We setup a http://cia.vc bot in #toscawidgets/IRC, which is awesome.
- We're in the continuous integration queue with Shining Panda.
Tickets closed:
- Duplicated TW Encoders
- Graceful degradation when JS disabled for tw2.dynforms
- HTML5 Prompt Text
- Configurable 'location' for resources
- Disable resource injection on a per-resource basis
- Document middleware configuration values
- Handling SCRIPT_NAME
- Internationalization
- Inline templates
- Refactor resources for better compatibility with tw0.9
- Automatic 'modname' for resources
- Shortcuts for controller registration / Tidy up tutorial
Tickets worked on, but not complete:
Tickets created:
Listing all my tw2 github repositories
Mar 03, 2012 | categories: python, toscawidgets, github View CommentsJust starting out on the tw2 bugsprint this morning. I'm working on adding CompoundValidator support and Greg Jurman is working on resolving the duplicate JS encoders. That later one is a real pain. There are tons of widget libraries out that that use one set of JS objects, and plenty that use the others. To find out what uses what (so we can refactor with less pain) I had to ping my github account to find out the full list of tw2 libraries I've written.
Here it is! Using github2 to get a list of every repo (so I can clone and $ grep -nr JSFuncCall tw2.*):
#!/usr/bin/env python import github2.client ghc = github2.client.Github() # This was the trick. I have too many repos! all_repos, page = [], 0 while True: new_repos = ghc.repos.list('ralphbean', page) if not new_repos: break all_repos.extend(new_repos) page += 1 for repo in all_repos: if 'tw2' in repo.name: print repo.name
TW2 Bugsprint; the Final Countdown
Mar 02, 2012 | categories: python, toscawidgets, pyramid, turbogears View CommentsTomorrow marks the start of the toscawidgets2 24 hour bugsprint and I couldn't be more stoked. We haven't even started yet but tw2 development pushed ahead anyways.
We have:
- redesigned the tw2 homepage.
- improved tw2.jqplugins.jqgrid's sqlalchemy integration.
- pumped out one or two miscellaneous fixups to tw2.jqplugins.ui.
- released tw2.jqplugins.elrte.
- released tw2.jqplugins.elfinder (which is amazing).
- released tw2.captcha based on tgcaptcha2.
- released an alpha version of tw2.d3. It's built with WebSocket support in mind. More on that soon!
- been excited to learn that the TurboGears2 team is aiming to standardize on tw2.
- been fielding a lot more support for tw2 in Pyramid 1.3 both on the mailing list and in #toscawidgets. There's a bug still lurking out there for windows+tw2+pyramid users. At this point, if you can reproduce it and tell us about it, that would be helpful.
- got our first reports of people using tw2 with bottle. It worked!
Goal: (solidly) close as many bugs as possible and push as many libraries from beta to release as we can.
Here's to winning that game.
New toscawidgets.org frontpage
Feb 26, 2012 | categories: python, toscawidgets View CommentsThe toscawidgets2 24 hour bugsprint is this coming Saturday! In order to get you excited and to curry all of your favors, I decided to give http://toscawidgets.org a facelift.
The old http://toscawidgets.org site was confusing! 80% of the frontpage was about toscawidgets 1 which, while stable, has a diminishing number of maintainers and no active development. 20% of the page was a "news" bar on the right that pointed users to "Alpha releases" and "new documentation" for tw2, timestamped back in 2010!
I revamped it to more clearly differentiate between the two versions of the framework and to give it a more modern look (if we're building python widget libraries, we better be on top of CSS3 on our project page, right?)
Next Page ยป