Canonicalisation of usernames [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
What is the best way to get a canonical representation of a username that is idempotent?
I want to avoid having the same issue as Spotify: http://labs.spotify.com/2013/06/18/creative-usernames/
I'm looking for a good library to do this in Python. I would prefer not to do what Spotify ended up doing (running the canonicalisation twice to test if it is idempotent), and importing Twisted into my project is a tad overkill, is there a stand-alone library for this?
Would using email addresses instead be preferred when it comes to usernames? How do major sites/companies deal with this?

First your should read Wikipedia's article on Unicode equivalence. It explains the caveats and which normalization methods there are to represent an Unicode string in its canonical form.
Then you can use Python's built-in module unicodedata to do the normalization of the Unicode string to your preferred normalization form.
A code example:
>>> import unicodedata
>>> unicodedata.normalize('NFKC', u'ffñⅨffi⁵KaÅéᴮᴵᴳᴮᴵᴿᴰ')
'ffñIXffi5KaÅéBIGBIRD'
>>> unicodedata.normalize('NFKC', u'ffñⅨffi⁵KaÅéᴮᴵᴳᴮᴵᴿᴰ').lower()
'ffñixffi5kaåébigbird'

For anyone reading this a few months later:
The module that Spotify uses isn't all that hard to pull out of Twisted without a whole bunch of dependencies (Twisted can be removed entirely with close to no effort, it's only imported for version check purposes). zope.interface is the only dependency left behind, though it should be removable with a decent bit of effort.
The heart of that module is unicodedata.normalize(), so if you want to roll your own implementation out, that's where you should be starting. But like others have said, be careful, this is an area that's open to easy exploits.
EDIT: I stripped out the zope and twisted dependencies: https://gist.github.com/repole/7548478

Related

ASN1 and canonical octect encoding rules (COER) in Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I have some messages data structures represantations in ASN1. These messages have to sent using the canonical octect encoding rule (COER). I currently user asn1c for python,but, there is no support for coer. How could I create the instances and later do the encoding in python?
I'm afraid you might be in trouble. COER looks like it was standardised relatively recently (bearing in mind that ASN.1 is well over 30 years old), and I don't think that a lot of the tools have caught up yet.
The tools from OSS Nokalva seem to support COER, but they don't do a Python binding, and their tools are quite pricey (but very good).
For Python the "goto" has been the pyasn1 library, which doesn't seem to do COER (or even PER, which is a real pity).
Objective Systems, which are also very good, now do a Python ASN.1 compiler(which trumps pyasn1's code first approach), but that doesn't yet do COER.
The easiest thing might be whince, fork out for the OSS Nokalva tools, and use Iron Python to interop with their C# library and tools. That might seem an expensive way of doing it, but if your project is on a fixed timescale, that might be the lowest risk way of accomplishing what you want. You'd likely not be having to write any code to "do" COER, and instead you can concentrate on the application itself and avoid writing your own COER implementation that'd be a pain to maintain, and will eventually get surpassed by other ASN.1 tools anyway.

Is there a framework agnostic captcha module for Python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I want to add captcha support to some forms, I'm using a very lightweight Python framework, bottle, and I don't want to use something provided by an online service, like recaptcha.
Is there something already available in this direction, or is messing around with PIL the only solution?
Take a look at SkimpyGimpy, it's a python package that let's you generate CAPTCHA images and audio files. This is the package most framework-specific captcha generators that do not use re-captcha rely on.
It's a bit primitive, you may want to look at the source of collective.captcha as an example of how to use SkimpyGimpy in your own code.
Obligatory disclaimer: I am the original author of the collective.captcha package. Your mileage may vary. Don't code and drive, especially based on the say-so from others.
Found a couple: http://pypi.python.org/pypi?%3Aaction=search&term=captcha&submit=search
Pick one, cut the version number and use one of these commands (for example):
easy_install collective.captcha
pip install collective.captcha

Recommended Python Atom feed generator? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Which Python library is commonly used today to generate Atom feeds?
Note, there exists a very similar question from 2008, but its answers are mostly obsolete. The library atomxlib was recommended, but it apparently is obsolete (also the website does not exist anymore).
For future Googlers, the recommended library (WebHelpers) doesn't support Python 3, and it appears to be abandoned. There was a rewrite, WebHelpers2, but it doesn't include the feed generator, and it seems to be end-of-lifed. "Version 2.0 is the final release."
feedgen looks more up to date, it can generate both Atom and RSS feeds, and it supports Python 3 (as well as Python 2).
It's a surprisingly non trivial question.
Looking into what known projects are using, that generates rss, my two main options are:
python-feedgen is popular and documented, but (in 2021-05-01) don't have activity since the beginning of 2020.
feedgenerator with recent activity and used by 2.7k projects, but with minimal documentation (or you have to extrapolate from django rss docs)
rfeed, but have a strange PyPI publication method and (in 2021-05-01) don't have activity since the beginning of 2020.
I use webhelpers.feedgenerator. It supports Atom1 feeds.
How about rfeed?
Another one I found is the AtomFeed from Werkzeug (Atom Syndication), but the functionality is removed since the version 1.0. So I found a fork at feedwerk.
I would use one of the many templating systems out there (like Jinja2, Mako, ...)
Maybe you could reuse Django's syndication feed framework. Altough you should notice that it's usually best practice to write it by yourself because generating XML is rather simple and there's few value in using a generator as is, as mentioned by lazy1.

List of Python Object Databases [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I am looking for an object database for Python (no handmade pickles :D).
What are my options (besides the obvious ZODB)?
Dobbin. Somewhat similar to ZODB, but much simpler. It looks nice but I haven't tried it myself. I haven't been able to find much information about it. It has been at version 0.2 for over a year. I don't know if it is still being actively maintained, if it is reliable enough for mission-critical applications.
From the description on the site, the main difference between Dobbin and other object databases is that persisted objects are read-only unless they are explicitly "checked out". This may make dealing with objects a little trickier, but it may make the database faster and more memory-efficient.
MongoDB perhaps comes close - not object oriented but document-oriented and coming close to object databases.
handmade shelves? ;-)
Durus?
SqlAlchemy? it's not an object database, but chances are that you could use it
Check PersistenceTools on the python.org wiki, which mentions a few that might count. (the DatabaseProgramming page also mentions Matisse under "Non-relational Databases", I don't know it, just mention it because for some reason, it's not included on that other page)
DyBASE by Konstantin Knizhnik who developed a lot of embedded databases for multiple programming languages. It has transactions and indices. There are tests in the distribution and I use it myself for persisting elements in a Python Queue. My example is also available at github as python-persistence-queue
Cog:
Seems not updating for a long time.
itamarst.org/software/cog
And this is a paper on 6th International Python conf. about object database.
https://legacy.python.org/workshops/1997-10/proceedings/shprentz.html

Looking for knowledge base integrated with bug tracker in python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Ok, I am not sure I want to use Request Tracker and RTFM, which is a possible solution.
I'd like to have a knowledge base with my bug tracker/todo list , so that when
I solve a problem, I would have a record of its resolution for myself or others later.
What python based solutions are available?
A highly flexible issue tracker in Python I would recommend is "Roundup":
http://roundup.sourceforge.net/.
An example of its use can be seen online at http://bugs.python.org/.
Try Trac
I do have experience using probably 20-30 different bug trackers, installed or hosted and so far if you are up to deal with a big number of bugs and you want to spend less time coding-the-issues-tracker, to get Atlassian Jira, which is free for open-source projects.
Yes, it's not Python, it is Java, starts slowly and requires lots of resources. At the same time, RAM is far less expensive than your own time and if you want to extend the system you can do it in Python by using https://pypi.python.org/pypi/jira-python/
Do you think that Jira is the most used bug tracker for no reason? It wasn't the first on the market, in fact is quite new compared with others.
Once deployed you can focus on improving the workflows instead of patching the bug tracker.
One of the best features that it has is the ability to link to external issues and be able to see their status, without having to click on them. As an warning, for someone coming from another tracekr you may discover that there are some design limitations, like the fact that a bug can have a single assignee. Don't be scared about it, if you look further you will find that there are way to assign tickets to groups of peoples.

Categories

Resources