Saravanan666/pypi-org huggingface dataset:
Package: z3c.formwidget.optgroup
IntroductionThis package implements a widget that groups select values into optgroups.UsageImagine you have the following schema:class IMySchema(Interface):
    country = schema.Choice(
        required=True,
        title=u"Country",
        vocabulary='countries',
    )

    subdivision = schema.Choice(
        required=True,
        title=u"State",
        vocabulary='subdivisions',
    )

    region = schema.Choice(
        required=True,
        title=u"County",
        vocabulary='regions',
    )When you create your vocabularies (e.g. usingSimpleVocabulary), instead of addingSimpleTermitems:...
for country in pycountry.countries:
    terms.append(SimpleTerm(value=country.alpha2, token=country.alpha2,
                            title=country.name))
...you addOptgroupTermitems:from z3c.formwidget.optgroup.widget import OptgroupTerm

...
country_list = countries(context)
for item in pycountry.subdivisions:
    parent = country_list.getTermByToken(item.country_code).title
    terms.append(OptgroupTerm(value=item.code, token=item.code,
                              title=item.name, optgroup=parent))
...In your form, simply assign theOptgroupFieldWidget:from z3c.formwidget.optgroup.widget import OptgroupFieldWidget

class MyForm(form.Form):
    fields = field.Fields(IMySchema)

    fields['subdivision'].widgetFactory = OptgroupFieldWidget
    fields['region'].widgetFactory = OptgroupFieldWidgetContributorsThomas Massmann, AuthorChangelog1.2 (2012-05-01)Fixed wrong html tag for display mode template.
[Thomas Massmann]1.1 (2012-04-26)Always show no value message as first item.
[Thomas Massmann]1.0.1 (2012-04-14)MANIFEST.in was missing some entries.
[Thomas Massmann]1.0 (2012-04-14)Initial release.
[Thomas Massmann]
Package: z3c.formwidget.query
OverviewThis package implements a widget that lets users enter a query and
select from the results.The widget works withzope.schema.Choice-fields supplying a query
source [1], optionally in conjunction with a collection field which
then allows multiple selections.The easiest way to use the widget is to provide one of the following
aswidgetFactory:z3c.formwidget.query.widget.QuerySourceFieldRadioWidgetz3c.formwidget.query.widget.QuerySourceFieldCheckboxWidget[1] The source needs to implementIQuerySourceas defined in this
package.Changelog2.0.0 (2023-04-27)Breaking changes:Drop support for Python 2.7, 3.5, 3.6.New features:Add support for Python 3.11.1.0.0 (2022-09-07)Add Chinese translation.Add support for Python 3.5, 3.8, 3.9, 3.10.0.17 (2018-11-08)New features:Registerz3c.autoincludeentry point for automatic inclusion in plone.
[maurits]Add support for Python 3
[pbauer]0.16 (2017-11-26)Bug fixes:Improved code quality.  [maurits]0.15 (2017-08-09)Added translations for this package.  Italian and Dutch available now.
[ale-rt, fredvd, maurits]0.14 (2017-07-18)Drop support for Python 2.6.0.13 (2017-01-17)Compatible with z3c.form > 3.2.10, where radio and checkboxitemsproperty is a generator.
[thomasdesvenain]0.12 (2015-09-09)Code moved tohttps://github.com/zopefoundation/z3c.formwidget.query[maurits]0.11 (2015-04-29)Get default value from IValue adapter.
[vincentfretin]0.10 (2014-02-19)Remove :list from novalue radio box name to be the same behavior
as z3c.form >= 2.6.0.
[vincentfretin]0.9 (2012-08-30)Avoid test dependency on zope.app.testing.
[hannosch]Remove unused dependency on zope.app.form.
[hannosch]0.8 (2012-02-20)If one of the values to be displayed provides IRoleManager,
then check for permission first.
[frapell]0.7 (2011-11-07)Use an ordered list instead of a set to represent source items.
[timo]0.6 (2011-05-04)Add an ignoreMissing parameter and widget subclasses to avoid errors when
rendering missing values.
[elro]Create changelog file.
[dukebody]Respect the ignoreRequest parameter.
[dukebody]0.5 (2009-04-17)…0.3 (2008-08-28)…
Package: z3c.formwidget.unit
z3c.formwidget.unitIntroductionThis package provides a unit widget for thez3c.formlibrary.Mostly HarmlessCHANGES0.2.6 (2014-11-14)Adjust threshold for area.0.2.5 (2014-07-13)I18N updates.0.2.4 (2014-06-02)I18N updates.0.2.3 (2014-06-02)Return the unit tuple so we can better access some properties of it.0.2.2 (2014-05-26)Don’t fail when we can’t store annotations.0.2.1 (2014-05-22)Append select picker to body element (fixes some layout issues).0.2 (2014-05-21)Show unit for display.Always show 2 decimal places for the value (if type is Decimal).Fixed unit level selection.Keep selected system in contextless forms when reloading (e.g. in add-forms).0.1 (2014-05-17)Initial release.
Package: z3c.gibberish
Generate CSV files containing random words from a dictionaryGet the script from the buildout:>>> import os
>>> gibberish = os.path.join(
...     reduce(lambda path, _: os.path.dirname(path),
...            range(3), __file__), 'bin', 'gibberish')Print the help:>>> from zc.buildout.testing import system
>>> print system(gibberish+' --help'),
usage: gibberish [options] LINES COLUMN [COLUMN ...]
<BLANKLINE>
Generate lines of CSV consisting of random words from a
dictionary.  The number of lines of CSV must be specified either
as a single integer to specify a fixed number of lines or two
integers separated by a dash to specify that a random number of
lines between the two integers should be used.  The columns are
specified in the same manner where the numbers represent the
number of words in that column for a given line.
<BLANKLINE>
options:
  -h, --help            show this help message and exit
  -w WORDS, --words=WORDS
                        File containing the words to be chosen
                        from [default: /usr/share/dict/words]Make a simple file with one line and one column containing one word:>>> import cStringIO, csv
>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1 1'))))
>>> len(result)
1
>>> len(result[0])
1
>>> len(result[0][0].split())
1Make sure that the newline is stripped:>>> result[0][0][-1] != '\n'
TrueWith two words in the column:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1 2'))))
>>> len(result)
1
>>> len(result[0])
1
>>> len(result[0][0].split())
2With a random number of words in the column:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1 1-10'))))
>>> len(result)
1
>>> len(result[0])
1
>>> 1 <= len(result[0][0].split()) <= 10
TrueWith 10 lines:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 10 2'))))
>>> len(result)
10
>>> len(result[0])
1
>>> len(result[0][0].split())
2With a random number of lines:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1-10 2'))))
>>> 1 <= len(result) <= 10
True
>>> len(result[0])
1
>>> len(result[0][0].split())
2With two columns:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1 2 3'))))
>>> len(result)
1
>>> len(result[0])
2
>>> len(result[0][0].split())
2
>>> len(result[0][1].split())
3With a random number of words including zero in the column:>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' 1 0-1'))))
>>> len(result)
1
>>> len(result[0])
1
>>> len(result[0][0].split()) in (0, 1)
TrueWith a small dictionary to test exhausting the dictionary:>>> import tempfile
>>> _, tmp_path = tempfile.mkstemp()
>>> tmp = file(tmp_path, 'w')
>>> tmp.write('foo')
>>> tmp.close()
>>> result = tuple(csv.reader(cStringIO.StringIO(
...     system(gibberish+' -w %s 1 1' % tmp_path))))
>>> result
(['foo'],)
>>> os.remove(tmp_path)
Package: z3c.hashedresource
z3c.hashedresourceWhile we want browsers to cache static resources such as CSS-stylesheets and
JavaScript files, we also want themnotto use the cached version if the
files on the server have been updated. (And we don’t want to make end-users
have to empty their browser cache to get the latest version. Nor explain how
to do that over the phone every time.)To make browsers update their caches of resources immediately when the
resource changes, the absolute URLs of resources can now be made to contain a
hash of the resource’s contents, so it will look like
/++noop++12345/@@/myresource instead of /@@/myresource.In developer mode the hash is recomputed each time the resource is asked for
its URL, while in production mode the hash is computed only once, so remember
to restart the server after changing resource files (else browsers will still
see the old URL unchanged and use their outdated cached versions of the files).To use this package, include its configure.zcml and usez3c.hashedresource.interfaces.IHashedResourceSkinor a skin that inherits from
it.The dependency on zope.app.publisher >= 3.8.2 is not longer declared
explicitly in order to gain compatibility with Zope2, but it is still required
when using Zope3.CHANGES1.1.3 (2011-09-05)Removed unused (and broken) import.1.1.2 (2009-09-13)Restored compatibility with Python 2.4 by importing hashlib conditionally.1.1.1 (2009-08-25)Using haslib instead of md5 get rid of deprecation warnings with Python 2.61.1 (2009-07-27)Added compatibility with Zope2. The dependency on zope.app.publisher >= 3.8.2
is not longer declared explicitly, but still required when using Zope3.Some code and test clean-ups.1.0 (2009-06-16)first released version
Package: z3c.i18n
This package contains various i18n related convinience modules.Detailed DcoumentationZ3C I18N PackageThis package contains various i18n related convinience modules.Translation DomainsThe following translation domains are registered based on thezope.i18n.localespackage:z3c.i18n.iso.languages: Translates all available languagesz3c.i18n.iso.territories: Translates all available terrritoriesVocabulariesBased on the translation domains mentioned above, there are two
vocabularies registered. The terms of these vocabularies have aMessageas title with the according translation domain.z3c.i18n.iso.languageVocabularyFactory: Contains all languages defined.z3c.i18n.iso.territoryVocabularyFactory: Contains all territories defined.CHANGES0.1.2 (2009-12-26)Fixed documentation.Removed not needed test depenencies onzope.testingandzope.app.testing.Removed ZCML install slug.0.1.1 (2007-11-01)Improve package meta-data.0.1.0 (2007-03-22)Initial release.Listing of all terretories.List and translations of all languages.
Package: z3c.indexer
This package provides a way to index objects and query indexes for Zope3. This
implementation is different from zope.catalog and is an alternative to it.CHANGES0.6.1 (2012-11-17)Feature: implemented TextIndex with family64 BTree support which makes it
possible to use long as index ids. Added tests for the new TextIndex64.0.6.0 (2009-02-22)Feature: Add support for sorting by indexed values, introduced in
zope.index 3.5.0. See description of thesearchResultsmethod
of ISearchQuery.Bugfix: Make query object constructor work with index name
passed as unicode as well as with str.MentionsearchResultFactoryargument in thesearchResultsmethod
of the ISearchQuery interface.Added the “subscriber.zcml” file that contains ZCML-based intid subscriber
registrations for easy including in projects that use event-based indexing.The IIndexValue interface and all its mentions in code and documentation
is removed, because it’s not an actual part of concept and wasn’t ever
used/implemented in this package. It’s easy to implement it in custom
project, so we believe that it’s not a problem.Reworded package description to make it nicer. Fix little docstring typos.Use new lightweight and ZMI-less versions of packages: zope.keyreference,
zope.intid, zope.site, zope.container and zope.catalog (for tests).0.5.1 (2008-12-11)Bugfix: SearchQuery wasn’t able to act correct if initialized with query=None
because of an empty result setup. The And() and Not() methods could not act
correctly with this an empty initilized result.Bugfix: SearchQuery.And() and Not() didn’t return an empty result if previous
or given query result was empty. The previous result was returned.Feature: implemented new indexing strategy which uses transaction and thread
local for prevent to index an object more then once per transaction.Bugfix: performance tests, not query did not show the right timer in catalog
cell.Feature: added optional searchResultFactory. This class get used as a search
result wrapper. By default the ResultSet class get used.Feature: Expose SearchQuery.results property. Ensure that we return always an
empty result if None is given and allow to override existing results as a
part of the SearchQuery API.Feature: Implemented optional intids argument in SearchQuery.searchResults
method. This intids is used instead of query the IntIds util. This is usefull
if you use builtin IIntIds objects for optimized access.Added __repr__ for ResultSet with result lenght.Optimized SearchQuery.And() and Not() methods. Skip given query processing
if previous result is empty.Code is now 100% covered by tests.0.5.0 (2008-05-02)Initial release
Package: z3c.insist
This is a package that allows serializing objects to ConfigParser
files and loading them back.Changelog1.5.4 (2024-01-15)Change generation of section to folder style1.5.3 (2023-11-08)Fix inconsistencies in calculating includes paths. Please note that signature of
SeparateFileConfigurationStoreMixIn.getIncludes has changed.1.5.2 (2023-05-05)Ignored FileOpenedEvent in dispatch to avoid unnecessary processing of files in IncludingFilesHandler.1.5.1 (2023-03-23)Added support for Python 3.10 and 3.11Ignored FileOpenedEvent in dispatch to avoid unnecessary processing of files.Upgraded to the watchdog 3.0.01.5.0 (2023-01-24)Relicense under ZPL-2.1.1.4.2 (2022-04-29)Upgraded to thewatchdog2.1.7, which does not support thetimeoutparameter inEventDispatcher.dispatch_events()any more.1.4.1 (2021-10-26)Report non-existing included config files. (It helps greatly with debugging.)1.4.0 (2021-10-18)Implemented ability to include config files for file-based stores.Syntax:`#include path/to/included.ini`A newIncludeObservercomponent listens to the changes of the included
files and will update the config of the including file on
modification. Added and removing new included files is also supported.Dropped support for Python 3.6Added support for Python 3.9Removed last compatibility code with Python 2.Applied zopefoundation.meta config1.3.0 (2020-12-15)Dropped support for Python 2 and Python 3.5Added support for Python 3.81.2.0 (2018-03-31)UseConfigParser.read_file()instead ofConfigParser.readfp(), since the
latter is deprecated.1.1.4 (2017-05-25)Fixed a senseless bug that was caused by the Py3 port.1.1.3 (2017-05-25)Fixed a bug in reading the config files.Switched to modernio.open()which supports theencodingparameter.Make sure that Bytes are properly converted in both directions.1.1.2 (2017-05-24)Ensure that we always load files in a way that its content is automatically
converted to unicode.Ensure that MANIFEST is complete.1.1.1 (2017-05-24)Added badges to README.1.1.0 (2017-05-24)Support for Python 3.5, 3.6 and PyPy.Covnerted most doctests to unit tests to ease compatibility effort.First public release.1.0.0 (2017-05-15)Initial release.
Package: z3c.iplocation
This package provides a solution which allows geolocation of IP blocks, country
and continent of the visitor connection. The dataset, which must be downloaded
form www.ipligence.com, contains IP location at a worldwide level. There are
different commercial and free version available at the homepage of ipligence.See the websitehttp://www.ipligence.comfor more info about the different
license.CHANGES0.5.0 (2008-12-16)Initial ReleaseImplemented update concept. The new update method allows to update the
iplocation data based on a file upload or a file path. Added tests and
update to new coverage recipe.
Package: z3c.json
This package provides basic JSON components like JSON reader and writer
utilities and a JSON-RPC client proxy including the transport implementation
for Zope3.Detailed DocumentationREADMEWe can use theJSONReaderandJSONWriterif we need to convert a data
structure to or from JSON syntax – in other words a EcmaScript mapping
object. Let’s check the utilities:>>> import zope.component
>>> from z3c.json import interfaces
>>> from z3c.json import testing
>>> testing.setUpJSONConverter()JSONWriterUtility>>> jsonWriter = zope.component.getUtility(interfaces.IJSONWriter)
>>> jsonWriter
<z3c.json.converter.JSONWriter object at ...>Read some data:>>> input = {u'a': ['fred', 7],
...          u'b': ['mary', 1.234]}
>>> jsonStr = jsonWriter.write(input)
>>> jsonStr
u'{"a":["fred",7],"b":["mary",1.234]}'JSONReaderUtility>>> jsonReader = zope.component.getUtility(interfaces.IJSONReader)
>>> jsonReader
<z3c.json.converter.JSONReader object at ...>Convert the data back to python:>>> output = jsonReader.read(jsonStr)
>>> output
{u'a': [u'fred', 7], u'b': [u'mary', 1.234]}>>> input == output
TrueCHANGES0.5.5 (2013-02-26)More informative error message when the server returns an error.0.5.4 (2010-08-30)Fix my previous SafeBasicAuthTransport refactoring.
Tests are still missing for SSL transports.0.5.3 (2010-08-29)Refactor BasicAuthTransport to reuse as much as possible from Transport
that enables to do a simple SafeBasicAuthTransport0.5.2 (2009-02-24)raise ValueError for mixed parameters on any JSON-RPC versiondo not test for response len if response is an intfixed possible unicode error in case of response errormade all tests pass (JSONWriter inserts no whitespace)added parse_response_headers to allow subclasses to handle header values if
needed.Implemented JSON-RPC 2.0 specification. Use JSON-RPC 2.0 version as default.
Optional the version 1.0 and 1.1 can be set. See JSON-RPC 2.0 specification
for more information.0.5.1 (2008-01-24)Improved meta-data.0.5.0 (2008-01-21)Initial Release
Package: z3c.jsonrpcproxy
This package provides an JSON-RPC (javascript) proxy used for Zope3. But the
javascript itself does not depend on any zope library and can be used with any
other JSON-RPC server. Note the xmlhttp request javascript library form
z3c.xmlhttp is required for this implementationCHANGES0.6.0 (2010-01-27)Implemented JSON-RPC 2.0 specification. Use JSON-RPC 2.0 version as default.
Optional the version 1.0 and 1.1 can be set. See JSON-RPC 2.0 specification
for more information.skip alert on errors, pass them to the calling javascript method if callback
method is given0.5.0 (2008-04-16)Initial Release
Package: z3c.language.session
This package provides a session which can be used to store a language. See
z3c.language.negotiator for a sample usage.CHANGES1.0.2 (2009-11-29)removed unused imports, cleanup1.0.1 (2008-05-13)prevent create a SessionData object during getLanguage call1.0.0 (2007-01-21)Initial Release
Package: z3c.language.switch
This package provides an implementation wich let’s you implement your own i18n
aware content types.Detailed DocumentationLangauge SwitcherLet’s show howz3c.language.switchworks:Imports and placeless setup:>>> import zope.component
>>> from zope.app.testing import placelesssetup
>>> from z3c.language.switch import II18nLanguageSwitch
>>> from z3c.language.switch.testing import IContentObject
>>> from z3c.language.switch.testing import II18nContentObject
>>> from z3c.language.switch.testing import I18nContentObject
>>> from z3c.language.switch.testing import I18nContentObjectLanguageSwitch
>>> from z3c.language.switch.testing import ContentObject
>>> placelesssetup.setUp()Setup test object:>>> en_title = u'en_title'
>>> obj = I18nContentObject(en_title)
>>> obj.title
u'en_title'Add additional languages:>>> de_title = u'de_title'
>>> fr_title = u'fr_title'
>>> deObj = obj.addLanguage('de', de_title)
>>> frObj = obj.addLanguage('fr', fr_title)Switch default language:>>> obj.title
u'en_title'>>> obj.setDefaultLanguage('de')
>>> obj.title
u'de_title'Remove the ‘en’ language object:>>> obj._data.keys()
['de', 'en', 'fr']
>>> obj.removeLanguage('en')
>>> obj._data.keys()
['de', 'fr']Remove default language object will end in aValueErrorerror:>>> obj.removeLanguage('de')
Traceback (most recent call last):
...
ValueError: cannot remove default language (de)Remove nonexistent language object will end in aValueErrorerror:>>> obj.removeLanguage('undefined')
Traceback (most recent call last):
...
ValueError: cannot remove nonexistent language (undefined)Set default language to a non existent language will end in aValueError:>>> obj.setDefaultLanguage('en')
Traceback (most recent call last):
...
ValueError: cannot set nonexistent language (en) as defaultAccess the language directly via theII18nLanguageSwitchadapter,
first register the adapter for theI18nContentObject:>>> zope.component.provideAdapter(I18nContentObjectLanguageSwitch,
...     (II18nContentObject,), provides=II18nLanguageSwitch)The adapter is set to the default language in the init method:>>> adapted = II18nLanguageSwitch(obj)
>>> adapted.title
u'de_title'Change the default language and access the title again, the title should not
switch to another language:>>> obj.setDefaultLanguage('fr')
>>> adapted.title
u'de_title'Switch the language to ‘fr’  via the adapter:>>> adapted.setLanguage('fr')
>>> adapted.title
u'fr_title'Finally, clean up:>>> placelesssetup.tearDown()AvailableLanguagesVocabularyVocabularyUse this vocabulary for get the available languages from the object
itself.>>> from z3c.language.switch import vocabulary
>>> vocab = vocabulary.AvailableLanguagesVocabulary(obj)
>>> len(vocab._terms)
2>>> vocab._terms[0].value
'de'
>>> vocab._terms[0].token
'de'
>>> vocab._terms[0].title
'de'
>>> vocab._terms[1].value
'fr'
>>> vocab._terms[1].token
'fr'
>>> vocab._terms[1].title
'fr'CHANGES1.1.0 (2009-11-29)adjust dependencies, reflect changes in zope packages1.0.2 (2008-05-21)Bug: Fix typo + exception handling1.0.1 (2008-01-24)Bug: Corrected meta-data.1.0.0 (2008-01-21)Restructure: Movedzope.language.switchto it’s namespace package.
Package: z3c.listjs
z3c.listjsz3c.listjs contains a widget calledListJsWidgetthat is a drop-in
replacement for thezope.app.form.browser.ListSequenceWidget. It
allows users to add and remove list items without the need for server
interaction, using Javascript.Note: This package only works withzope.formlib(zope.app.form) and is not compatible withz3c.form.You can useListJsWidgetfor anyschema.Listfield using the
normalzope.formlibcustom widget pattern:from z3c.listjs import ListJsWidget

...

form_fields['foo'].custom_widget = ListJsWidgetWith the right ZCML override it should also be possible to
automatically use this widget in all casesListSequenceWidgetwould normally be used. Documentation contributions are welcome!Should you wish to override the CSS for the buttons, the CSS classes
areup_buttonanddown_button. If you are using hurry.resource
for your overriding CSS, your resource should depend onz3c.listjs.listjs_cssso that ordering is correct to make the
override happen.CHANGES1.0b1 (2009-06-04)Javascript in<script>blocks andonclickhandlers are also
renumbered so that references to the element id in question are
updated. This won’t be reliable in the (assumed to uncommon) case
where a widget id is referenced within the HTML that isnotthe
field of the widget being rendered.If TinyMCE is installed, care is taken to disconnect TinyMCE editors
before moving. Reconnection of the moved editors is assumed to take
place in the included HTML for the new element, using something
like:tinyMCE.execCommand('mceAddControl', false, 'id_of_element');A few small bugfixes:prefix is passed along to update_numbersattris a local as it should be.getElementsByClassNameactually filters by class name.1.0a4 (2008-02-04)Really fixed up/down arrow for added items.1.0a3 (2009-02-03)Fix bug where up/down arrows didn’t appear for newly added items.1.0a2 (2009-01-23)Allow moving individual list items up and down in the list.1.0a1 (2009-01-08)Initial public release.Download