Hello !
I have been created a Zope (Python) Product.
But it is must store inner global definitions (some conversion
parameters), what I need to change in only one thread, or only once.
See below.
So: because the Zope is threaded application, the threads are use this
product. Possible in same time.
Question: the python variable setting/checking is thread-safe ?
In Delphi, or C, with threaded application I must acquire/release a lock, when I
check/set/read any variable (except integer), like this (pseudo):
lock=Lock
func ReadVar():strin g;
lock.Enter;
try
Result:=GlobalV ar;
finally
lock.Leave;
end;
proc WriteVar(val:st ring);
lock.Enter;
try
GlobalVar:=val;
finally
lock.Leave;
end;
This way is make the variable using thread-safe, because avoid to
thread A read while thread B is write (and subsections of the
information are confusing by another thread).
My code in python:
A. version)
def __init__(self):
self.Fmts=[['date','%m/%d/%Y'],['time','%H:%M.% S']]
# default is for hungarian
def SetConversionFo rmats(self,Fmts ):
s1=str(Fmts)
s2=str(self.Fmt s)
if (s1<>s2)):
self.Fmts=Fmts
B. version)
def __init__(self):
self.DefFmts=[['date','%Y.%m.% d'],['time','%H:%M.% S']]
# default is for hungarian
self.Fmts=None
def SetConversionFo rmats(self,Fmts ):
if self.Fmts==None : self.Fmts=Fmts
Usage:
updsqlobj=conte xt.updsqlobj()
updsqlobj.SetCo nversionFormats ([['date','%Y.%m.% d'],['time','%H:%M.% S']],True)
updsqlobj.Gener ateUpdateSQL(.. )
updsqlobj.Apply (..)
The Fmts is a list.
I want to set the parameters of Product in only once, but because the
Zope is threaded app, I must thinking in thread-safe programming methods.
Question1:
The code above is thread safe ? (I think, it is not)
Question2:
If it is not thread safe, how to set this variable without global
lock/mutex object ?
Question3:
Or how to I set this object's parameters as property, in Designer
interface of Zope ?
Please help me, if possible !
Thanx for it, and for every advance:
--
Best regards,
fowlertrainer mailto:fo****** *****@anonym.hu 0 1326 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gilles Lenfant |
last post by:
Hi,
I didn't receive anything from the various Zope mailing lists I should
receive.
zope@zope.org
zope-cmf@zope.org
zope-dev@zope.org
Other subscribers can confirm or have I got problems ?
|
by: Michele Simionato |
last post by:
> Hello, my name is Skip and I am metaclass-unaware. I've been programming in
> Python for about ten years and I have yet to write a metaclass. At first I
> thought it was just that metaclasses were new to the language, but now as
> more and more people use them and proclaim their widespread benefits, I have
> come to realize that through years of abuse my brain has become addicted to
> classic classes.
I began using Python since...
|
by: Jochen Demuth |
last post by:
Hi, I am trying to install ZWiki on Zope 2.5.1 / Debian 2.4.20-bf2.4-xfs.
First I copied the contents of the ZWiki-0.32.0.tgz to the
Products-directory under SOFTWARE_HOME:
This is what it contained before:
server1:/usr/lib/zope/lib/python/Products# ls
ExternalMethod PageTemplates StandardCacheManagers ZSQLMethods
Hotfix_2002-06-14 PluginIndexes TemporaryFolder ZopeTutorial
|
by: jsmilan |
last post by:
Hi, all;
I'm strictly an amateur developer who has dabbled in a half dozen
languages on eight or nine systems over 20 years or so. I have never
devoted the time or energy to thoroughly learn any one of them, so I have
become a true JOATAMON (Jack Of All Trades And Master Of None). I
apologize in advance for any truly newb sounding questions. I did Google
for this in several places first (Zope.org, Gentoo forums, and Google
UseNet...
|
by: Carl |
last post by:
Using COM and ADO on Win32, it is very easy to access databases (eg MySql,
MS SQL Server, etc) from Python.
Does anybody know if it is possible to access databases from Zope (which is
written in Python) using COM and ADO?
Carl
| |
by: Will Stuyvesant |
last post by:
Hello all,
So Zope still lives, yay. Well, I like that they use Python.
<rant>
What amazed me is they write that they "added types to the variables
and hope that it will be added to the Python project too". Really.
ROFL.
|
by: godwin |
last post by:
Hi all,
I wanna thank Martin for helping out with my ignorance concerning
execution of stored procedure with python. Now i have decided to write
a web app that googles into my companies proprietary database. I need
to know whether zope is good for that job. But even the introduction to
zope in the zope book was intimidating. Are there any simple options?
If so plz tell me how i can obtain it and study it. I should say that i
am new to web...
|
by: krzychu |
last post by:
Hi,
I have installed brand new platform - Zope-2-7-6, Python 2.4.1, Plone
2.0.5, OS Debian 1:3.3.6-2.
After import a old Plone site from the following platform
Zope-2-7-4, Python 2.3.3, Plone 2.0.3 to the new one, I get error when
I visit PuthonScript in the ZMI.
"invalid syntax (Script (Python), line 1)"
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |